From 7a603e1f96b74433987e78fba94dc33aeec60561 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Thu, 16 Apr 2026 11:12:17 -0700 Subject: [PATCH] Refine homepage freshness layout --- .../common/ActivityContextPanel.tsx | 77 ++++++------ frontend/src/components/home/HomePage.tsx | 111 +++++++++++------- 2 files changed, 108 insertions(+), 80 deletions(-) diff --git a/frontend/src/components/common/ActivityContextPanel.tsx b/frontend/src/components/common/ActivityContextPanel.tsx index 641fa43..09f6e92 100644 --- a/frontend/src/components/common/ActivityContextPanel.tsx +++ b/frontend/src/components/common/ActivityContextPanel.tsx @@ -49,9 +49,11 @@ function renderHeadline(context: ChainActivityContext): string { export default function ActivityContextPanel({ context, title = 'Chain Activity Context', + compact = false, }: { context: ChainActivityContext title?: string + compact?: boolean }) { const { mode } = useUiMode() const tone = resolveTone(context.state) @@ -62,7 +64,7 @@ export default function ActivityContextPanel({ return ( -
+
{renderHeadline(context)}
@@ -75,48 +77,49 @@ export default function ActivityContextPanel({
-
-
-
Latest Block
-
+ {compact ? ( +
+ Latest block{' '} + {context.latest_block_number != null ? `#${context.latest_block_number}` : 'Unknown'} -
-
- {formatRelativeAge(context.latest_block_timestamp)} -
-
-
-
Latest Transaction
-
+ {' '} + was {formatRelativeAge(context.latest_block_timestamp)}. Latest visible transaction was{' '} + {context.latest_transaction_block_number != null ? `#${context.latest_transaction_block_number}` : 'Unknown'} + {' '} + {formatRelativeAge(context.latest_transaction_timestamp)}.{' '} + {mode === 'guided' + ? 'Use the block gap and last non-empty block above to tell low activity apart from an indexing issue.' + : dualTimelineLabel} +
+ ) : ( +
+
+
Timeline Summary
+
+ Latest block{' '} + + {context.latest_block_number != null ? `#${context.latest_block_number}` : 'Unknown'} + {' '} + was {formatRelativeAge(context.latest_block_timestamp)}. Latest visible transaction was{' '} + + {context.latest_transaction_block_number != null ? `#${context.latest_transaction_block_number}` : 'Unknown'} + {' '} + {formatRelativeAge(context.latest_transaction_timestamp)}. +
-
- {formatRelativeAge(context.latest_transaction_timestamp)} +
+
Visibility Signal
+
+ {mode === 'guided' + ? 'Use the block gap and the last non-empty block above to tell low activity apart from an indexing issue.' + : dualTimelineLabel} +
-
-
Last Non-Empty Block
-
- {context.last_non_empty_block_number != null ? `#${context.last_non_empty_block_number}` : 'Unknown'} -
-
- {formatRelativeAge(context.last_non_empty_block_timestamp)} -
-
-
-
Block Gap
-
- {context.block_gap_to_latest_transaction != null ? context.block_gap_to_latest_transaction.toLocaleString() : 'Unknown'} -
-
- {mode === 'guided' - ? 'Difference between the current tip and the latest visible transaction block.' - : dualTimelineLabel} -
-
-
+ )} -
+
{context.latest_transaction_block_number != null ? ( Open latest transaction block → diff --git a/frontend/src/components/home/HomePage.tsx b/frontend/src/components/home/HomePage.tsx index 7af68f2..9622443 100644 --- a/frontend/src/components/home/HomePage.tsx +++ b/frontend/src/components/home/HomePage.tsx @@ -413,6 +413,37 @@ export default function Home({ note: compactStatNote(networkUtilizationSummary.note, networkUtilization != null ? 'Latest stats sample' : 'Unavailable', mode), }, ] + const activityMetricCards = [ + { + label: 'Latest Transaction', + value: activityContext.latest_transaction_block_number != null ? `#${activityContext.latest_transaction_block_number}` : 'Unknown', + note: latestTransactionAgeLabel, + detail: `Latest visible transaction freshness${txCompleteness ? ` · ${txCompleteness}` : ''}.`, + }, + { + label: 'Last Non-Empty Block', + value: activityContext.last_non_empty_block_number != null ? `#${activityContext.last_non_empty_block_number}` : 'Unknown', + note: formatRelativeAge(activityContext.last_non_empty_block_timestamp), + detail: + activityContext.latest_transaction_block_number != null && + activityContext.last_non_empty_block_number != null && + activityContext.latest_transaction_block_number === activityContext.last_non_empty_block_number + ? 'Matches the latest visible transaction block.' + : 'Most recent block with at least one indexed transaction.', + }, + { + label: 'Block Gap', + value: + activityContext.block_gap_to_latest_transaction != null + ? activityContext.block_gap_to_latest_transaction.toLocaleString() + : 'Unknown', + note: + activityContext.block_gap_to_latest_transaction != null + ? `${activityContext.block_gap_to_latest_transaction.toLocaleString()} blocks behind tip` + : 'Gap unavailable', + detail: 'Difference between the current tip and the latest visible transaction block.', + }, + ] useEffect(() => { setRelayPage(1) @@ -540,48 +571,27 @@ export default function Home({
{chainStatus ? ( -
-
-
Chain 138 Status
-
{chainStatus.status || 'unknown'}
-
{chainStatus.name || 'Defi Oracle Meta Mainnet'}
-
-
-
Head Age
-
- {chainStatus.head_age_sec != null ? `${Math.round(chainStatus.head_age_sec)}s` : 'Unknown'} -
-
Latest public RPC head freshness.
-
Chain visibility is currently {chainVisibilityState}.
-
-
-
RPC Latency
-
- {chainStatus.latency_ms != null ? `${Math.round(chainStatus.latency_ms)}ms` : 'Unknown'} -
-
Public Chain 138 RPC probe latency.
-
-
-
Latest Transaction
-
- {activityContext.latest_transaction_block_number != null ? `#${activityContext.latest_transaction_block_number}` : 'Unknown'} -
-
{latestTransactionAgeLabel}
-
- Latest visible transaction freshness{txCompleteness ? ` · ${txCompleteness}` : ''}. -
-
-
-
Last Non-Empty Block
-
- {activityContext.last_non_empty_block_number != null ? `#${activityContext.last_non_empty_block_number}` : 'Unknown'} -
-
- {activityContext.block_gap_to_latest_transaction != null - ? `${activityContext.block_gap_to_latest_transaction.toLocaleString()} blocks behind tip` - : 'Gap unavailable'} -
-
+
+
+
Chain 138 Status
+
{chainStatus.status || 'unknown'}
+
{chainStatus.name || 'Defi Oracle Meta Mainnet'}
+
+
+
Head Age
+
+ {chainStatus.head_age_sec != null ? `${Math.round(chainStatus.head_age_sec)}s` : 'Unknown'} +
+
Latest public RPC head freshness.
+
Chain visibility is currently {chainVisibilityState}.
+
+
+
RPC Latency
+
+ {chainStatus.latency_ms != null ? `${Math.round(chainStatus.latency_ms)}ms` : 'Unknown'} +
+
Public Chain 138 RPC probe latency.
+
) : null} @@ -683,6 +693,17 @@ export default function Home({ ))}
+
+ {activityMetricCards.map((card) => ( + +
{card.label}
+
{card.value}
+
{card.note}
+
{card.detail}
+
+ ))} +
+ {mode === 'guided' ? (
{secondaryMetricCards.map((card) => ( @@ -718,7 +739,11 @@ export default function Home({ )}
- +