feat: persistent Coaster Mode toggle in header top-right
All checks were successful
Build and Deploy / Build & Push (push) Successful in 53s
All checks were successful
Build and Deploy / Build & Push (push) Successful in 53s
- Moves the coaster toggle out of WeekNav and into the homepage header top-right as "🎢 Coaster Mode", alongside the parks open badge - State is stored in localStorage ("coasterMode") so the preference persists across sessions and page refreshes - Dropped the ?coasters=1 URL param entirely; the server always fetches both rideCounts and coasterCounts, and HomePageClient picks which to display client-side — no flash or server round-trip on toggle - Individual park pages: LiveRidePanel reads localStorage on mount and pre-selects the Coasters Only filter when Coaster Mode is active - Extracted HomePageClient (client component) to own the full homepage UI; page.tsx is now pure data-fetching Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import type { LiveRidesResult, LiveRide } from "@/lib/scrapers/queuetimes";
|
||||
|
||||
interface LiveRidePanelProps {
|
||||
@@ -13,6 +13,13 @@ export function LiveRidePanel({ liveRides, parkOpenToday }: LiveRidePanelProps)
|
||||
const hasCoasters = rides.some((r) => r.isCoaster);
|
||||
const [coastersOnly, setCoastersOnly] = useState(false);
|
||||
|
||||
// Pre-select coaster filter if Coaster Mode is enabled on the homepage.
|
||||
useEffect(() => {
|
||||
if (hasCoasters && localStorage.getItem("coasterMode") === "true") {
|
||||
setCoastersOnly(true);
|
||||
}
|
||||
}, [hasCoasters]);
|
||||
|
||||
const visible = coastersOnly ? rides.filter((r) => r.isCoaster) : rides;
|
||||
const openRides = visible.filter((r) => r.isOpen);
|
||||
const closedRides = visible.filter((r) => !r.isOpen);
|
||||
|
||||
Reference in New Issue
Block a user