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
1 change: 1 addition & 0 deletions benchmarks/aggregator-head-lag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ source: https://github.com/ChainBench/OpenChainBench/tree/main/harnesses/aggrega
chart:
default_panel_by_chain:
solana: first_share
hide_headline_by_chain: [solana]

metric_panels:
- id: first_share
Expand Down
6 changes: 6 additions & 0 deletions src/components/benchmark-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ export function BenchmarkBody({
// while Base keeps the head lag headline. A ?view= in the URL wins on
// first paint; after that the chain tab drives it like a fresh visit.
const defaultPanelByChain = Object.values(variants)[0]?.chart?.defaultPanelByChain;
const hideHeadline = Boolean(
effectiveChain &&
Object.values(variants)[0]?.chart?.hideHeadlineByChain?.includes(effectiveChain),
);
const urlViewPinned = useRef(Boolean(urlView));
useEffect(() => {
if (!defaultPanelByChain) return;
Expand Down Expand Up @@ -866,6 +870,7 @@ export function BenchmarkBody({
mainDescription={benchmark.panelMainDescription}
activeId={activePanelId}
onSelect={setActivePanelId}
hideMain={hideHeadline}
/>
) : null;
})()}
Expand Down Expand Up @@ -914,6 +919,7 @@ export function BenchmarkBody({
mainDescription={benchmark.panelMainDescription}
activeId={activePanelId}
onSelect={setActivePanelId}
hideMain={hideHeadline}
/>
) : null;
})()}
Expand Down
17 changes: 11 additions & 6 deletions src/components/metric-view-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ export function MetricViewTabs({
mainDescription,
activeId,
onSelect,
hideMain = false,
}: {
panels: MetricPanel[];
mainLabel: string;
mainDescription?: string;
activeId: string | null;
onSelect: (id: string | null) => void;
/** Drop the headline tab (spec chart.hide_headline_by_chain). */
hideMain?: boolean;
}) {
const active = activeId == null ? null : panels.find((p) => p.id === activeId);
const activeDescription =
Expand All @@ -40,12 +43,14 @@ export function MetricViewTabs({
<span className="mr-2 text-[10px] uppercase tracking-[0.16em] text-ink-faint">
View
</span>
<Tab
label={mainLabel}
description={mainDescription}
active={activeId == null}
onClick={() => onSelect(null)}
/>
{!hideMain && (
<Tab
label={mainLabel}
description={mainDescription}
active={activeId == null}
onClick={() => onSelect(null)}
/>
)}
{panels.map((p) => (
<Tab
key={p.id}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/materialize/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function chartFromSpec(spec: {
default_range?: "24h" | "7d" | "30d" | "90d" | "1y";
window_label?: string;
default_panel_by_chain?: Record<string, string>;
hide_headline_by_chain?: string[];
};
}): Benchmark["chart"] {
if (!spec.chart) return undefined;
Expand All @@ -46,6 +47,7 @@ export function chartFromSpec(spec: {
defaultRange: spec.chart.default_range,
windowLabel: spec.chart.window_label,
defaultPanelByChain: spec.chart.default_panel_by_chain,
hideHeadlineByChain: spec.chart.hide_headline_by_chain,
};
}

Expand Down
7 changes: 7 additions & 0 deletions src/lib/spec-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ export const SpecSchema = z
z.string().regex(/^[a-z][a-z0-9_]*$/),
)
.optional(),
/** Chains whose headline view is removed from the view switcher
* (the chain must have a default_panel_by_chain entry). Solana on
* aggregator-head-lag: the headline is a relative lag whose leader
* reads 1 ms by construction, so only the panels are offered. */
hide_headline_by_chain: z
.array(z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/))
.optional(),
})
.strict()
.optional(),
Expand Down
2 changes: 2 additions & 0 deletions src/types/benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ export type Benchmark = {
windowLabel?: string;
/** Chain dimension value -> metric panel id to open on. */
defaultPanelByChain?: Record<string, string>;
/** Chains whose headline view tab is not offered. */
hideHeadlineByChain?: string[];
};
/** When true the bench page renders a stacked bar chart (absolute + %
* share over time) below the main chart. Set via `stacked_share: true`
Expand Down
Loading