Dev Helpers
← Back

Weekend availability guidance

Place this file at app/stores/[branch]/page.tsx in an App Router project.

Open this example in the interactive library

Source code

// app/stores/[branch]/page.tsx

import { notFound } from "next/navigation";

export default async function WeekendAvailabilityGuidance({
  params,
}: {
  params: Promise<{ branch: string }>;
}) {
  const branches = [
    { key: "market", opens: 9, closes: 18, sat: true, stock: 12 },
    { key: "pier", opens: 11, closes: 19, sat: false, stock: 4 },
  ];
  const { branch } = await params;
  const store = branches.find((b) => b.key === branch);
  if (!store) notFound();
  return (
    <aside>
      {store.sat ? "Saturday pickup is available." : "Weekday pickup only."}
    </aside>
  );
}