Files
SixFlagsSuperCalendar/components/BackToCalendarLink.tsx
T
josh 6447db3008
Build and Deploy / Build & Push (push) Successful in 1m7s
refactor: store selected week in a cookie, not the URL
The home page no longer reads ?week=YYYY-MM-DD from the URL. Selected week
lives in the tcWeek cookie, set via a server action that revalidates the
home page so the next render reflects it. The URL stays at "/" regardless
of which week the user is viewing.

WeekNav prev/next/today buttons (and the arrow-key bindings) call the
server action directly — no router.refresh dance, no client-side cookie
write. BackToCalendarLink drops its localStorage-based href reconstruction
and just links to "/" since the cookie already remembers the right week
across navigations.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-30 08:39:20 -04:00

25 lines
596 B
TypeScript

import Link from "next/link";
export function BackToCalendarLink() {
// The selected week is stored in a server-readable cookie (tcWeek), so the
// home page already renders the right week without us needing to pass it
// through the URL.
return (
<Link
href="/"
className="park-name-link"
style={{
display: "flex",
alignItems: "center",
gap: 6,
fontSize: "0.8rem",
color: "var(--color-text-muted)",
textDecoration: "none",
transition: "color 120ms ease",
}}
>
Calendar
</Link>
);
}