From 36821f42a839b99aa321fa57118008d694cfb31c Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Fri, 5 Jun 2026 16:37:15 -0700 Subject: [PATCH] Staff report: app/staff/report page with auth gate --- app/staff/report/page.tsx | 82 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 app/staff/report/page.tsx diff --git a/app/staff/report/page.tsx b/app/staff/report/page.tsx new file mode 100644 index 0000000..88d6af9 --- /dev/null +++ b/app/staff/report/page.tsx @@ -0,0 +1,82 @@ +import { Suspense } from "react"; +import { StaffReportView } from "@/components/StaffReportView"; +import { SiteHeader, SiteFooter } from "@/components/SiteChrome"; +import { isStaffKeyValid } from "@/lib/staff-auth"; + +interface PageProps { + searchParams: Promise<{ org?: string; key?: string }>; +} + +export const metadata = { + title: "Staff report — Food Co-op Initiative", + robots: { index: false, follow: false }, +}; + +export default async function StaffReportPage({ searchParams }: PageProps) { + const { org, key } = await searchParams; + + // Generic "not found" if the key is missing or wrong — don't confirm + // route existence. + if (!isStaffKeyValid(key)) { + return ; + } + + const orgId = Number(org); + const orgValid = !!org && Number.isFinite(orgId) && orgId > 0; + + return ( + <> + + Skip to content + + +
+
+ {orgValid ? ( + + + + ) : ( + + )} +
+
+ + + ); +} + +function NotFound() { + return ( + <> + +
+
+

Not found

+

+ The page you requested doesn't exist. +

+
+
+ + + ); +} + +function MissingOrg() { + return ( +
+

+ Missing or invalid org id. +

+

+ Add ?org=<civi-org-id> to the URL. The org + id is the Civi Contact id of the organization (visible in the URL when + viewing the org in CiviCRM). +

+
+ ); +}