From 6c6b5d30533508112846d43fae8af4a3ede9271e Mon Sep 17 00:00:00 2001 From: default Date: Thu, 4 Jun 2026 17:31:03 +0000 Subject: [PATCH] fix(admin/stops): restore StopsHeaderActions file Commit bdcaf0f1 (editorial stops redesign) re-imported @/components/admin/StopsHeaderActions in the stops page and placed it in the PageHeader's actions prop, but never recreated the file (it had been removed in bc29c70). The build fails with 'Module not found' for StopsHeaderActions. Restore the file from its previous content (pre-bc29c70). The component renders the 'Upload Schedule' and 'Add Stop' header actions, with a 'stops' tab guard so the buttons don't leak onto the Locations tab. Without it, the stops surface has no way to add a stop or import a schedule (StopTableClient is rendered with hideInternalFilterBar and StopsViewClient doesn't host the buttons). --- src/components/admin/StopsHeaderActions.tsx | 94 +++++++++------------ 1 file changed, 42 insertions(+), 52 deletions(-) diff --git a/src/components/admin/StopsHeaderActions.tsx b/src/components/admin/StopsHeaderActions.tsx index 85a391c..48435d5 100644 --- a/src/components/admin/StopsHeaderActions.tsx +++ b/src/components/admin/StopsHeaderActions.tsx @@ -1,74 +1,64 @@ "use client"; import { useState } from "react"; -import { useRouter } from "next/navigation"; -import { AdminButton } from "@/components/admin/design-system"; import ScheduleImportModal from "@/components/admin/ScheduleImportModal"; import AddStopModal from "@/components/admin/AddStopModal"; +import { useRouter } from "next/navigation"; +import { AdminButton } from "@/components/admin/design-system"; type Props = { brandId: string; + /** Hide on the Locations tab — actions belong to the Stops tab only. */ + tab?: "stops" | "locations"; }; -export default function StopsHeaderActions({ brandId }: Props) { - const router = useRouter(); - const [showAdd, setShowAdd] = useState(false); +export default function StopsHeaderActions({ brandId, tab = "stops" }: Props) { const [showImport, setShowImport] = useState(false); + const [showAdd, setShowAdd] = useState(false); + const router = useRouter(); - const refresh = () => router.refresh(); + if (tab !== "stops") return null; + + function handleImportComplete(count: number) { + router.refresh(); + } + + function handleAddSuccess(stopId: string) { + router.refresh(); + } return ( <> - setShowImport(true)} - icon={ - - - - } - > - Upload Schedule - - setShowAdd(true)} - icon={ - - - - } - > - Add Stop - +
+ setShowImport(true)} + icon={ + + + + } + > + Upload Schedule + + setShowAdd(true)} + icon={ + + + + } + > + Add Stop + +
{showImport && ( setShowImport(false)} - onComplete={refresh} + onComplete={handleImportComplete} /> )} @@ -76,7 +66,7 @@ export default function StopsHeaderActions({ brandId }: Props) { isOpen={showAdd} onClose={() => setShowAdd(false)} brandId={brandId} - onSuccess={refresh} + onSuccess={handleAddSuccess} /> );