diff --git a/src/features/Overview/ShredsProgression/shredsProgressionPlugin.ts b/src/features/Overview/ShredsProgression/shredsProgressionPlugin.ts index b2410645..b25c5d88 100644 --- a/src/features/Overview/ShredsProgression/shredsProgressionPlugin.ts +++ b/src/features/Overview/ShredsProgression/shredsProgressionPlugin.ts @@ -27,8 +27,9 @@ import { slotsPerLeader } from "../../../consts"; const store = getDefaultStore(); export const shredsXScaleKey = "shredsXScaleKey"; +type Coordinates = [x: number, y: number, width?: number]; type EventsByFillStyle = { - [fillStyle: string]: Array<[x: number, y: number, width: number]>; + [fillStyle: string]: Array; }; export type Position = [xPos: number, cssWidth: number | undefined]; export type LabelPositions = { @@ -125,6 +126,8 @@ export function shredsProgressionPlugin( const rowPxHeight = clamp(canvasHeight / maxShreds, 1, 10); const gapPxHeight = 1; + const dotSize = Math.max(rowPxHeight, 3); + // n rows, n-1 gaps const rowsCount = Math.trunc( (canvasHeight + gapPxHeight) / (rowPxHeight + gapPxHeight), @@ -135,7 +138,7 @@ export function shredsProgressionPlugin( const eventsByFillStyle: EventsByFillStyle = {}; const addEventPosition = ( fillStyle: string, - position: [x: number, y: number, width: number], + position: Coordinates, ) => { eventsByFillStyle[fillStyle] ??= []; eventsByFillStyle[fillStyle].push(position); @@ -168,7 +171,6 @@ export function shredsProgressionPlugin( tsXValueOffset, y: (rowPxHeight + gapPxHeight) * rowIdx + u.bbox.top, getYOffset, - dotWidth: rowPxHeight, scaleX: u.scales[shredsXScaleKey], getXPos, }); @@ -179,7 +181,12 @@ export function shredsProgressionPlugin( u.ctx.beginPath(); u.ctx.fillStyle = fillStyle; for (const [x, y, width] of eventsByFillStyle[fillStyle]) { - u.ctx.rect(x, y, width, rowPxHeight); + if (width == null) { + // dot + u.ctx.rect(x, y, dotSize, dotSize); + } else { + u.ctx.rect(x, y, width, rowPxHeight); + } } u.ctx.fill(); } @@ -256,10 +263,7 @@ const getDrawInfo = ( }; interface AddEventsForRowArgs { - addEventPosition: ( - fillStyle: string, - position: [x: number, y: number, width: number], - ) => void; + addEventPosition: (fillStyle: string, position: Coordinates) => void; u: uPlot; firstShredIdx: number; lastShredIdx: number; @@ -272,7 +276,6 @@ interface AddEventsForRowArgs { getYOffset?: ( eventType: Exclude, ) => number; - dotWidth: number; scaleX: uPlot.Scale; getXPos: (xVal: number) => number; } @@ -292,7 +295,6 @@ function addEventsForRow({ isSlotSkipped, y, getYOffset, - dotWidth, scaleX, getXPos, }: AddEventsForRowArgs) { @@ -316,7 +318,7 @@ function addEventsForRow({ const eventPositions = new Map< Exclude, - [x: number, y: number, width: number] + Coordinates >(); // draw events from highest to lowest priority @@ -335,7 +337,7 @@ function addEventsForRow({ eventPositions.set( eventType, drawOnlyDots || isSlotSkipped - ? [startXPos, y + yOffset, dotWidth] + ? [startXPos, y + yOffset] : [startXPos, y + yOffset, endXPos - startXPos], ); endXPos = startXPos; diff --git a/src/features/StartupProgress/Firedancer/Gossip/gossip.module.css b/src/features/StartupProgress/Firedancer/Gossip/gossip.module.css index b56681b9..1ad2a637 100644 --- a/src/features/StartupProgress/Firedancer/Gossip/gossip.module.css +++ b/src/features/StartupProgress/Firedancer/Gossip/gossip.module.css @@ -1,5 +1,6 @@ .card { flex-grow: 1; + flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; diff --git a/src/features/StartupProgress/Firedancer/Gossip/index.tsx b/src/features/StartupProgress/Firedancer/Gossip/index.tsx index fba85567..c90130a9 100644 --- a/src/features/StartupProgress/Firedancer/Gossip/index.tsx +++ b/src/features/StartupProgress/Firedancer/Gossip/index.tsx @@ -46,55 +46,47 @@ export default function Gossip() { remainingSeconds={remainingSeconds} /> - - - - - - - - - - Ingress - - {ingressThroughput - ? `${ingressThroughput.value} ${ingressThroughput.unit}/s` - : "-- Mbit/s"} - - - + + + + + + - - Egress - - {egressThroughput - ? `${egressThroughput.value} ${egressThroughput.unit}/s` - : "-- Mbit/s"} - - - + + Ingress + + {ingressThroughput + ? `${ingressThroughput.value} ${ingressThroughput.unit}ps` + : "-- Mbps"} + + - - Stake Discovered + + + Egress + + {egressThroughput + ? `${egressThroughput.value} ${egressThroughput.unit}ps` + : "-- Mbps"} + + diff --git a/src/features/StartupProgress/Firedancer/Snapshot/SnapshotBarsCard.tsx b/src/features/StartupProgress/Firedancer/Snapshot/SnapshotBarsCard.tsx index be83e5e8..8580af72 100644 --- a/src/features/StartupProgress/Firedancer/Snapshot/SnapshotBarsCard.tsx +++ b/src/features/StartupProgress/Firedancer/Snapshot/SnapshotBarsCard.tsx @@ -87,9 +87,11 @@ export function AccountsRate({ cumulativeAccounts }: AccountsRateProps) { }, [phase, reset]); const value = useMemo(() => { + // Possible to have no rate due to only having a single point + if (cumulativeAccounts != null && accountsPerSecond == null) return "0"; if (accountsPerSecond == null) return; return compactSingleDecimalFormatter.format(accountsPerSecond); - }, [accountsPerSecond]); + }, [accountsPerSecond, cumulativeAccounts]); return (
diff --git a/src/utils.ts b/src/utils.ts index 47217239..ce129a7d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -315,7 +315,7 @@ export function formatBytes( if (bytes === 0 && noDecimalForZero) return { value: "0", unit: "B" }; if (bytes < 1_000) return { value: bytes.toFixed(precision), unit: "B" }; if (bytes < 1_000_000) - return { value: (bytes / 1_000).toFixed(precision), unit: "KB" }; + return { value: (bytes / 1_000).toFixed(precision), unit: "kB" }; if (bytes < 1_000_000_000) { return { value: (bytes / 1_000_000).toFixed(precision), unit: "MB" }; }