- {planningTools ? (
-
-
-
- Try a different crowd
- See what changes if the guest count moves.
-
-
- Explore
- Close
-
-
-
- {planningTools}
-
- ) : null}
-
+ {/* Search first in the source order so phones start with it. */}
+
+
{dishes.length === 0 ? (
toggle(dish.dishId)}
/>
))
)}
-
);
diff --git a/src/components/menu/WhatIfPlanner.tsx b/src/components/menu/WhatIfPlanner.tsx
index b050728..502f54c 100644
--- a/src/components/menu/WhatIfPlanner.tsx
+++ b/src/components/menu/WhatIfPlanner.tsx
@@ -307,6 +307,11 @@ export function WhatIfPlanner({
>
{line.emoji} {line.name}
+ {line.dishNames.length > 1 ? (
+
+ for {line.dishNames.join(", ")}
+
+ ) : null}
|
diff --git a/src/components/menu/menuForm.tsx b/src/components/menu/menuForm.tsx
index d74ea2e..44d7b2e 100644
--- a/src/components/menu/menuForm.tsx
+++ b/src/components/menu/menuForm.tsx
@@ -2,6 +2,8 @@ export interface MenuFormState {
error: string | null;
/** Counts successful saves, so a form can reset itself after one. */
saves: number;
+ /** Set when a dish was just added, so the picker can announce and reveal it. */
+ added?: { dishId: string; name: string };
}
export const INITIAL_MENU_FORM_STATE: MenuFormState = { error: null, saves: 0 };
@@ -19,3 +21,11 @@ export function FormError({ message }: { message: string | null }) {
);
}
+
+export function FormStatus({ message }: { message: string | null }) {
+ return (
+
+ {message}
+
+ );
+}
diff --git a/src/components/prep/KitchenSheet.test.tsx b/src/components/prep/KitchenSheet.test.tsx
index 1280365..42b9eaa 100644
--- a/src/components/prep/KitchenSheet.test.tsx
+++ b/src/components/prep/KitchenSheet.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen } from "@testing-library/react";
+import { render, screen, within } from "@testing-library/react";
import type { ReactNode } from "react";
import { describe, expect, it, vi } from "vitest";
import { computeHeadcount } from "@/domain/headcount";
@@ -73,7 +73,7 @@ describe("KitchenSheet", () => {
expect(screen.getByText(/Planning for ~1 person/)).toBeInTheDocument();
expect(screen.getByRole("heading", { level: 3, name: /Burgers/ })).toBeInTheDocument();
expect(screen.getByText("1 burger")).toBeInTheDocument();
- expect(screen.getByText("0.5 lb")).toBeInTheDocument();
+ expect(screen.getByText("1/2 lb")).toBeInTheDocument();
expect(screen.getByText("1 pack")).toBeInTheDocument();
expect(screen.getByRole("heading", { name: /Food notes/ })).toBeInTheDocument();
expect(screen.getByText("No dairy")).toBeInTheDocument();
@@ -84,6 +84,24 @@ describe("KitchenSheet", () => {
);
});
+ it("shows the dish time and numbered steps", () => {
+ const withSteps: MenuDish = {
+ ...dish,
+ recipe: {
+ ...dish.recipe,
+ prepMinutes: 15,
+ cookMinutes: 20,
+ steps: ["Form the patties.", "Grill 4 minutes a side."],
+ },
+ };
+ render();
+
+ expect(screen.getByText("Prep 15 min · Cook 20 min · Total 35 min")).toBeInTheDocument();
+ const steps = screen.getByText("Form the patties.").closest("ol");
+ expect(steps?.tagName).toBe("OL");
+ expect(within(steps as HTMLElement).getAllByRole("listitem")).toHaveLength(2);
+ });
+
it("explains zero saved portions without implying guests have not been counted", () => {
render();
expect(screen.getByText("Nothing to buy for the saved portions.")).toBeInTheDocument();
diff --git a/src/components/prep/KitchenSheet.tsx b/src/components/prep/KitchenSheet.tsx
index 82cffb7..0eaaa00 100644
--- a/src/components/prep/KitchenSheet.tsx
+++ b/src/components/prep/KitchenSheet.tsx
@@ -9,8 +9,8 @@ function PeopleFor({ headcount }: { headcount: number }) {
}
/**
- * A saved, host-only sheet for the counter. It shows saved RSVP/portion data only;
- * it never recalculates attendance live or invents cooking directions.
+ * A saved, host-only sheet for the counter. It shows saved RSVP/portion data and the
+ * recipe's own saved steps; it never recalculates attendance live or invents directions.
*
* Scoped hooks for the parent's globals/print CSS: kitchen-sheet, kitchen-sheet-head,
* kitchen-event-name, kitchen-title, kitchen-meta, kitchen-summary, kitchen-plan,
@@ -44,10 +44,6 @@ export function KitchenSheet({ sheet }: { sheet: PrepSheet }) {
{planningLabel(sheet.headcount)}
{sheet.headcountLine}
-
- Saved planning snapshot. Counts and quantities use the RSVPs and portions saved in
- Spread; attendance can still change.
-
@@ -113,6 +109,18 @@ export function KitchenSheet({ sheet }: { sheet: PrepSheet }) {
))}
+ {dish.timeLabel ? (
+
+ {dish.timeLabel}
+
+ ) : null}
+ {dish.steps.length > 0 ? (
+
+ {dish.steps.map((step, index) => (
+ - {step}
+ ))}
+
+ ) : null}
))}
diff --git a/src/components/shopping/CopyListButton.tsx b/src/components/shopping/CopyListButton.tsx
new file mode 100644
index 0000000..e345040
--- /dev/null
+++ b/src/components/shopping/CopyListButton.tsx
@@ -0,0 +1,49 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { Button } from "../ui/Button";
+
+/** How long "Copied!" stays up before the button resets. */
+const FEEDBACK_MS = 2000;
+
+/**
+ * Copies the plain-text shopping list. Feedback clears itself after two seconds;
+ * a blocked clipboard says so rather than pretending the copy worked.
+ */
+export function CopyListButton({ text }: { text: string }) {
+ const [feedback, setFeedback] = useState<{ status: "copied" | "failed"; at: number } | null>(null);
+
+ useEffect(() => {
+ if (!feedback) return;
+ const timer = window.setTimeout(() => setFeedback(null), FEEDBACK_MS);
+ return () => window.clearTimeout(timer);
+ }, [feedback]);
+
+ async function copy() {
+ try {
+ if (typeof navigator === "undefined" || typeof navigator.clipboard?.writeText !== "function") {
+ throw new Error("clipboard unavailable");
+ }
+ await navigator.clipboard.writeText(text);
+ setFeedback({ status: "copied", at: Date.now() });
+ } catch {
+ setFeedback({ status: "failed", at: Date.now() });
+ }
+ }
+
+ const copied = feedback?.status === "copied";
+
+ return (
+
+
+
+ {copied ? "Paste it into your notes or a message." : null}
+ {feedback?.status === "failed"
+ ? "Couldn't copy automatically. Select the list and copy it by hand."
+ : null}
+
+
+ );
+}
diff --git a/src/components/shopping/ExtrasCard.tsx b/src/components/shopping/ExtrasCard.tsx
index fb3b4ce..698bf08 100644
--- a/src/components/shopping/ExtrasCard.tsx
+++ b/src/components/shopping/ExtrasCard.tsx
@@ -97,10 +97,13 @@ export function ExtrasCard({
}) {
return (
- Extras
+
+ Extra spending
+ Costs that aren't on the ingredient list.
+
{extras.length === 0 ? (
- Drinks, ice and charcoal go here.
+ Log other spending like ice, charcoal or plates so the total stays honest.
) : (
diff --git a/src/components/shopping/ShoppingLineRow.tsx b/src/components/shopping/ShoppingLineRow.tsx
index 6b9017b..0e6b54b 100644
--- a/src/components/shopping/ShoppingLineRow.tsx
+++ b/src/components/shopping/ShoppingLineRow.tsx
@@ -1,8 +1,8 @@
"use client";
-import { useActionState, useState } from "react";
+import { useActionState, useOptimistic, useState, useTransition } from "react";
import { formatCents } from "@/domain/money";
-import { formatBuyQty } from "@/lib/shopping-text";
+import { formatBuyLabel, formatBuyQty, formatNeed } from "@/lib/shopping-text";
import type { ShoppingPlan } from "@/services/shopping";
import { FormError } from "../menu/menuForm";
import {
@@ -17,23 +17,47 @@ export interface ShoppingLineActions {
priceAction: ShoppingFormAction;
}
-function CheckBox({ name, checked, action }: { name: string; checked: boolean; action: ShoppingFormAction }) {
- const [state, formAction, pending] = useActionState(action, INITIAL_SHOPPING_FORM_STATE);
+/**
+ * The tick box. Optimistic: the box flips on tap, and if the save fails the
+ * transition ends without new props so the box flips back — with the reason
+ * shown underneath instead of a silently-checked row.
+ */
+function CheckBox({ line, action }: { line: ShoppingPlan["lines"][number]; action: ShoppingFormAction }) {
+ const [checked, setOptimisticChecked] = useOptimistic(line.checked);
+ const [pending, startTransition] = useTransition();
+ const [error, setError] = useState (null);
+
+ function toggle(next: boolean) {
+ startTransition(async () => {
+ setOptimisticChecked(next);
+ setError(null);
+ // An unticked checkbox sends nothing, matching the form's encoding.
+ const data = new FormData();
+ if (next) data.append("checked", "on");
+ try {
+ const result = await action(INITIAL_SHOPPING_FORM_STATE, data);
+ if (result.error) setError(result.error);
+ } catch {
+ // A thrown action (network, server crash) rolls back the same way.
+ setError("Couldn't save that tick. Try again.");
+ }
+ });
+ }
+
return (
- |