From 1e4e096fbad1264372c23c5cbc48cb329ca8810c Mon Sep 17 00:00:00 2001 From: ehonis Date: Mon, 16 Nov 2026 15:00:19 -0500 Subject: [PATCH] Snooze a task from its row in the chats panel Published from the private repository by oss-sync. - Snooze a task from its row in the chats panel 3 files changed, 34 insertions(+), 6 deletions(-) --- docs/chat.md | 5 +++-- web/src/work/TaskCard.test.tsx | 18 ++++++++++++++++++ web/src/work/TasksPanel.tsx | 17 +++++++++++++---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/docs/chat.md b/docs/chat.md index 05204f6..7986ff2 100644 --- a/docs/chat.md +++ b/docs/chat.md @@ -1327,8 +1327,9 @@ moves between a task and any of its chats (`web/src/work/`). in `App.tsx`). Esc, × or the backdrop close it; focus goes back where it was. On a phone it is a sheet from the bottom. - The count beside a task unfolds its chats; the "…" has Edit task…, New chat, Move to - folder… and Mark done. + The count beside a task unfolds its chats. On hover (always on a phone) a local task's + row has Snooze (zzz: the Tasks page's snooze menu, with Undo on the toast), New chat + and "…", which has Edit task…, New chat, Move to folder… and Mark done. - **Live with the Tasks page.** The panel and the page keep their own copies of the list, so each tells the other when it changes something (`web/src/todos/bus.ts`: `announcing` wraps every call that writes; `onTasksChanged` reads again, once per burst, diff --git a/web/src/work/TaskCard.test.tsx b/web/src/work/TaskCard.test.tsx index f4f4a60..5198493 100644 --- a/web/src/work/TaskCard.test.tsx +++ b/web/src/work/TaskCard.test.tsx @@ -11,6 +11,7 @@ import ToastHost from '../components/ToastHost' import type { SheetFeed, Todo } from '../todos/types' import TaskCardHost, { PinnedTask } from './TaskCard' import TaskBar from './TaskBar' +import TasksPanel from './TasksPanel' import { closeTaskCard, installTaskNav, openTaskCard } from './card' import { createTask } from './state' @@ -266,3 +267,20 @@ describe('the chat’s pinned task', () => { }) function last(list: T[]) { return list[list.length - 1] } + +describe('the chats panel’s task rows', () => { + it('snooze a task from its row in one click, with Undo', async () => { + const user = userEvent.setup() + render(<> {}} />) + await user.click(await screen.findByRole('button', { name: 'Snooze “Call the bank”' })) + await user.click(await screen.findByRole('menuitem', { name: /Tomorrow/ })) + const tomorrow = new Date(2026, 10, 10, 9, 0, 0).toISOString() + await waitFor(() => expect(sent('PATCH', /\/api\/todos\/today$/)[0]?.body).toEqual({ snoozedUntil: tomorrow })) + await waitFor(() => expect(screen.queryByRole('button', { name: 'Snooze “Call the bank”' })).toBeNull()) + expect(screen.queryByRole('menu')).toBeNull() + await user.click(await screen.findByRole('button', { name: 'Undo' })) + await waitFor(() => expect(sent('PATCH', /\/api\/todos\/today$/)[1]?.body).toEqual({ snoozedUntil: null })) + // A sheet row cannot be snoozed, so it gets no button. + expect(screen.queryByRole('button', { name: /Snooze “Order banner stands”/ })).toBeNull() + }) +}) diff --git a/web/src/work/TasksPanel.tsx b/web/src/work/TasksPanel.tsx index 8b42042..0e99a45 100644 --- a/web/src/work/TasksPanel.tsx +++ b/web/src/work/TasksPanel.tsx @@ -6,14 +6,16 @@ import { ThreadItem } from '../chat/ThreadList' import { TI, useDismiss, usePopoverPlacement } from '../chat/ui' import { IconArrowsSort, IconChevronDown, IconChevronRight, IconCircle, IconCircleCheck, IconDots, IconEdit, IconExternalLink, - IconFolder, IconPlus, IconSearch, IconTable, IconX, IconCheck, IconUser, IconAdjustmentsHorizontal, + IconFolder, IconPlus, IconSearch, IconTable, IconX, IconCheck, IconUser, IconAdjustmentsHorizontal, IconZzz, } from '../chat/icons' import { useThreadTaskDrop } from '../chat/dnd' import { pushToast } from '../toast' import { parseQuickAdd } from '../todos/parse' +import { SnoozeMenu } from '../todos/TaskMenus' +import '../todos/todos.css' import { buildWork, dueLabel, folderOf, type WorkGroup, type WorkGroupBy, type WorkRow, type WorkShow, type WorkSort } from './groups' import { FolderPicker } from './pickers' -import { completeTask, createTask, findTask, setTaskFolder, taskHome, useWork } from './state' +import { completeTask, createTask, findTask, setTaskFolder, snoozeTask, taskHome, useWork } from './state' import { openTaskCard, useTaskCard } from './card' import { folderNames, PERSONAL } from '../todos/folders' import './work.css' @@ -23,7 +25,7 @@ import './work.css' // is filed under (the same folders the Tasks page shows; unfiled is Personal), // each with the chats that work on it right below. A click on a task opens its // card (TaskCard.tsx), where every setting is edited; the count beside it unfolds -// its chats. +// its chats. A local task's row also snoozes it in one click (the zzz on hover). const VIEW_KEY = 'totem.work.view' const FOLDED_KEY = 'totem.work.folded' @@ -153,7 +155,9 @@ function TaskRow({ row, open, onToggle, onOpenChat, activeId, runs }: { const { task, chats } = row const [menu, setMenu] = useState(false) const [filing, setFiling] = useState(false) + const [snoozing, setSnoozing] = useState(false) const moreRef = useRef(null) + const snoozeRef = useRef(null) // The folder picker hangs off the row: the "…" it came from hides once the menu closes. const rowRef = useRef(null) const projects = useChat((s) => s.projects) @@ -176,7 +180,7 @@ function TaskRow({ row, open, onToggle, onOpenChat, activeId, runs }: { const openChat = (id: string) => { setActive(id); onOpenChat() } return (
-
+
{task.kind === 'local' ? ( )}
+ {task.todo && }
{menu && setMenu(false)} onNewChat={newChat} onFile={() => setFiling(true)} onEdit={() => openTaskCard(task.ref)} />} + {snoozing && task.todo && setSnoozing(false)} + onSnooze={(until) => void snoozeTask(task.ref, until)} onWake={() => void snoozeTask(task.ref, null)} + />} {filing && setFiling(false)} value={folder} noneLabel={PERSONAL} noneIcon="person" label={`File “${task.title}”`}