From 5003175305fe0a1615d7b1009bb2f22afc78cdc1 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 22 Mar 2026 20:55:55 +0100 Subject: [PATCH] redesign(pagespeed): equal gauges in hero + category gauges in diagnostics - Hero: 4 equal 90px ScoreGauges in a row with screenshot on right - Diagnostics: each category card gets a 56px gauge header with score and issue count, matching pagespeed.web.dev's category sections - Legend and metadata moved to footer bar in hero card --- app/sites/[id]/pagespeed/page.tsx | 109 ++++++++++++++---------------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/app/sites/[id]/pagespeed/page.tsx b/app/sites/[id]/pagespeed/page.tsx index 8d047ae..bb41293 100644 --- a/app/sites/[id]/pagespeed/page.tsx +++ b/app/sites/[id]/pagespeed/page.tsx @@ -270,18 +270,20 @@ export default function PageSpeedPage() { { key: 'tti', label: 'Time to Interactive', value: currentCheck?.tti_ms ?? null }, ] - // * Compact score helper for the hero section - const compactScores = [ - { label: 'Accessibility', score: currentCheck?.accessibility_score ?? null }, - { label: 'Best Practices', score: currentCheck?.best_practices_score ?? null }, - { label: 'SEO', score: currentCheck?.seo_score ?? null }, + // * All 4 category scores for the hero row + const allScores = [ + { key: 'performance', label: 'Performance', score: currentCheck?.performance_score ?? null }, + { key: 'accessibility', label: 'Accessibility', score: currentCheck?.accessibility_score ?? null }, + { key: 'best-practices', label: 'Best Practices', score: currentCheck?.best_practices_score ?? null }, + { key: 'seo', label: 'SEO', score: currentCheck?.seo_score ?? null }, ] - function getScoreColor(score: number | null): string { - if (score === null) return '#6b7280' - if (score >= 90) return '#0cce6b' - if (score >= 50) return '#ffa400' - return '#ff4e42' + // * Map category key to score for diagnostics section + const scoreByGroup: Record = { + 'performance': currentCheck?.performance_score ?? null, + 'accessibility': currentCheck?.accessibility_score ?? null, + 'best-practices': currentCheck?.best_practices_score ?? null, + 'seo': currentCheck?.seo_score ?? null, } function getMetricDotColor(metric: string, value: number | null): string { @@ -353,62 +355,46 @@ export default function PageSpeedPage() { - {/* Section 1 — Hero Card: Score Gauge + Compact Scores + Screenshot */} + {/* Section 1 — Score Overview: 4 equal gauges + screenshot */}
-
- {/* Left — Large Performance Gauge */} -
- +
+ {/* 4 equal gauges */} +
+ {allScores.map(({ label, score }) => ( + + ))}
- {/* Center — Compact Scores + Meta */} -
-
- {compactScores.map(({ label, score }) => ( - - ))} -
- - {/* Last checked + frequency */} -
- {currentCheck?.checked_at && ( - Last checked {formatTimeAgo(currentCheck.checked_at)} - )} - {config?.frequency && ( - - {config.frequency} - - )} -
- - {/* Score Legend */} -
- - - 0–49 - - - - 50–89 - - - - 90–100 - -
-
- - {/* Right — Screenshot */} + {/* Screenshot */} {currentCheck?.screenshot && (
{`${strategy}
)}
+ + {/* Last checked + frequency + legend */} +
+
+ {currentCheck?.checked_at && ( + Last checked {formatTimeAgo(currentCheck.checked_at)} + )} + {config?.frequency && ( + + {config.frequency} + + )} +
+
+ 0–49 + 50–89 + 90–100 +
+
{/* Filmstrip — page load progression */} @@ -527,9 +513,18 @@ export default function PageSpeedPage() { if (groupAudits.length === 0) return null return (
-

- {group.label} -

+ {/* Category header with gauge */} +
+ +
+

+ {group.label} +

+

+ {groupAudits.length} issue{groupAudits.length !== 1 ? 's' : ''} found +

+
+
{groupAudits.length > 0 && (