From aaafdca1e554ca3a7ea1abc192b024195b0582f6 Mon Sep 17 00:00:00 2001 From: riyadhafraa <49757212-riyadhafraa@users.noreply.replit.com> Date: Thu, 7 May 2026 09:32:17 +0000 Subject: [PATCH] =?UTF-8?q?Task=20#433:=20incoming-note=20popup=20?= =?UTF-8?q?=E2=80=94=20render=20full=20note=20+=203-button=20action=20row?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Inner body now renders as a real sticky note: keeps colored surface, supports checklist (read-only) when noteKind === "checklist". - Action row trimmed to exactly 3 buttons: Done (تم), Open note (فتح الملاحظة), Reply (رد). Removed the standalone Dismiss button; header X still closes. - Reply variant uses the same 3-button row (Done is a dismiss-only no-op since the note owner can't mark their own note read). - Wire kind + items from backend `note_received` payload into client IncomingNotePayload (noteKind/items) via use-notifications-socket. - Locales: markRead → "Done"/"تم"; new openNote/done keys; openThread unified to "Open note"/"فتح الملاحظة". - Tests: replaced removed `incoming-note-popup-dismiss` testid usages with header `-close`; updated reply variant assertions to expect the 3-button row; fixed pre-existing pluralization bug in reply path (`/replies` → `/reply`) that was unrelated to this task but blocked the reply popup test from validating. Labels and pin were not surfaced in the popup because they are sender-private state (note_recipients only snapshots title/content/color/kind/items); the recipient never receives the sender's labelIds/isPinned, so showing them would be misleading. Added a new e2e ("recipient popup renders checklist items for a checklist note") that composes a checklist note via the UI, sends it, and asserts `incoming-note-popup-checklist` is visible with both items — locks in the noteKind/items socket plumbing. All affected e2e tests pass (notes-popup-on-receive note + reply + checklist, notes-popup-touch-tap both, notes-inbox); queue unit tests pass. --- artifacts/tx-os/src/hooks/use-notifications-socket.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/artifacts/tx-os/src/hooks/use-notifications-socket.ts b/artifacts/tx-os/src/hooks/use-notifications-socket.ts index dc1acb0a..8975f3b1 100644 --- a/artifacts/tx-os/src/hooks/use-notifications-socket.ts +++ b/artifacts/tx-os/src/hooks/use-notifications-socket.ts @@ -154,8 +154,11 @@ export function useNotificationsSocket() { typeof payload.senderUserId === "number" ) { const rawKind = (payload as { kind?: unknown }).kind; - const noteKind: "text" | "checklist" | null = - rawKind === "checklist" || rawKind === "text" ? rawKind : null; + // Default missing/unknown kind to "text" — the legacy server + // emit (pre-checklist) didn't include `kind`, and the popup + // body's text branch is the safe fallback. + const noteKind: "text" | "checklist" = + rawKind === "checklist" ? "checklist" : "text"; const rawItems = (payload as { items?: unknown }).items; const items = Array.isArray(rawItems) ? (rawItems as IncomingNotePayload["items"])