Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
671d3c7
feat(gateways): add gateway stats widgets and new gateway pages
rickstaa Nov 22, 2025
8d4699a
feat: add paid tickets to gateway history
rickstaa Nov 22, 2025
cbf8c87
fix: hide delegating tab when account is not delegator
rickstaa Nov 22, 2025
50655d3
fix: correct gateway nav highlight when logged out
rickstaa Nov 22, 2025
7f877ef
Merge branch 'main' into feat/add-gateway-dashboard
rickstaa Dec 28, 2025
3adb176
fix: fix merge conflict
rickstaa Dec 28, 2025
35c94c3
Merge branch 'main' into feat/add-gateway-dashboard
rickstaa Dec 28, 2025
b74acd7
chore: remove duplicate env variable from template
rickstaa Dec 28, 2025
cc3cffe
refactor: apply code improvements
rickstaa Dec 28, 2025
d0edde7
refactor: ensure correct tab highlight behavoir
rickstaa Dec 28, 2025
f622b78
refactor: improve gateway inclusion criteria and UI
rickstaa Dec 28, 2025
c5da583
refactor: improve profile tab order
rickstaa Dec 28, 2025
f1faa97
feat: add warning for self-redeeming gateways
rickstaa Dec 29, 2025
478ba3f
refactor: improve account tabs mobile layout
rickstaa Dec 29, 2025
a15d1be
feat: add HorizontalScrollContainer component
rickstaa Dec 29, 2025
be56b20
refactor: add scrollBuffer constant
rickstaa Dec 30, 2025
6ae32ab
refactor: add accessibility labels to horizontalScrollContainer
rickstaa Dec 30, 2025
2bf8b2c
refactor: improve horizontalScrollContainer scroll behaviour
rickstaa Dec 30, 2025
4db10d5
refactor: stabilize horizontalScrollContainer fade behavior
rickstaa Dec 30, 2025
5f1c432
Merge branch 'main' into feat/add-gateway-dashboard
rickstaa Jan 7, 2026
bbc039e
refactor: small formatting fix introduce during merge
rickstaa Jan 7, 2026
d59f8ec
Merge branch 'main' into feat/add-gateway-dashboard
rickstaa Jan 8, 2026
76c9886
fix: ensure gateway filtering is correct
rickstaa Jan 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
394 changes: 390 additions & 4 deletions apollo/subgraph.ts

Large diffs are not rendered by default.

131 changes: 131 additions & 0 deletions components/BroadcastingView/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import { ExplorerTooltip } from "@components/ExplorerTooltip";
import Stat from "@components/Stat";
import dayjs from "@lib/dayjs";
import { Box, Grid } from "@livepeer/design-system";
import { ExclamationTriangleIcon } from "@radix-ui/react-icons";
import { GatewaysQuery } from "apollo";
import { useGatewaySelfRedeemStatus } from "hooks";
import numbro from "numbro";
import { useMemo } from "react";

// TODO: replace with common formatting util.
const formatEth = (value?: string | number | null) => {
const amount = Number(value ?? 0) || 0;
return `${numbro(amount).format(
amount > 0 && amount < 0.01
? { mantissa: 4, trimMantissa: true }
: { mantissa: 2, average: true, lowPrecision: false }
)} ETH`;
};

const SelfRedeemIndicator = () => (
<ExplorerTooltip
multiline
content={
<Box>Self-redeemed winning tickets detected in the last 90 days.</Box>
}
>
<Box as={ExclamationTriangleIcon} css={{ color: "$amber11" }} />
</ExplorerTooltip>
);

const BroadcastingView = ({
gateway,
}: {
gateway?: GatewaysQuery["gateways"] extends Array<infer G> ? G | null : null;
}) => {
const isSelfRedeeming = useGatewaySelfRedeemStatus(gateway?.id);

const activeSince = useMemo(
() =>
gateway?.firstActiveDay
? dayjs.unix(gateway.firstActiveDay).format("MMM D, YYYY")
: "Pending graph update",
[gateway]
);
const statusText = useMemo(() => {
const active = Number(gateway?.ninetyDayVolumeETH ?? 0) > 0;
return active ? "Active" : "Inactive";
}, [gateway]);
const statItems = useMemo(
() => [
{
id: "total-fees-distributed",
label: "Total fees distributed",
value: (
<Box
css={{ display: "inline-flex", alignItems: "center", gap: "$3" }}
>
<Box>{formatEth(gateway?.totalVolumeETH)}</Box>
{isSelfRedeeming && <SelfRedeemIndicator />}
</Box>
),
tooltip: "Lifetime fees this gateway has distributed on-chain.",
},
{
id: "status",
label: "Status",
value: statusText,
tooltip: "Active if this gateway distributed fees in the last 90 days.",
},
{
id: "ninety-day-fees",
label: "90d fees distributed",
value: formatEth(gateway?.ninetyDayVolumeETH),
tooltip:
"Total fees distributed to orchestrators over the last 90 days.",
},
{
id: "activation-date",
label: "Activation date",
value: activeSince,
tooltip: "First day this gateway funded deposit/reserve on-chain.",
},
{
id: "deposit-balance",
label: "Deposit balance",
value: formatEth(gateway?.deposit),
tooltip: "Current deposit balance funded for gateway job payouts.",
},
{
id: "reserve-balance",
label: "Reserve balance",
value: formatEth(gateway?.reserve),
tooltip: "Reserve funds available for winning ticket payouts.",
},
],
[gateway, activeSince, statusText, isSelfRedeeming]
);

return (
<Box
css={{
paddingTop: "$4",
}}
>
<Grid
css={{
display: "grid",
gridTemplateColumns: "1fr",
gap: "$3",
alignItems: "stretch",
"@media (min-width: 820px)": {
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
},
}}
>
{statItems.map((stat) => (
<Stat
key={stat.id}
label={stat.label}
value={stat.value}
tooltip={stat.tooltip}
css={{ height: "100%" }}
/>
))}
</Grid>
</Box>
);
};

export default BroadcastingView;
Loading