Skip to content

Commit 9793feb

Browse files
fix: address feedback
1 parent f42bfc0 commit 9793feb

File tree

9 files changed

+41
-13
lines changed

9 files changed

+41
-13
lines changed

src/features/SlotDetails/DetailedSlotStats/ComputeSection/BusyAccounts.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ export default function BusyAccounts() {
1616
return (
1717
<SlotDetailsSubSection title="Top 5 Busy Accounts">
1818
<Grid
19-
columns="repeat(5, auto) minmax(80px, 200px)"
19+
columns="repeat(5, auto) minmax(80px, 100%)"
2020
gapX={gridGapX}
2121
gapY={gridGapY}
2222
>
2323
{limits.used_account_write_costs.map(({ account, cost }) => (
2424
<PctBarRow
2525
key={account}
26-
label={`${account.substring(0, 8)}...`}
26+
label={account}
27+
labelWidth="80px"
2728
value={cost}
2829
total={limits.max_account_write_cost}
2930
valueColor="#30A46C"

src/features/SlotDetails/DetailedSlotStats/ComputeSection/ComputeUnitStats.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,34 @@ export default function ComputeUnitStats() {
5050
if (!stats) return;
5151

5252
const totalCus = stats.vote + stats.bundle + stats.other;
53+
const maxCus = Math.max(stats.vote, stats.bundle, stats.other);
5354

5455
return (
5556
<SlotDetailsSubSection title="Consumed Compute Units">
5657
<Grid
57-
columns="repeat(5, auto) minmax(80px, auto)"
58+
columns="repeat(5, auto) minmax(80px, 100%)"
5859
gapX={gridGapX}
5960
gapY={gridGapY}
6061
>
6162
<CuStatRow
6263
label="Vote"
6364
cus={stats.vote}
6465
totalCus={totalCus}
66+
maxCus={maxCus}
6567
pctColor={votesColor}
6668
/>
6769
<CuStatRow
6870
label="Bundle"
6971
cus={stats.bundle}
7072
totalCus={totalCus}
73+
maxCus={maxCus}
7174
pctColor={bundleColor}
7275
/>
7376
<CuStatRow
7477
label="Other"
7578
cus={stats.other}
7679
totalCus={totalCus}
80+
maxCus={maxCus}
7781
pctColor={nonVoteColor}
7882
/>
7983
</Grid>
@@ -85,11 +89,13 @@ interface CuStatRowProps {
8589
label: string;
8690
cus: number;
8791
totalCus: number;
92+
maxCus: number;
8893
pctColor: string;
8994
}
9095

91-
function CuStatRow({ label, cus, totalCus, pctColor }: CuStatRowProps) {
96+
function CuStatRow({ label, cus, totalCus, maxCus, pctColor }: CuStatRowProps) {
9297
const cuPctFromTotal = Math.round(totalCus ? (cus / totalCus) * 100 : 0);
98+
const cuPctFromMax = Math.round(maxCus ? (cus / maxCus) * 100 : 0);
9399

94100
return (
95101
<>
@@ -117,7 +123,7 @@ function CuStatRow({ label, cus, totalCus, pctColor }: CuStatRowProps) {
117123
>
118124
<rect
119125
height="8"
120-
width={`${cuPctFromTotal}%`}
126+
width={`${cuPctFromMax}%`}
121127
opacity={0.6}
122128
fill={pctColor}
123129
/>

src/features/SlotDetails/DetailedSlotStats/ComputeSection/ProtocolLimitStats.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function ProtocolLimitStats() {
1717
return (
1818
<SlotDetailsSubSection title="Protocol Limit Utilization">
1919
<Grid
20-
columns="repeat(5, auto) minmax(80px, 250px)"
20+
columns="repeat(5, auto) minmax(80px, 100%)"
2121
gapX={gridGapX}
2222
gapY={gridGapY}
2323
>

src/features/SlotDetails/DetailedSlotStats/ComputeSection/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import ExecutionTime from "./ExecutionTime";
77

88
export default function ComputeSection() {
99
return (
10-
<SlotDetailsSection title="Compute" flexBasis="0" flexGrow="2">
10+
<SlotDetailsSection title="Compute" flexGrow="2">
1111
<ProtocolLimitStats />
12-
<BusyAccounts />
1312
<ComputeUnitStats />
13+
<BusyAccounts />
1414
<CumulativeExecutionTimeStats />
1515
<ExecutionTime />
1616
</SlotDetailsSection>

src/features/SlotDetails/DetailedSlotStats/FeeSection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import IncomeScatterCharts from "./IncomeScatterCharts";
55

66
export default function FeeSection() {
77
return (
8-
<SlotDetailsSection title="Fees" flexBasis="0" flexGrow="2">
8+
<SlotDetailsSection title="Fees" flexGrow="2">
99
<FeeBreakdownStats />
1010
<IncomeDistributionCharts />
1111
<IncomeScatterCharts />

src/features/SlotDetails/DetailedSlotStats/PctBarRow.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { Text } from "@radix-ui/themes";
1+
import { Text, Tooltip } from "@radix-ui/themes";
22
import PctBar from "./PctBar";
33
import styles from "./detailedSlotStats.module.css";
4+
import clsx from "clsx";
5+
import { useMemo } from "react";
46

57
interface PctBarRowProps {
68
label: string;
79
value: number;
810
total: number;
911
valueColor: string;
12+
labelWidth?: string;
1013
numeratorColor?: boolean;
1114
pctColor?: boolean;
1215
}
@@ -16,14 +19,26 @@ export default function PctBarRow({
1619
value,
1720
total,
1821
valueColor,
22+
labelWidth,
1923
numeratorColor = true,
2024
pctColor = false,
2125
}: PctBarRowProps) {
2226
const pct = Math.round(total ? (value / total) * 100 : 0);
27+
const labelEl = useMemo(
28+
() => (
29+
<Text
30+
className={clsx(styles.label, labelWidth && styles.ellipsis)}
31+
style={{ width: labelWidth }}
32+
>
33+
{label}
34+
</Text>
35+
),
36+
[label, labelWidth],
37+
);
2338

2439
return (
2540
<>
26-
<Text className={styles.label}>{label}</Text>
41+
{labelWidth ? <Tooltip content={label}>{labelEl}</Tooltip> : labelEl}
2742
<Text
2843
className={styles.value}
2944
style={{ color: numeratorColor ? valueColor : undefined }}

src/features/SlotDetails/DetailedSlotStats/PerformanceSection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function PerformanceSection() {
1313
const isNarrowScreen = useMedia("(max-width: 500px)");
1414

1515
return (
16-
<SlotDetailsSection title="Performance" flexBasis="0" flexGrow="3">
16+
<SlotDetailsSection title="Performance" flexGrow="3">
1717
<Flex
1818
direction={isNarrowScreen ? "column" : "row"}
1919
gapX={sectionGapX}

src/features/SlotDetails/DetailedSlotStats/SlotDetailsHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function SlotDetailsHeader() {
3939
if (slot === undefined) return;
4040

4141
return (
42-
<Flex gapX="4" gapY="2" wrap="wrap" justify="between" align="center">
42+
<Flex gapX="4" gapY="2" wrap="wrap" justify="start" align="center">
4343
<Flex gap="5px" align="center">
4444
<PeerIcon url={peer?.info?.icon_url} size={16} isYou={isLeader} />
4545
<Text className={styles.name}>{name}</Text>

src/features/SlotDetails/DetailedSlotStats/detailedSlotStats.module.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@
5757
font-size: 8px;
5858
color: var(--gray-11);
5959
}
60+
61+
.ellipsis {
62+
white-space: nowrap;
63+
overflow: hidden;
64+
text-overflow: ellipsis;
65+
}

0 commit comments

Comments
 (0)