@@ -11,13 +11,9 @@ import { Playback } from "./modules/Playback";
1111import { Stats } from "./modules/Stats" ;
1212import { ITransformedNode } from "./types" ;
1313
14-
1514export const SimWrapper : FC = ( ) => {
1615 const {
17- state : {
18- topologyPath,
19- topologyLoaded,
20- } ,
16+ state : { topologyPath, topologyLoaded } ,
2117 dispatch,
2218 } = useSimContext ( ) ;
2319
@@ -31,7 +27,10 @@ export const SimWrapper: FC = () => {
3127 const topographyRes = await fetch ( topologyPath ) ;
3228 const topography = parse ( await topographyRes . text ( ) ) ;
3329 const nodes = new Map < string , ITransformedNode > ( ) ;
34- const links = new Map < string , { source : string ; target : string ; latencyMs ?: number } > ( ) ;
30+ const links = new Map <
31+ string ,
32+ { source : string ; target : string ; latencyMs ?: number }
33+ > ( ) ;
3534 for ( const [ id , node ] of Object . entries < Node < Coord2D > > (
3635 topography . nodes ,
3736 ) ) {
@@ -48,12 +47,15 @@ export const SimWrapper: FC = () => {
4847 for ( const [ peerId , peerData ] of Object . entries ( node . producers ) ) {
4948 const linkIds = [ id , peerId ] . sort ( ) ;
5049 const linkKey = `${ linkIds [ 0 ] } |${ linkIds [ 1 ] } ` ;
51-
50+
5251 // Store latency from this node to the peer
53- const latencyMs = ( peerData as any ) ?. [ ' latency-ms' ] ;
54-
52+ const latencyMs = ( peerData as any ) ?. [ " latency-ms" ] ;
53+
5554 // Only set latency if we haven't seen this link before, or if this latency is valid
56- if ( ! links . has ( linkKey ) || ( latencyMs !== undefined && latencyMs !== null ) ) {
55+ if (
56+ ! links . has ( linkKey ) ||
57+ ( latencyMs !== undefined && latencyMs !== null )
58+ ) {
5759 links . set ( linkKey , {
5860 source : linkIds [ 0 ] ,
5961 target : linkIds [ 1 ] ,
@@ -73,22 +75,16 @@ export const SimWrapper: FC = () => {
7375 } , [ topologyPath ] ) ;
7476
7577 return (
76- < >
77- < div className = "flex flex-col items-center justify-between gap-4 z-10 absolute left-10 top-10" >
78+ < div className = "relative h-screen w-screen" >
79+ < div className = "flex flex-col items-start gap-4 z-10 absolute left-10 top-10" >
80+ < Scenario />
7881 < Stats />
7982 </ div >
80- < div className = "flex items-center justify-center gap-4 relative h-screen w-screen" >
81- { topologyLoaded ? < GraphWrapper /> : null }
82- < div className = "absolute bottom-12 flex w-3/4 gap-4 justify-center" >
83- < div className = "flex flex-shrink-0 border-2 rounded-md p-4 border-gray-200 gap-4 my-4 mx-auto bg-white/80 backdrop-blur-xs" >
84- < Scenario />
85- </ div >
86- < div className = "flex border-2 rounded-md p-4 border-gray-200 gap-4 my-4 mx-auto w-full bg-white/80 backdrop-blur-xs" >
87- < Playback />
88- < TimelineSlider />
89- </ div >
90- </ div >
83+ { topologyLoaded ? < GraphWrapper /> : null }
84+ < div className = "absolute bottom-10 left-10 right-10 z-10 border-2 rounded-md p-4 border-gray-200 bg-white/80 backdrop-blur-xs flex gap-4" >
85+ < Playback />
86+ < TimelineSlider />
9187 </ div >
92- </ >
88+ </ div >
9389 ) ;
9490} ;
0 commit comments