Skip to content

Commit b62d8f0

Browse files
authored
Merge pull request #38 from aldrin-labs/copilot/fix-37
Fix broken data structure visualization in orderbook-visualizer.html
2 parents 4fcf631 + 7deef6b commit b62d8f0

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

docs/orderbook-visualizer.html

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -539,15 +539,15 @@
539539
.execution-stats {
540540
display: grid;
541541
grid-template-columns: repeat(4, 1fr);
542-
gap: 0.2rem;
543-
margin-bottom: 0.3rem;
542+
gap: 0.15rem;
543+
margin-bottom: 0.2rem;
544544
}
545545

546546
.stat-card {
547547
background: rgba(255, 255, 255, 0.7);
548548
border: 1px solid rgba(0, 0, 0, 0.1);
549549
border-radius: 6px;
550-
padding: 0.2rem;
550+
padding: 0.15rem;
551551
text-align: center;
552552
transition: all 0.3s ease;
553553
position: relative;
@@ -575,10 +575,10 @@
575575
}
576576

577577
.stat-value {
578-
font-size: 0.85rem;
578+
font-size: 0.75rem;
579579
font-weight: bold;
580580
color: var(--accent-blue);
581-
margin-bottom: 0.05rem;
581+
margin-bottom: 0.03rem;
582582
transition: all 0.3s ease;
583583
}
584584

@@ -593,43 +593,48 @@
593593
}
594594

595595
.stat-label {
596-
font-size: 0.6rem;
596+
font-size: 0.55rem;
597597
color: var(--ink-medium);
598598
text-transform: uppercase;
599599
letter-spacing: 0.5px;
600600
line-height: 1.1;
601601
}
602602

603603
.algorithm-steps {
604-
margin: 0.3rem 0;
605-
flex: 1;
604+
margin: 0.2rem 0;
605+
flex: 0 0 auto;
606606
min-height: 0;
607+
max-height: 80px;
608+
overflow: hidden;
609+
display: flex;
610+
flex-direction: column;
607611
}
608612

609613
.steps-container {
610614
background: rgba(255, 255, 255, 0.5);
611615
border: 1px solid rgba(0, 0, 0, 0.1);
612616
border-radius: 6px;
613-
padding: 0.3rem;
614-
min-height: 120px;
615-
max-height: 200px;
617+
padding: 0.15rem;
618+
min-height: 50px;
619+
max-height: 60px;
616620
overflow-y: auto;
617-
font-size: 0.7rem;
618-
line-height: 1.2;
621+
font-size: 0.58rem;
622+
line-height: 1.0;
623+
flex: 1;
619624
}
620625

621626
.execution-step {
622627
display: flex;
623628
align-items: center;
624-
padding: 0.15rem 0.2rem;
625-
margin: 0.05rem 0;
629+
padding: 0.08rem 0.1rem;
630+
margin: 0.01rem 0;
626631
background: rgba(255, 255, 255, 0.8);
627-
border-radius: 3px;
632+
border-radius: 2px;
628633
border-left: 2px solid var(--accent-blue);
629634
animation: stepAppear 0.5s ease-out;
630-
font-size: 0.65rem;
631-
line-height: 1.1;
632-
min-height: 18px;
635+
font-size: 0.55rem;
636+
line-height: 1.0;
637+
min-height: 14px;
633638
transition: all 0.3s ease;
634639
}
635640

@@ -696,17 +701,20 @@
696701
}
697702

698703
.step-time {
699-
font-size: 0.5rem;
704+
font-size: 0.45rem;
700705
color: var(--ink-light);
701-
margin-left: 0.2rem;
706+
margin-left: 0.15rem;
702707
flex-shrink: 0;
703708
white-space: nowrap;
704709
}
705710

706711
.skip-list-visualization {
707-
margin: 0.3rem 0;
708-
flex: 1;
712+
margin: 0.2rem 0;
713+
flex: 3;
709714
min-height: 0;
715+
overflow: hidden;
716+
display: flex;
717+
flex-direction: column;
710718
}
711719

712720
.skip-list-container {
@@ -988,7 +996,7 @@
988996

989997
/* Data Structure Specific Visualizations */
990998
.data-structure-viz {
991-
margin: 0.3rem 0;
999+
margin: 0.2rem 0;
9921000
flex: 1;
9931001
min-height: 0;
9941002
}
@@ -997,9 +1005,9 @@
9971005
background: rgba(255, 255, 255, 0.5);
9981006
border: 1px solid rgba(0, 0, 0, 0.1);
9991007
border-radius: 6px;
1000-
padding: 0.3rem;
1001-
min-height: 60px;
1002-
max-height: 120px;
1008+
padding: 0.4rem;
1009+
min-height: 100px;
1010+
max-height: 200px;
10031011
overflow: auto;
10041012
}
10051013

@@ -1632,7 +1640,14 @@ <h3>📈 Recent Trades
16321640
].sort((a, b) => a - b);
16331641

16341642
if (allPrices.length === 0) {
1643+
// If no prices, clear the data structure and show empty state
1644+
this.skipListNodes = [];
1645+
this.btreeNodes = [];
1646+
this.hashmapBuckets = [];
1647+
this.sortedArray = [];
1648+
this.rbTreeNodes = [];
16351649
this._generatingDataStructure = false;
1650+
this.updateDataStructureDisplay();
16361651
return;
16371652
}
16381653

@@ -1876,11 +1891,6 @@ <h3>📈 Recent Trades
18761891
this.generateDataStructureFromOrderbook();
18771892
}
18781893

1879-
generateSkipListFromOrderbook() {
1880-
// Use the new unified method
1881-
this.generateDataStructureFromOrderbook();
1882-
}
1883-
18841894
updateSkipListDisplay() {
18851895
// Use the new unified method
18861896
this.updateDataStructureDisplay();

0 commit comments

Comments
 (0)