From d2777d6a5f0e3e9810d09514b58f65dd350a20dc Mon Sep 17 00:00:00 2001 From: Juliet Date: Wed, 6 May 2026 21:35:10 +0200 Subject: [PATCH] fix layout shift when adding collections to stream stats --- src/views/stream/stats.tsx | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/views/stream/stats.tsx b/src/views/stream/stats.tsx index 3bc64c3..e550cbd 100644 --- a/src/views/stream/stats.tsx +++ b/src/views/stream/stats.tsx @@ -1,6 +1,8 @@ import { For, Show } from "solid-js"; import { STREAM_CONFIGS, StreamType } from "./config"; +const TOP_COLLECTION_LIMIT = 5; + export type StreamStats = { connectedAt?: number; totalEvents: number; @@ -33,7 +35,7 @@ export const StreamStatsPanel = (props: { const topCollections = () => Object.entries(props.stats.collections) .sort(([, a], [, b]) => b - a) - .slice(0, 5); + .slice(0, TOP_COLLECTION_LIMIT); return ( @@ -54,33 +56,31 @@ export const StreamStatsPanel = (props: { - 0}> -
-
- {config().collectionsLabel} -
-
- - {([collection, count]) => { - const percentage = ((count / props.stats.totalEvents) * 100).toFixed(1); - return ( - <> - - {collection} - - - {count.toLocaleString()} - - - {percentage}% - - - ); - }} - -
+
+
+ {config().collectionsLabel} +
+
+ + {([collection, count]) => { + const percentage = ((count / props.stats.totalEvents) * 100).toFixed(1); + return ( + <> + + {collection} + + + {count.toLocaleString()} + + + {percentage}% + + + ); + }} +
- +
); -- 2.51.2