atmosphere explorer

conditionally show event types for jetstream

handle.invalid f0a74a26 f51150e3

verified
+14 -2
+6 -1
src/views/stream/index.tsx
··· 402 402 )} 403 403 </For> 404 404 </div> 405 - <StreamStatsPanel stats={stats()} currentTime={currentTime()} streamType={streamType} /> 405 + <StreamStatsPanel 406 + stats={stats()} 407 + currentTime={currentTime()} 408 + streamType={streamType} 409 + showAllEvents={searchParams.allEvents === "on"} 410 + /> 406 411 <div class="flex justify-end gap-2"> 407 412 <button 408 413 type="button"
+8 -1
src/views/stream/stats.tsx
··· 27 27 stats: StreamStats; 28 28 currentTime: number; 29 29 streamType: StreamType; 30 + showAllEvents?: boolean; 30 31 }) => { 31 32 const config = () => STREAM_CONFIGS[props.streamType]; 32 33 const uptime = () => (props.stats.connectedAt ? props.currentTime - props.stats.connectedAt : 0); 34 + 35 + const shouldShowEventTypes = () => { 36 + if (!config().showEventTypes) return false; 37 + if (props.streamType === "jetstream") return props.showAllEvents === true; 38 + return true; 39 + }; 33 40 34 41 const topCollections = () => 35 42 Object.entries(props.stats.collections) ··· 66 73 </div> 67 74 </div> 68 75 69 - <Show when={topEventTypes().length > 0 && config().showEventTypes}> 76 + <Show when={topEventTypes().length > 0 && shouldShowEventTypes()}> 70 77 <div class="mt-2"> 71 78 <div class="mb-1 text-xs text-neutral-500 dark:text-neutral-400">Event Types</div> 72 79 <div class="grid grid-cols-[1fr_5rem_3rem] gap-x-1 gap-y-0.5 font-mono text-xs sm:gap-x-4">