Skip to content

Commit 313451b

Browse files
chore: expand leader schedule width
1 parent 3780a18 commit 313451b

File tree

9 files changed

+43
-30
lines changed

9 files changed

+43
-30
lines changed

src/features/LeaderSchedule/Slots/CardValidatorSummary.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import type { TextProps } from "@radix-ui/themes";
22
import { Box, Flex, Text } from "@radix-ui/themes";
33
import { DateTime } from "luxon";
44
import { useMemo } from "react";
5-
import { getStake, getFmtStake, isDefined, removePortFromIp } from "../../../utils";
5+
import {
6+
getStake,
7+
getFmtStake,
8+
isDefined,
9+
removePortFromIp,
10+
} from "../../../utils";
611
import { useAtomValue } from "jotai";
712
import PeerIcon from "../../../components/PeerIcon";
813
import styles from "./cardValidatorSummary.module.css";
@@ -27,12 +32,13 @@ export default function CardValidatorSummary({
2732
const { pubkey, peer, isLeader, name } = useSlotInfo(slot);
2833

2934
return (
30-
<Flex gap="1">
35+
<Flex gap="1" className={styles.summaryContainer}>
3136
<PeerIcon url={peer?.info?.icon_url} size={40} isYou={isLeader} />
3237
<Flex
3338
direction="column"
3439
gap="1"
3540
align="start"
41+
minWidth="0"
3642
style={{ marginLeft: "6px" }}
3743
>
3844
<Text className={styles.name}>{name}</Text>

src/features/LeaderSchedule/Slots/SlotCardGrid.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useMedia, usePrevious, useUnmount } from "react-use";
1111
import {
1212
defaultMaxComputeUnits,
1313
lamportsPerSol,
14+
nonBreakingSpace,
1415
solDecimals,
1516
} from "../../../consts";
1617
import { formatNumberLamports } from "../../Overview/ValidatorsCard/formatAmt";
@@ -48,7 +49,7 @@ export default function SlotCardGrid({ slot, currentSlot }: SlotCardGridProps) {
4849
}, [deleteScroll, setScroll, slot]);
4950

5051
return (
51-
<Flex minWidth="0">
52+
<Flex minWidth="0" flexGrow="1">
5253
<SlotColumn slot={slot} currentSlot={currentSlot} />
5354
<div
5455
className={styles.grid}
@@ -90,7 +91,6 @@ export default function SlotCardGrid({ slot, currentSlot }: SlotCardGridProps) {
9091
<Text
9192
className={clsx(styles.headerText, styles.computeUnitsHeader)}
9293
align="right"
93-
style={{ gridColumnStart: "span 2" }}
9494
>
9595
Compute&nbsp;Units
9696
</Text>
@@ -363,22 +363,18 @@ function SlotCardRow({ slot, active }: SlotCardRowProps) {
363363
{getText(values?.durationText)}
364364
</Text>
365365
{values?.computeUnits !== undefined ? (
366-
<>
367-
<Text className={valueClassName} align="right" style={{ padding: 0 }}>
366+
<Text className={valueClassName} align="right" style={{ padding: 0 }}>
367+
<>
368368
{getText(values?.computeUnits.toLocaleString())}
369-
</Text>
370-
<Text className={valueClassName} align="right" style={{ padding: 0 }}>
371-
{values?.computeUnitsPct !== undefined
372-
? `\u00A0(${getText(values?.computeUnitsPct)}%)`
373-
: null}
374-
</Text>
375-
</>
369+
<span className={styles.computeUnitsPct}>
370+
{values?.computeUnitsPct !== undefined
371+
? `${nonBreakingSpace}(${getText(values?.computeUnitsPct)}%)`
372+
: null}
373+
</span>
374+
</>
375+
</Text>
376376
) : (
377-
<Text
378-
className={valueClassName}
379-
style={{ gridColumnStart: "span 2" }}
380-
align="right"
381-
>
377+
<Text className={valueClassName} align="right">
382378
{getText()}
383379
</Text>
384380
)}

src/features/LeaderSchedule/Slots/UpcomingSlotCard.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function UpcomingSlotCard({ slot }: UpcomingSlotCardProps) {
3131
currentLeaderSlot !== undefined &&
3232
slot === currentLeaderSlot + slotsPerLeader * 2;
3333

34-
const isWideScreen = useMedia("(min-width: 1200px)");
34+
const isWideScreen = useMedia("(min-width: 1250px)");
3535

3636
return (
3737
<div
@@ -78,13 +78,13 @@ function UpcomingSlotBody({
7878
slot,
7979
}: UpcomingSlotBodyProps) {
8080
return (
81-
<Flex gap="2">
82-
<Flex gap="2" minWidth="300px" align="center">
81+
<Flex gap="2" align="center">
82+
<Flex gap="2" minWidth="300px" width="505px" align="center" pr="20px">
8383
<PeerIcon url={iconUrl} size={24} isYou={isLeader} />
8484
<Text className={styles.nameText}>{name}</Text>
8585
</Flex>
8686
<Text className={styles.pubkeyText}>{pubkey}</Text>
87-
<Flex flexGrow="1" justify="center">
87+
<Flex justify="center" minWidth="190px">
8888
<Text>{slot}</Text>
8989
</Flex>
9090
<TimeTillText slot={slot} />

src/features/LeaderSchedule/Slots/cardValidatorSummary.module.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
padding: 2px 5px;
66
}
77

8+
.summary-container {
9+
width: 40%;
10+
min-width: 430px;
11+
}
12+
813
.name {
914
color: var(--primary-text-color);
1015
font-size: 24px;
1116
line-height: normal;
12-
width: 365px;
1317
min-width: 30px;
18+
width: 100%;
1419
overflow: hidden;
1520
white-space: nowrap;
1621
text-overflow: ellipsis;

src/features/LeaderSchedule/Slots/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default function Slots() {
8888
overflow="hidden"
8989
flexShrink="1"
9090
onWheel={handleWheel}
91-
maxWidth="1200px"
91+
maxWidth="100%"
9292
className={styles.scroll}
9393
ref={ref}
9494
>

src/features/LeaderSchedule/Slots/slotCardGrid.module.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
grid:
44
auto-flow / minMax(80px, auto) minMax(80px, auto) minMax(70px, auto)
55
minMax(70px, auto)
6-
minMax(75px, auto) minMax(100px, auto) minMax(49px, auto);
6+
minMax(75px, auto) minMax(149px, auto);
77
row-gap: 1px;
88
overflow-x: auto;
99
min-width: 80px;
@@ -43,6 +43,11 @@
4343
color: var(--compute-units-color);
4444
}
4545

46+
.compute-units-pct {
47+
width: 50px;
48+
display: inline-block;
49+
}
50+
4651
.slot-text {
4752
/* Slight padding to make it easier to text select the slot # */
4853
padding-left: 10px;

src/features/LeaderSchedule/Slots/upcomingSlot.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
color: var(--primary-text-color);
77

88
.name-text {
9-
width: 240px;
109
overflow: hidden;
1110
white-space: nowrap;
1211
text-overflow: ellipsis;
1312
}
1413

1514
.pubkey-text {
15+
flex-grow: 1;
1616
min-width: 390px;
1717
overflow: hidden;
1818
white-space: nowrap;
1919
text-overflow: ellipsis;
2020

2121
&.narrow-screen {
22+
flex-grow: 0;
2223
min-width: inherit;
2324
}
2425
}

src/routes/__root.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { isNavCollapsedAtom } from "../atoms";
1010
import { useAtom } from "jotai";
1111
import { headerSpacing, narrowNavMedia, slotsNavSpacing } from "../consts";
1212
import NavBlur from "../features/Navigation/NavBlur";
13+
import { useCurrentRoute } from "../hooks/useCurrentRoute";
1314

1415
// import { TanStackRouterDevtools } from '@tanstack/router-devtools'
1516

@@ -60,6 +61,7 @@ function Root() {
6061
function OutletContainer() {
6162
const isNarrow = useMedia(narrowNavMedia);
6263
const [isNavCollapsed, setIsNavCollapsed] = useAtom(isNavCollapsedAtom);
64+
const isSchedule = useCurrentRoute() === "Schedule";
6365

6466
useEffect(() => {
6567
// automatically open / close on narrow switch
@@ -73,7 +75,7 @@ function OutletContainer() {
7375
minWidth="0"
7476
pb="2"
7577
pl={
76-
isNarrow || isNavCollapsed
78+
isNarrow || isNavCollapsed || isSchedule
7779
? "0px"
7880
: `${headerSpacing - slotsNavSpacing}px`
7981
}

src/utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ export function getDurationText(
8181
const values = getDurationValues(duration, options);
8282
if (!values) return "Never";
8383

84-
return values.reduce((acc, valSuffix) => {
85-
return `${acc} ${valSuffix.join("")}`;
86-
}, "");
84+
return values.map(([val, suffix]) => `${val}${suffix}`).join(" ");
8785
}
8886

8987
export let slowDateTimeNow = DateTime.now();

0 commit comments

Comments
 (0)