diff --git a/frontend/src/pages/CommandCenterPage.tsx b/frontend/src/pages/CommandCenterPage.tsx index 05f09d0..7f54907 100644 --- a/frontend/src/pages/CommandCenterPage.tsx +++ b/frontend/src/pages/CommandCenterPage.tsx @@ -1,7 +1,7 @@ import { useEffect, useMemo, useState } from 'react' import { useQueries, useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' -import { fetchLiveState, fetchLocalMeetings, fetchSeasonMeetings, fetchSeasons, fetchSessions, fetchWeekend } from '../api' +import { fetchLiveState, fetchLocalMeetings, fetchSeasonMeetings, fetchSeasons, fetchSessions, fetchWeekend, fetchChampionshipHub } from '../api' import { RACE_HUB_DATASETS, countWeekendStats, formatCoverageHint, sessionTypeAbbrev } from '../lib/coverage' import { currentAndNextSession, @@ -17,7 +17,7 @@ import { import { countryAccent, countryDecal, countryFlag, formatGpDateRange } from '../lib/gpIdentity' import type { Meeting, Session, Weekend, WeekendSession } from '../types' import { PaddockBriefing } from '../components/PaddockBriefing' -import { Play, Activity, Calendar } from 'lucide-react' +import { Play, Activity, Calendar, Trophy } from 'lucide-react' type WeekendStatusKind = 'live' | 'current' | 'next' | 'recent' | 'fallback' @@ -92,6 +92,13 @@ export function CommandCenterPage() { staleTime: 5_000, }) + const championshipQuery = useQuery({ + queryKey: ['championship-hub', latestSeason], + queryFn: () => fetchChampionshipHub(latestSeason!), + enabled: latestSeason != null, + }) + const champHub = championshipQuery.data + useEffect(() => { const timer = window.setInterval(() => setNow(Date.now()), 1000) return () => window.clearInterval(timer) @@ -218,175 +225,264 @@ export function CommandCenterPage() { )} {focusMeeting && ( -
-
- {focusMeeting && ( -
- - Watch Live - {liveActive ? 'Feed active' : 'Standby'} - - - Open Analysis - - {actionSession - ? `${actionSession.session_name} · session ${actionSession.session_key}` - : 'Pick a session'} - - - {nextSession && sessionStartTime(nextSession) && ( - { - e.preventDefault() - document.getElementById('cc-schedule')?.scrollIntoView({ behavior: 'smooth' }) - }} +
+ - Schedule + Watch Live + {liveActive ? 'Feed active' : 'Standby'} + + + Open Analysis - next: {nextSession.session_name} + {actionSession + ? `${actionSession.session_name} · session ${actionSession.session_key}` + : 'Pick a session'} - - )} + + {nextSession && sessionStartTime(nextSession) && ( + { + e.preventDefault() + document.getElementById('cc-schedule')?.scrollIntoView({ behavior: 'smooth' }) + }} + > + Schedule + + next: {nextSession.session_name} + + + )} +
)} - {focusWeekendSessions.length > 0 && ( -
-
- Weekend Schedule - {focusWeekendSessions.length} sessions +
+
+
- )} + - {seasonMeetings.length > 0 && ( -
-
- Season Calendar - - {seasonMeetings.length} rounds · {meetingStats.full}/{meetingStats.total || 0} local - -
-
- {seasonMeetings.map((meeting, index) => { - const weekend = weekendsByKey.get(meeting.meeting_key) - const target = pickAnalysisSession(weekend) - const targetKey = target?.session.session_key ?? weekend?.default_session_key - const status = meetingStatus(meeting, focusMeeting?.meeting_key, nowDate) - const cardAccent = countryAccent(meeting) - return ( - -
- )} - + {focusWeekendSessions.length > 0 && ( +
+
+ Weekend Schedule + {focusWeekendSessions.length} sessions +
+
+ {focusWeekendSessions.map(({ session, source, datasets }) => { + const status = classifySessionStatus(session, nowDate) + const isNext = nextSession?.session_key === session.session_key + const isCurrent = currentSession?.session_key === session.session_key + const isLive = isCurrent && liveActive + return ( + +
+ + {sessionTypeAbbrev(session.session_type, session.session_name)} + + + {isCurrent ? 'On track' : status === 'done' ? 'Done' : isNext ? 'Next' : 'Upcoming'} + +
+
{session.session_name}
+
{formatSessionScheduleTime(session.date_start)}
+
+
+ + ) + })} +
+
+ )} + + + + ) } +function FormSparkline({ form, color }: { form: number[], color: string }) { + if (!form || form.length === 0) return null + const max = Math.max(...form, 26) // 26 is standard max for a race win + const width = 45 + const height = 14 + const step = width / Math.max(form.length - 1, 1) + + const points = form.map((val, i) => { + const x = i * step + const y = height - (val / max) * height + return `${x},${y}` + }).join(' ') + + return ( + + + + ) +} + function WeekendKindLabel({ kind }: { kind: WeekendStatusKind }) { switch (kind) { case 'live': diff --git a/frontend/src/styles/app.css b/frontend/src/styles/app.css index 6109a47..49dfe71 100644 --- a/frontend/src/styles/app.css +++ b/frontend/src/styles/app.css @@ -1427,10 +1427,150 @@ a { color: inherit; text-decoration: none; } min-height: calc(100vh - var(--nav-h)); display: flex; flex-direction: column; - gap: var(--s5); + gap: var(--s6); /* slightly more gap for the main sections */ --gp-accent: var(--red); } +.cc-hero { + display: flex; + flex-direction: column; + gap: var(--s4); +} + +.cc-dashboard-grid { + display: flex; + flex-direction: column; + gap: var(--s6); +} + +@media (min-width: 900px) { + .cc-dashboard-grid { + display: grid; + grid-template-columns: minmax(0, 65fr) minmax(0, 35fr); + gap: var(--s6); + align-items: start; + } +} + +.cc-dashboard-main { + position: relative; + z-index: 1; +} + +.cc-dashboard-panel { + background: rgba(18, 18, 18, 0.4); + border: 1px solid rgba(255, 255, 255, 0.04); + border-radius: 12px; + padding: var(--s6); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 32px rgba(0,0,0,0.4); + backdrop-filter: blur(16px); + -webkit-backdrop-filter: blur(16px); + display: flex; + flex-direction: column; + gap: var(--s6); +} + +.cc-ambient-aura { + position: absolute; + top: 0; + left: -5%; + width: 110%; + height: 100%; + background: radial-gradient(ellipse at center, var(--aura-accent, var(--red)) 0%, transparent 70%); + filter: blur(120px); + opacity: 0.45; + z-index: -1; + pointer-events: none; +} + +.cc-dashboard-sidebar { + display: flex; + flex-direction: column; + gap: var(--s6); +} + +/* Championship Snapshot Widget */ +.cc-champ-snapshot { + display: flex; + flex-direction: column; +} +.cc-champ-header { + font-size: 10px; + font-weight: 700; + letter-spacing: 0.14em; + text-transform: uppercase; + color: var(--text-3); + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); + padding-bottom: var(--s4); + margin-bottom: var(--s3); +} +.cc-champ-link { + color: var(--text-3); + text-decoration: none; + font-weight: 600; + transition: color 0.1s; +} +.cc-champ-link:hover { color: var(--text); } + +.cc-champ-group-label { + font-size: 9px; + font-weight: 700; + letter-spacing: 0.14em; + text-transform: uppercase; + color: var(--text-3); + margin: var(--s3) 0 var(--s2); + padding-left: var(--s2); +} + +.cc-champ-list { + display: flex; + flex-direction: column; + gap: 2px; +} +.cc-champ-row { + display: grid; + grid-template-columns: 105px 1fr auto; + align-items: center; + padding: var(--s3) var(--s4); + background: rgba(255, 255, 255, 0.02); + border-radius: 6px; + font-size: 13px; + transition: background 0.1s; +} +.cc-champ-row:hover { + background: rgba(255, 255, 255, 0.05); +} +.cc-champ-left { + display: flex; + align-items: center; + gap: var(--s4); +} +.cc-champ-form { + display: flex; + align-items: center; + justify-content: center; +} +.cc-champ-color { + width: 3px; + height: 16px; + border-radius: 2px; + box-shadow: 0 0 4px currentColor; +} +.cc-champ-name { font-weight: 600; color: var(--text); } + +.cc-champ-right { + display: grid; + grid-template-columns: 45px 35px; + align-items: center; + gap: var(--s2); + text-align: right; +} +.cc-champ-pts { font-weight: 700; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; } +.cc-champ-gap { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; } + .cc-topbar { display: flex; align-items: center; @@ -1486,15 +1626,16 @@ a { color: inherit; text-decoration: none; } .cc-weekend-band { display: flex; background: var(--surface); - border: 1px solid var(--border); - border-radius: 4px; + border: 1px solid rgba(255, 255, 255, 0.08); + border-radius: 8px; overflow: hidden; min-height: 124px; } .cc-band-accent { - width: 6px; - background: linear-gradient(180deg, var(--gp-accent), rgba(255,255,255,0.28), var(--gp-accent)); + width: 4px; + background: var(--gp-accent); + box-shadow: 0 0 12px var(--gp-accent); flex-shrink: 0; } @@ -1505,16 +1646,18 @@ a { color: inherit; text-decoration: none; } position: relative; overflow: hidden; background: - linear-gradient(135deg, color-mix(in srgb, var(--gp-accent) 18%, transparent), transparent 54%), + radial-gradient(ellipse at top right, color-mix(in srgb, var(--gp-accent) 15%, transparent), transparent 60%), + linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px), + linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px), var(--surface); + background-size: 100% 100%, 20px 20px, 20px 20px, 100% 100%; } .cc-band-body::after { content: ""; position: absolute; inset: 0; - background: - repeating-linear-gradient(110deg, transparent 0 22px, rgba(255,255,255,0.025) 22px 23px); + background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.3) 100%); pointer-events: none; } @@ -1565,10 +1708,13 @@ a { color: inherit; text-decoration: none; } .cc-kind-recent { color: var(--text-3); } .cc-band-name { - font-size: 22px; - font-weight: 700; - line-height: 1.15; - margin-top: 2px; + font-size: 26px; + font-weight: 800; + letter-spacing: -0.02em; + line-height: 1.1; + margin-top: 4px; + color: #fff; + text-shadow: 0 2px 8px rgba(0,0,0,0.5); } .cc-band-sub { @@ -1582,7 +1728,7 @@ a { color: inherit; text-decoration: none; } .cc-countdown-block { flex-shrink: 0; - border-left: 1px solid var(--border); + border-left: 1px solid rgba(255, 255, 255, 0.08); padding-left: var(--s6); display: flex; flex-direction: column; @@ -1620,31 +1766,38 @@ a { color: inherit; text-decoration: none; } /* Primary actions */ .cc-actions-row { display: grid; - grid-template-columns: repeat(3, minmax(0, 1fr)); - gap: var(--s3); + grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); + gap: var(--s4); } .cc-pri-action { display: flex; flex-direction: column; - gap: 2px; - padding: var(--s4) var(--s5); + gap: 4px; + padding: var(--s5) var(--s5); background: var(--surface); border: 1px solid var(--border); - border-radius: 4px; + border-radius: 6px; border-left: 3px solid var(--gp-accent); - transition: background 0.1s, border-color 0.1s; + transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, background 0.2s, border-color 0.2s; min-width: 0; + box-shadow: 0 4px 12px rgba(0,0,0,0.2); } .cc-pri-action:hover { + transform: translateY(-2px) scale(1.01); background: var(--surface-h); - border-color: var(--border-2); + border-color: rgba(255, 255, 255, 0.15); border-left-color: var(--gp-accent); + box-shadow: 0 8px 24px rgba(0,0,0,0.4); } .cc-pri-action.is-live { border-left-color: var(--red); - background: rgba(225, 6, 0, 0.05); + background: rgba(225, 6, 0, 0.08); +} +.cc-pri-action.is-live:hover { + background: rgba(225, 6, 0, 0.12); + box-shadow: 0 8px 24px rgba(225, 6, 0, 0.25); } .cc-pri-label { @@ -1673,25 +1826,28 @@ a { color: inherit; text-decoration: none; } .cc-session-card { display: flex; flex-direction: column; - gap: 4px; - padding: var(--s3) var(--s4); - background: var(--surface); - border: 1px solid var(--border); - border-radius: 4px; + gap: 6px; + padding: var(--s4); + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.06); + border-radius: 6px; min-width: 0; - transition: background 0.1s, border-color 0.1s; + transition: transform 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s; } .cc-session-card:hover { - background: var(--surface-h); - border-color: var(--border-2); + transform: translateY(-2px); + background: rgba(255, 255, 255, 0.04); + border-color: rgba(255, 255, 255, 0.12); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); } .cc-session-card.is-current { - border-color: rgba(225, 6, 0, 0.4); - background: rgba(225, 6, 0, 0.06); + border-color: rgba(225, 6, 0, 0.6); + background: linear-gradient(135deg, rgba(225, 6, 0, 0.12), rgba(225, 6, 0, 0.02)); + box-shadow: 0 0 16px rgba(225, 6, 0, 0.15); } .cc-session-card.is-next { - border-color: rgba(255, 214, 0, 0.35); - background: rgba(255, 214, 0, 0.04); + border-color: rgba(255, 214, 0, 0.4); + background: linear-gradient(135deg, rgba(255, 214, 0, 0.08), rgba(255, 214, 0, 0.01)); } .cc-status-done { opacity: 0.78; } @@ -1707,25 +1863,45 @@ a { color: inherit; text-decoration: none; } font-weight: 800; letter-spacing: 0.05em; color: var(--text-2); - background: var(--surface-2); - border: 1px solid var(--border); - border-radius: 2px; - padding: 1px 6px; + background: rgba(255, 255, 255, 0.06); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 4px; + padding: 2px 8px; min-width: 28px; text-align: center; } .cc-session-status { font-size: 9px; - font-weight: 700; + font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; + padding: 2px 6px; + border-radius: 4px; +} +.cc-status-pill-live { + background: rgba(225, 6, 0, 0.15); + color: var(--red); + border: 1px solid rgba(225, 6, 0, 0.3); + animation: pulse-live 2s infinite; +} +@keyframes pulse-live { + 0% { box-shadow: 0 0 0 0 rgba(225, 6, 0, 0.4); } + 70% { box-shadow: 0 0 0 4px rgba(225, 6, 0, 0); } + 100% { box-shadow: 0 0 0 0 rgba(225, 6, 0, 0); } +} +.cc-status-pill-upcoming { + background: rgba(255, 214, 0, 0.15); + color: var(--yellow); + border: 1px solid rgba(255, 214, 0, 0.3); +} +.cc-status-pill-done { + background: rgba(255, 255, 255, 0.05); + color: var(--text-3); + border: 1px solid rgba(255, 255, 255, 0.05); } -.cc-status-pill-live { color: var(--red); } -.cc-status-pill-upcoming { color: var(--yellow); } -.cc-status-pill-done { color: var(--text-3); } .cc-session-name { font-size: 12px; @@ -1769,8 +1945,8 @@ a { color: inherit; text-decoration: none; } .cc-calendar-grid { display: grid; - grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); - gap: var(--s3); + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: var(--s4); } .cc-calendar-card { @@ -1783,30 +1959,35 @@ a { color: inherit; text-decoration: none; } gap: var(--s4); padding: var(--s4); overflow: hidden; - background: - linear-gradient(145deg, color-mix(in srgb, var(--gp-card-accent) 22%, transparent), transparent 58%), - var(--surface); - border: 1px solid var(--border); - border-radius: 4px; - transition: transform 0.12s, border-color 0.12s, background 0.12s; + background: rgba(18, 18, 18, 0.45); + backdrop-filter: blur(24px); + -webkit-backdrop-filter: blur(24px); + border: 1px solid rgba(255, 255, 255, 0.05); + border-radius: 6px; + transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s, box-shadow 0.2s, background 0.2s; } .cc-calendar-card::before { content: ""; position: absolute; inset: 0; - background: - radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--gp-card-accent) 26%, transparent), transparent 32%), - repeating-linear-gradient(115deg, transparent 0 18px, rgba(255,255,255,0.025) 18px 19px); + background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%); + opacity: 0; + transition: opacity 0.2s; pointer-events: none; } .cc-calendar-card:hover { - transform: translateY(-2px); - border-color: color-mix(in srgb, var(--gp-card-accent) 58%, var(--border)); - background: - linear-gradient(145deg, color-mix(in srgb, var(--gp-card-accent) 28%, transparent), transparent 60%), - var(--surface-h); + transform: translateY(-4px) scale(1.01); + border-color: color-mix(in srgb, var(--gp-card-accent) 50%, rgba(255, 255, 255, 0.15)); + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 2px 12px color-mix(in srgb, var(--gp-card-accent) 20%, transparent); + background: + radial-gradient(ellipse at top left, color-mix(in srgb, var(--gp-card-accent) 15%, transparent), transparent 70%), + rgba(255, 255, 255, 0.05); +} + +.cc-calendar-card:hover::before { + opacity: 1; } .cc-calendar-card > * { @@ -1829,7 +2010,13 @@ a { color: inherit; text-decoration: none; } } .cc-calendar-past { - opacity: 0.58; + filter: grayscale(0.85); + opacity: 0.75; +} + +.cc-calendar-past:hover { + filter: grayscale(0.1); + opacity: 1; } .cc-calendar-top, @@ -1848,12 +2035,23 @@ a { color: inherit; text-decoration: none; } } .cc-calendar-decal { - font-size: 28px; + position: absolute; + bottom: -10px; + right: -5px; + font-size: 80px; font-weight: 900; - letter-spacing: -0.04em; - line-height: 0.95; + letter-spacing: -0.05em; + line-height: 1; color: var(--gp-card-accent); - filter: brightness(1.25); + opacity: 0.04; + z-index: 0; + pointer-events: none; + transition: opacity 0.2s, transform 0.2s; +} + +.cc-calendar-card:hover .cc-calendar-decal { + opacity: 0.1; + transform: scale(1.05) translate(-2px, -2px); } .cc-calendar-flag { @@ -4097,10 +4295,10 @@ a { color: inherit; text-decoration: none; } /* Glassmorphism */ .glass-panel { - background: rgba(18, 18, 18, 0.65); - backdrop-filter: blur(12px); - -webkit-backdrop-filter: blur(12px); - border: 1px solid var(--border-glow); + background: rgba(18, 18, 18, 0.45); + backdrop-filter: blur(24px); + -webkit-backdrop-filter: blur(24px); + border: 1px solid rgba(255, 255, 255, 0.1); } /* Base Card Enhancements (Soft borders, inner shadow, hover) */ diff --git a/tests/visual/__snapshots__/desktop/command-center.png b/tests/visual/__snapshots__/desktop/command-center.png index 7620630..a83de76 100644 Binary files a/tests/visual/__snapshots__/desktop/command-center.png and b/tests/visual/__snapshots__/desktop/command-center.png differ diff --git a/tests/visual/__snapshots__/mobile/command-center.png b/tests/visual/__snapshots__/mobile/command-center.png index 4707912..d7820fc 100644 Binary files a/tests/visual/__snapshots__/mobile/command-center.png and b/tests/visual/__snapshots__/mobile/command-center.png differ diff --git a/tests/visual/__snapshots__/tablet/command-center.png b/tests/visual/__snapshots__/tablet/command-center.png index 035f43b..f77f6e8 100644 Binary files a/tests/visual/__snapshots__/tablet/command-center.png and b/tests/visual/__snapshots__/tablet/command-center.png differ