diff --git a/src/components/compare-bench-card.tsx b/src/components/compare-bench-card.tsx index fd3c9db8..cdc0154f 100644 --- a/src/components/compare-bench-card.tsx +++ b/src/components/compare-bench-card.tsx @@ -1,6 +1,6 @@ "use client"; -import { Fragment, useState } from "react"; +import { Fragment } from "react"; import Link from "next/link"; import type { Benchmark } from "@/types/benchmark"; import { fmtUnit, fmtValue, unitSuffix } from "@/lib/format"; @@ -70,19 +70,7 @@ export function CompareBenchCard({ aName: string; bName: string; }) { - const [activePanelId, setActivePanelId] = useState(null); - - const activePanel = bench.panelScopes.find((p) => p.id === activePanelId) ?? null; - - const effectiveUnit = activePanel?.unit ?? bench.unit; - const effectiveHigherIsBetter = activePanel?.higherIsBetter ?? bench.higherIsBetter; - const effectiveAVal = activePanel?.aValue ?? bench.aResult.p50; - const effectiveBVal = activePanel?.bValue ?? bench.bResult.p50; - - const panelWinner = - activePanel && (activePanel.aValue > 0 || activePanel.bValue > 0) - ? decideWinner(effectiveAVal, effectiveBVal, effectiveHigherIsBetter) - : bench.aggregateWinner; + const hasScopes = bench.panelScopes.length > 0; return (
@@ -97,79 +85,63 @@ export function CompareBenchCard({ - {bench.panelScopes.length > 0 && ( -
- - View - - setActivePanelId(null)} - /> - {bench.panelScopes.map((p) => ( - setActivePanelId(p.id)} + {hasScopes ? ( + + ) : ( + <> +
+ - ))} -
- )} - -
- - -
+ +
- {!activePanel && - (bench.chainRegionMatrix.length > 0 ? ( - - ) : ( - <> - {bench.chainBreakdown.length > 0 && ( - - )} - {bench.regionBreakdown.length > 0 && ( - - )} - - ))} + {bench.chainRegionMatrix.length > 0 ? ( + + ) : ( + <> + {bench.chainBreakdown.length > 0 && ( + + )} + {bench.regionBreakdown.length > 0 && ( + + )} + + )} + + )}