diff --git a/src/client/features/rank-tracking/RankTrackingOverview.tsx b/src/client/features/rank-tracking/RankTrackingOverview.tsx index 199087c..e13f7a1 100644 --- a/src/client/features/rank-tracking/RankTrackingOverview.tsx +++ b/src/client/features/rank-tracking/RankTrackingOverview.tsx @@ -12,7 +12,6 @@ import { import type { TooltipContentProps } from "recharts"; import { getRankConfigTrend } from "@/serverFunctions/rank-tracking"; import type { RankTrackingRow } from "@/types/schemas/rank-tracking"; -import { computeScorecards } from "./rankTrackingScorecards"; import { formatDateTick, TrendRangeToggle, @@ -45,11 +44,6 @@ export function RankTrackingOverview({ }) { const [sinceDays, setSinceDays] = useState(730); - const scorecards = useMemo( - () => computeScorecards(rows, device), - [rows, device], - ); - const { data: trend, isLoading: trendLoading } = useQuery({ queryKey: ["rankConfigTrend", projectId, configId, device, sinceDays], queryFn: () => @@ -74,153 +68,111 @@ export function RankTrackingOverview({ return (
-
- {/* All metrics in one card */} -
-
- - - - - -
+
+
+ Position distribution +
- {/* Position distribution */} -
-
- Position distribution - -
- -
- {BUCKETS.map((b) => ( - - - {b.label} - - ))} -
- - {trendLoading ? ( -
- -
- ) : chartData.length <= 1 ? ( -
- {chartData.length === 0 - ? "No history yet — run a check to start tracking positions over time." - : "Only 1 check so far — the trend fills in after the next check."} -
- ) : ( -
+ {BUCKETS.map((b) => ( + - {width > 0 ? ( - - - - - ) => { - const { active, payload, label } = props; - if ( - !active || - !payload?.length || - typeof label !== "number" - ) { - return null; - } - const byKey = new Map( - payload.map((p: PayloadEntry) => [ - String(p.dataKey), - typeof p.value === "number" ? p.value : 0, - ]), - ); - return ( - - ); - }} - cursor={{ stroke: "rgba(150,150,150,0.3)" }} - /> - {BUCKETS.map((b) => ( - - ))} - - ) : null} -
- )} + + {b.label} + + ))}
+ + {trendLoading ? ( +
+ +
+ ) : chartData.length <= 1 ? ( +
+ {chartData.length === 0 + ? "No history yet — run a check to start tracking positions over time." + : "Only 1 check so far — the trend fills in after the next check."} +
+ ) : ( +
+ {width > 0 ? ( + + + + + ) => { + const { active, payload, label } = props; + if ( + !active || + !payload?.length || + typeof label !== "number" + ) { + return null; + } + const byKey = new Map( + payload.map((p: PayloadEntry) => [ + String(p.dataKey), + typeof p.value === "number" ? p.value : 0, + ]), + ); + return ; + }} + cursor={{ stroke: "rgba(150,150,150,0.3)" }} + /> + {BUCKETS.map((b) => ( + + ))} + + ) : null} +
+ )}
); @@ -257,37 +209,3 @@ function DistributionTooltip({
); } - -function Scorecard({ - label, - value, - delta, - hint, -}: { - label: string; - value: string; - delta?: number | null; - hint?: string; -}) { - return ( -
-

{label}

-
- {value} - {delta != null && delta !== 0 && ( - 0 ? "text-success" : "text-warning" - }`} - > - {delta > 0 ? "▲" : "▼"}{" "} - {Number.isInteger(delta) - ? Math.abs(delta) - : Math.abs(delta).toFixed(1)} - - )} -
- {hint &&

{hint}

} -
- ); -}