diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 1898b12..826fe6b 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -4587,3 +4587,48 @@ rows", transactions 2 "show more" in steps of 20, plus a view-only list.
### Open problems
- Not checked visually in a browser in this session.
+
+## HO-122: Confirm before deleting or disconnecting; fix links on a filtered new transaction
+
+- **Date:** 2026-10-11 (UTC)
+- **Author:** Muhammad Tahub Khatri with Claude Code
+- **Branch / PR:** `fix/ui-confirmations` / PR linked from the branch
+
+### What changed
+- **Broken links:** adding a transaction from a filtered list
+ (`/transactions/new?account=…`) built "Review transfers" as
+ `…/transactions?account=…/transfers` and left the Bills link pointing
+ at Transactions. `transactionsPath()` in `transaction-form.tsx` drops
+ the query for those links; Cancel keeps the filter.
+- **Confirmations:** new shared `Confirm` (`src/components/ui/confirm.tsx`),
+ a ` {consequence}{label}
+
{state.errors.form}
: null} - {state.message ?{state.message}
: null} + {/* Always there, so the first message is announced too. */} ++ {state.message} +
> ); } diff --git a/src/features/budgets/ui/budgets-page.tsx b/src/features/budgets/ui/budgets-page.tsx index 3ab4be8..0d49f37 100644 --- a/src/features/budgets/ui/budgets-page.tsx +++ b/src/features/budgets/ui/budgets-page.tsx @@ -1,4 +1,5 @@ import Link from "next/link"; +import { Confirm } from "@/components/ui/confirm"; import { absolute, formatCents } from "@/lib/money"; import { copyBudgetsAction, @@ -191,15 +192,20 @@ export function BudgetsPage({ data }: { data: BudgetsView }) { )} /> {row.allocation !== null ? ( -{state.errors.form}
: null} - {state.message ?{state.message}
: null} + {/* Always there, so the first message is announced too. */} ++ {state.message} +
); } @@ -72,7 +75,10 @@ export function BudgetOperation({ {pending ? "Saving…" : label} {state.errors.form ?{state.errors.form}
: null} - {state.message ?{state.message}
: null} + {/* Always there, so the first message is announced too. */} ++ {state.message} +
); } diff --git a/src/features/cashflow/ui/day-panel.tsx b/src/features/cashflow/ui/day-panel.tsx index 4591f4a..cf6d174 100644 --- a/src/features/cashflow/ui/day-panel.tsx +++ b/src/features/cashflow/ui/day-panel.tsx @@ -200,6 +200,35 @@ function AddForm({ ); } +/** + * × asks once more before it removes: the first press turns it into + * "Remove?", the second removes. It stays the same button, so focus stays + * on it; moving away puts the × back. + */ +function RemoveButton({ + name, + disabled, + onRemove, +}: { + name: string; + disabled: boolean; + onRemove: () => void; +}) { + const [armed, setArmed] = useState(false); + return ( + + ); +} + export function DayPanel({ workspaceId, day, @@ -309,26 +338,18 @@ export function DayPanel({ > It happened - + onRemove={() => remove(item)} + /> ) : canEdit && item.removable ? ( - + onRemove={() => remove(item)} + /> ) : item.isPlan ? ( ) : ( diff --git a/src/features/imports/ui/preview-panel.tsx b/src/features/imports/ui/preview-panel.tsx index ee1a81f..7e8fb14 100644 --- a/src/features/imports/ui/preview-panel.tsx +++ b/src/features/imports/ui/preview-panel.tsx @@ -2,6 +2,7 @@ import { useActionState, useId } from "react"; import { useFormStatus } from "react-dom"; +import { Confirm } from "@/components/ui/confirm"; import { formatCents, formatSigned } from "@/lib/money"; import { type Check, formatStatementDate } from "../domain/checks"; import type { StatementRow } from "../domain/statement"; @@ -29,7 +30,7 @@ function DiscardButton() { const { pending } = useFormStatus(); return ( ); } @@ -143,9 +144,14 @@ export function PreviewPanel({ - +- Review transfers to pair - activity or remove a relationship. Linked bill evidence must be reviewed - in{" "} - + Review transfers to + pair activity or remove a relationship. Linked bill evidence must be + reviewed in{" "} + Bills {" "} before changing its transfer label. diff --git a/src/features/transfers/ui/review-page.tsx b/src/features/transfers/ui/review-page.tsx index 20e9a23..07eccca 100644 --- a/src/features/transfers/ui/review-page.tsx +++ b/src/features/transfers/ui/review-page.tsx @@ -28,6 +28,16 @@ function href( if (value !== undefined) search.set(key, String(value)); return `/w/${workspaceId}/transactions/transfers?${search}`; } +// "Oct 9, 2026", read as a calendar date (UTC), so it is the same on the +// server and in the browser. +const dateFormat = new Intl.DateTimeFormat("en-US", { + month: "short", + day: "numeric", + year: "numeric", + timeZone: "UTC", +}); +const day = (iso: string) => dateFormat.format(new Date(`${iso}T00:00:00Z`)); + function amount(row: ReviewRow) { return Number.isSafeInteger(row.amountCents) ? formatSigned(cents(row.amountCents)) @@ -38,7 +48,7 @@ function Fact({ row }: { row: ReviewRow }) {
{defaultWindow ? "90-day review window" : "Selected review window"}:{" "} - {query.from} through {query.to}. This page shows bounded recorded - activity, not a complete account history. + {day(query.from)} through {day(query.to)}. This page shows bounded + recorded activity, not a complete account history.
{!data.canEdit && (diff --git a/tests/e2e/agent-link.spec.ts b/tests/e2e/agent-link.spec.ts index 06bd27a..bea48d7 100644 --- a/tests/e2e/agent-link.spec.ts +++ b/tests/e2e/agent-link.spec.ts @@ -188,7 +188,8 @@ test("the opt-in is off until chosen, and Disconnect unlinks", async ({ await expect(optIn).toBeChecked(); await hydrated(page, "main button"); - await page.getByRole("button", { name: "Disconnect" }).click(); + await page.getByText("Disconnect", { exact: true }).click(); + await page.getByRole("button", { name: "Confirm disconnect" }).click(); await expect( page.getByRole("button", { name: "Connect iMessage" }), diff --git a/tests/e2e/bills.spec.ts b/tests/e2e/bills.spec.ts index 869bbad..940b9cb 100644 --- a/tests/e2e/bills.spec.ts +++ b/tests/e2e/bills.spec.ts @@ -149,9 +149,12 @@ test("tracks variable invoices, partial/full payments, unlinking and manual mark detail(f.page).getByText("Paid from posted activity", { exact: true }), ).toBeVisible(); await detail(f.page) - .getByRole("button", { name: "Unlink payment" }) + .getByText("Unlink payment", { exact: true }) .first() .click(); + await detail(f.page) + .getByRole("button", { name: "Confirm unlink payment" }) + .click(); await expect( detail(f.page).getByText("Partially paid", { exact: true }), ).toBeVisible(); @@ -271,7 +274,10 @@ test("requires explicit payment confirmation and reviews edited or deleted payme await expect( detail(f.page).getByRole("link", { name: "View recorded transaction" }), ).toHaveCount(0); - await detail(f.page).getByRole("button", { name: "Unlink payment" }).click(); + await detail(f.page).getByText("Unlink payment", { exact: true }).click(); + await detail(f.page) + .getByRole("button", { name: "Confirm unlink payment" }) + .click(); await expect( detail(f.page).getByText("Unpaid", { exact: true }), ).toBeVisible(); diff --git a/tests/e2e/budgets.spec.ts b/tests/e2e/budgets.spec.ts index 74432fc..2c73726 100644 --- a/tests/e2e/budgets.spec.ts +++ b/tests/e2e/budgets.spec.ts @@ -221,7 +221,10 @@ test("distinguishes zero from unset, keeps spending after removal and retains in "aria-valuenow", "100", ); - await card(f.page).getByRole("button", { name: "Remove budget" }).click(); + await card(f.page).getByText("Remove budget", { exact: true }).click(); + await card(f.page) + .getByRole("button", { name: "Confirm remove budget" }) + .click(); await expect(figure(card(f.page), "Allocation")).toHaveText("Not set"); await expect(figure(card(f.page), "Spent")).toHaveText("$340.00"); await expect(card(f.page).getByRole("progressbar")).toHaveCount(0); diff --git a/tests/e2e/calendar.spec.ts b/tests/e2e/calendar.spec.ts index e561da5..5b007af 100644 --- a/tests/e2e/calendar.spec.ts +++ b/tests/e2e/calendar.spec.ts @@ -126,7 +126,15 @@ test("opens on today with the account's balance, and adding and removing spendin ).toBeVisible(); await expect(cell(page, today)).toContainText("Bus pass"); - await dayPanel(page).getByRole("button", { name: "Remove Bus pass" }).click(); + // × asks once more, on the same button, before it removes. + const remove = dayPanel(page).getByRole("button", { + name: "Remove Bus pass", + }); + await remove.click(); + await expect(headline(page)).toHaveText("You have $484.00 today."); + await dayPanel(page) + .getByRole("button", { name: "Confirm remove Bus pass" }) + .click(); await expect(headline(page)).toHaveText("You have $500.00 today."); await expect(dayPanel(page).getByText("Bus pass")).toHaveCount(0); @@ -406,6 +414,9 @@ test("plans spending on a later day, sees what it does, and removes it", async ( await dayPanel(page) .getByRole("button", { name: "Remove Concert tickets" }) .click(); + await dayPanel(page) + .getByRole("button", { name: "Confirm remove Concert tickets" }) + .click(); await expect(dayPanel(page).getByText("Concert tickets")).toHaveCount(0); await expect(dayPanel(page).locator(".panel-totals")).toContainText( "$500.00", diff --git a/tests/e2e/pdf-import.spec.ts b/tests/e2e/pdf-import.spec.ts index 5537dbb..3a64702 100644 --- a/tests/e2e/pdf-import.spec.ts +++ b/tests/e2e/pdf-import.spec.ts @@ -146,7 +146,9 @@ test("keeps a preview waiting until it is discarded", async ({ await expect(waiting).toContainText("Everyday ••1234 (360 Checking, PDF)"); await waiting.getByRole("link", { name: "Review" }).click(); await hydrated(page, "form button"); - await page.getByRole("button", { name: "Discard" }).click(); + // Discarding deletes the saved copy, so it asks once more. + await page.getByText("Discard", { exact: true }).click(); + await page.getByRole("button", { name: "Confirm discard" }).click(); await expect(page).toHaveURL(/\/w\/[^/]+\/import$/); await expect( diff --git a/tests/e2e/transactions.spec.ts b/tests/e2e/transactions.spec.ts index 82de7a0..544e8b1 100644 --- a/tests/e2e/transactions.spec.ts +++ b/tests/e2e/transactions.spec.ts @@ -156,6 +156,22 @@ test("filters the list to one account", async ({ browser, baseURL }) => { await expect(page).toHaveURL(/\?account=[0-9a-f-]{36}$/); await expect(row(page, "Electric")).toBeVisible(); await expect(row(page, "Coffee")).toHaveCount(0); + // Adding from the filtered list: Cancel keeps the filter, but the hint's + // links go to Review transfers and Bills themselves. + await page.getByRole("link", { name: "Add a transaction" }).click(); + await expect(page).toHaveURL(/\/transactions\/new\?account=/); + const main = page.getByRole("main"); + await expect( + main.getByRole("link", { name: "Review transfers" }), + ).toHaveAttribute("href", /\/w\/[^/]+\/transactions\/transfers$/); + await expect(main.getByRole("link", { name: "Bills" })).toHaveAttribute( + "href", + /\/w\/[^/]+\/bills$/, + ); + await expect(page.getByRole("link", { name: "Cancel" })).toHaveAttribute( + "href", + /\/transactions\?account=[0-9a-f-]{36}$/, + ); }); test("another user's transaction is not found", async ({