Skip to content

Commit 280b861

Browse files
chore: address comments
1 parent 54ce353 commit 280b861

File tree

4 files changed

+137
-176
lines changed

4 files changed

+137
-176
lines changed

src/features/Overview/ShredsProgression/ShredsChart.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { xRangeMs } from "./const";
88
import { useMedia, useRafLoop } from "react-use";
99
import {
1010
shredsProgressionPlugin,
11-
type LabelPositions,
11+
shredsXScaleKey,
1212
} from "./shredsProgressionPlugin";
1313
import { Box, Flex } from "@radix-ui/themes";
1414
import ShredsSlotLabels from "./ShredsSlotLabels";
@@ -69,7 +69,6 @@ export default function ShredsChart({
6969

7070
const uplotRef = useRef<uPlot>();
7171
const lastRedrawRef = useRef(0);
72-
const labelPositionsRef = useRef<LabelPositions>();
7372

7473
const handleCreate = useCallback((u: uPlot) => {
7574
uplotRef.current = u;
@@ -94,24 +93,25 @@ export default function ShredsChart({
9493
width: 0,
9594
height: 0,
9695
scales: {
97-
x: { time: false },
96+
[shredsXScaleKey]: { time: false },
9897
y: {
9998
time: false,
10099
range: [0, 1],
101100
},
102101
},
103-
series: [{}, {}],
102+
series: [{ scale: shredsXScaleKey }, {}],
104103
cursor: {
105104
show: false,
106105
drag: {
107106
// disable zoom
108-
x: false,
107+
[shredsXScaleKey]: false,
109108
y: false,
110109
},
111110
},
112111
legend: { show: false },
113112
axes: [
114113
{
114+
scale: shredsXScaleKey,
115115
incrs: xIncrs,
116116
size: 30,
117117
ticks: {
@@ -141,7 +141,7 @@ export default function ShredsChart({
141141
},
142142
},
143143
],
144-
plugins: [shredsProgressionPlugin(isOnStartupScreen, labelPositionsRef)],
144+
plugins: [shredsProgressionPlugin(isOnStartupScreen)],
145145
};
146146
}, [isOnStartupScreen, xIncrs]);
147147

src/features/Overview/ShredsProgression/ShredsSlotLabels.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import PeerIcon from "../../../components/PeerIcon";
1111
import { skippedClusterSlotsAtom } from "../../../atoms";
1212
import { isStartupProgressVisibleAtom } from "../../StartupProgress/atoms";
1313

14-
const height = 30;
15-
1614
/**
1715
* Labels for shreds slots.
1816
* Don't render during startup, because there will be multiple overlapping slots
@@ -26,10 +24,10 @@ export default function ShredsSlotLabels() {
2624

2725
return (
2826
<Flex
29-
overflow="hidden"
27+
overflowX="hidden"
3028
position="relative"
3129
// extra space for borders
32-
height={`${height + 2}px`}
30+
height="30px"
3331
style={{ opacity: 0.8 }}
3432
>
3533
{groupLeaderSlots.map((slot) => (
@@ -61,31 +59,28 @@ function SlotGroupLabel({ firstSlot }: SlotGroupLabelProps) {
6159

6260
return (
6361
<Flex
64-
height={`${height}px`}
62+
height="100%"
6563
direction="column"
6664
gap="2px"
6765
position="absolute"
68-
align="center"
69-
overflow="hidden"
7066
id={getSlotGroupLabelId(firstSlot)}
7167
className={clsx(styles.slotGroupLabel, {
7268
[styles.you]: isLeader,
7369
})}
7470
>
7571
<Flex
76-
align="center"
72+
justify="center"
7773
flexGrow="1"
74+
minWidth="0"
7875
px="2px"
7976
className={clsx(styles.slotGroupTopContainer, {
8077
[styles.skipped]: skippedSlots.size > 0,
8178
})}
8279
>
8380
<Flex
84-
justify="center"
8581
align="center"
86-
width="100%"
8782
gap="4px"
88-
wrap="nowrap"
83+
minWidth="0"
8984
className={styles.slotGroupNameContainer}
9085
>
9186
<PeerIcon
@@ -99,10 +94,8 @@ function SlotGroupLabel({ firstSlot }: SlotGroupLabelProps) {
9994
</Flex>
10095

10196
<Flex
102-
width="100%"
10397
height="3px"
10498
position="relative"
105-
overflow="hidden"
10699
className={styles.slotBarsContainer}
107100
>
108101
{slots.map((slot) => (

src/features/Overview/ShredsProgression/atoms.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ type ShredEventTsDeltaMs = number | undefined;
1313
*/
1414
export type ShredEventTsDeltas = ShredEventTsDeltaMs[];
1515

16-
type Slot = {
16+
export type Slot = {
1717
shreds: (ShredEventTsDeltas | undefined)[];
18+
/**
19+
* earliest event (start) of the slot
20+
*/
1821
minEventTsDelta?: number;
1922
maxEventTsDelta?: number;
2023
completionTsDelta?: number;

0 commit comments

Comments
 (0)