Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions apps/scan/app/[locale]/HomeContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { LiveTicker } from "@/components/home/LiveTicker";
import { TxChart14d } from "@/components/home/TxChart14d";
import { FreshnessChip } from "@/components/common/FreshnessChip";
import { useNetwork, useNetworkFromQuery } from "@/lib/network-context";
import { useStats, useBlocks, useTransactions, useChainPerformance, useMempool, useCurrentEpoch, useChainStatus } from "@/lib/hooks";
import { useStats, useBlocks, useTransactions, useChainPerformance, useMempool, useCurrentEpoch } from "@/lib/hooks";
import { useLatestBlock, useLatestFinalized } from "@/lib/ws";
import { formatNumber, formatSRX, toMillis } from "@/lib/format";
import { validateAndResolveSearch } from "@/lib/search-validate";
Expand Down Expand Up @@ -122,7 +122,6 @@ export function HomeContent({ initial }: { initial: HomeBundle }) {
const { data: performance, loading: perfLoading } = useChainPerformance(network, perfRange, initial.performance);
const { data: mempool } = useMempool(network, initial.mempool);
const { data: epoch } = useCurrentEpoch(network, initial.epoch);
const { data: chainStatus } = useChainStatus(network, initial.status);

const latestPerf = performance?.points?.[performance.points.length - 1];
// Show the actual recent block cadence from the latest blocks. The
Expand Down Expand Up @@ -262,7 +261,7 @@ export function HomeContent({ initial }: { initial: HomeBundle }) {

return (
<>
<LiveTicker stats={stats} blockTime={blockTime} network={network} epoch={epoch} status={chainStatus} />
<LiveTicker stats={stats} blockTime={blockTime} network={network} epoch={epoch} />
{(isChainIdle || chainUnreachable) && (
<div role="alert" className="border-y-2 border-[var(--orange)]/60 bg-[color-mix(in_oklab,var(--orange)_16%,transparent)]">
<div className="max-w-7xl mx-auto px-5 sm:px-6 lg:px-8 py-3 flex items-center gap-3 text-[13px]">
Expand Down
15 changes: 2 additions & 13 deletions apps/scan/components/home/LiveTicker.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
"use client";

import type { ChainInfo, EpochInfo, ChainStatus } from "@/lib/api";
import type { ChainInfo, EpochInfo } from "@/lib/api";
import { formatSRX } from "@/lib/format";

interface LiveTickerProps {
stats: ChainInfo | null;
blockTime: string;
network: "mainnet" | "testnet";
epoch?: EpochInfo | null;
status?: ChainStatus | null;
}

function formatUptime(seconds: number): string {
if (seconds < 60) return `${Math.floor(seconds)}s`;
const m = seconds / 60;
if (m < 60) return `${Math.floor(m)}m`;
const h = m / 60;
if (h < 24) return `${h.toFixed(1)}h`;
return `${(h / 24).toFixed(1)}d`;
}

// DECISION: Etherscan/Solscan keep a thin "live" strip above the hero showing the numbers
// that matter most — block height, tx pulse, gas/block time. One horizontal scroll-safe
// rail of mono key/value pairs. Draws the eye before the big serif title.
export function LiveTicker({ stats, blockTime, network, epoch, status }: LiveTickerProps) {
export function LiveTicker({ stats, blockTime, network, epoch }: LiveTickerProps) {
const epochProgress = epoch && epoch.end_height > epoch.start_height && stats
? Math.min(100, Math.max(0, ((stats.height - epoch.start_height) / (epoch.end_height - epoch.start_height)) * 100))
: null;
Expand All @@ -38,7 +28,6 @@ export function LiveTicker({ stats, blockTime, network, epoch, status }: LiveTic
{ label: "Circulating", value: stats ? formatSRX(stats.total_minted_srx) : "—" },
{ label: "Tokens", value: stats ? String(stats.deployed_tokens) : "—" },
{ label: "Reward", value: stats ? `${stats.next_block_reward_srx} SRX` : "—" },
{ label: "Node uptime", value: status ? formatUptime(status.uptime_seconds) : "—" },
];

// Single static rail. Used to be a marquee with two duplicated copies for
Expand Down
Loading