2027ee2545
Original task: deleting a note (and a label from the manage-labels menu)
showed the browser's native confirm() with the raw Repl hostname,
clashing with the rest of the app. Switch both call sites to the
project's existing AlertDialog component, matching the pattern used in
FoldersRail and SendNoteDialog.
Changes
- artifacts/tx-os/src/pages/notes.tsx
- NoteCard: add `confirmDeleteOpen` state; render AlertDialog as a
Fragment sibling of the clickable card (not a child) so React's
portal event bubbling cannot trigger the card's onEdit handler when
the user interacts with the dialog. Also stopPropagation on the
trash button itself.
- LabelsDialog: add `pendingDeleteLabel` state and a sibling
AlertDialog inside the Dialog root. Both dialogs use existing
locale keys (notes.deleteConfirm, notes.deleteLabelConfirm,
notes.delete, common.cancel) — no new strings needed.
- Add data-testids: note-card-delete-{id}, note-delete-dialog-{id},
note-delete-confirm-{id}, label-delete-{id},
label-delete-dialog-{id}, label-delete-confirm-{id},
notes-manage-labels-open.
Tests
- artifacts/tx-os/tests/notes-delete-confirm.spec.mjs (new)
- Note delete: cancel keeps the card, confirm fires DELETE and
removes the card. Deliberately does NOT register a `dialog` event
handler — a native confirm would hang the test.
- Label delete: open manage-labels, create a label via the UI, click
trash, confirm, assert DELETE /api/note-labels/{id}.
Verification
- pnpm --filter @workspace/tx-os exec tsc --noEmit: clean.
- pnpm --filter @workspace/tx-os test:e2e -- notes-delete-confirm:
2 passed.
- Architect code review surfaced a real bubble-through risk on the
card's onClick={onEdit}; fixed by lifting the AlertDialog to a
Fragment sibling.
Out of scope (not changed): native confirm()/alert() outside the Notes
page. (executive-meetings.tsx already uses an in-app `confirm({...})`
modal, not the native browser dialog.)