Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment on lines +1330 to +1332

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document the new row action in AGENTS.md

This adds user-visible snooze and Undo behavior to the Tasks panel, but the Tasks panel entry in the operating manual remains unchanged. Add the row action and its behavior to AGENTS.md in this commit so the repository's required source of operational guidance stays accurate.

AGENTS.md reference: AGENTS.md:L10-L13

Useful? React with 👍 / 👎.

- **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,
Expand Down
18 changes: 18 additions & 0 deletions web/src/work/TaskCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -266,3 +267,20 @@ describe('the chat’s pinned task', () => {
})

function last<T>(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(<><TasksPanel onOpenChat={() => {}} /><ToastHost /></>)
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()
})
})
17 changes: 13 additions & 4 deletions web/src/work/TasksPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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<HTMLButtonElement>(null)
const snoozeRef = useRef<HTMLButtonElement>(null)
// The folder picker hangs off the row: the "…" it came from hides once the menu closes.
const rowRef = useRef<HTMLDivElement>(null)
const projects = useChat((s) => s.projects)
Expand All @@ -176,7 +180,7 @@ function TaskRow({ row, open, onToggle, onOpenChat, activeId, runs }: {
const openChat = (id: string) => { setActive(id); onOpenChat() }
return (
<div className={`wk-task ${open ? 'open' : ''} ${drop.over ? 'drop-over' : ''}`} {...drop.props}>
<div ref={rowRef} className={`vc-thread wk-task-row ${holdsActive && !open ? 'active' : ''} ${draftFor === task.ref || carded ? 'active' : ''} ${menu ? 'menu-open' : ''}`}>
<div ref={rowRef} className={`vc-thread wk-task-row ${holdsActive && !open ? 'active' : ''} ${draftFor === task.ref || carded ? 'active' : ''} ${menu || snoozing ? 'menu-open' : ''}`}>
{task.kind === 'local'
? (
<button type="button" className={`wk-check prio-${task.priority}`} onClick={() => completeTask(task.ref)} aria-label={`Mark “${task.title}” done`} title="Mark done">
Expand All @@ -196,11 +200,16 @@ function TaskRow({ row, open, onToggle, onOpenChat, activeId, runs }: {
</button>
)}
<div className="wk-task-acts">
{task.todo && <button ref={snoozeRef} type="button" className="vc-thread-act" onClick={() => setSnoozing((v) => !v)} aria-label={`Snooze “${task.title}”`} title="Snooze" aria-haspopup="menu" aria-expanded={snoozing}><TI icon={IconZzz} size={15} /></button>}
<button type="button" className="vc-thread-act wk-act-new" onClick={newChat} aria-label="New chat for this task" title="New chat for this task"><TI icon={IconPlus} size={15} /></button>
<button ref={moreRef} type="button" className="vc-thread-act" onClick={() => setMenu((v) => !v)} aria-label="More" title="More"><TI icon={IconDots} size={15} /></button>
</div>
</div>
{menu && <RowMenu row={row} anchor={moreRef} onClose={() => setMenu(false)} onNewChat={newChat} onFile={() => setFiling(true)} onEdit={() => openTaskCard(task.ref)} />}
{snoozing && task.todo && <SnoozeMenu
anchor={snoozeRef.current} now={now} todo={task.todo} onClose={() => setSnoozing(false)}
onSnooze={(until) => void snoozeTask(task.ref, until)} onWake={() => void snoozeTask(task.ref, null)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep keyboard focus in the task list after snoozing

When a keyboard user selects a snooze option, snoozeTask synchronously marks the task hidden, so this row and its focused snooze anchor unmount before the shared Menu cleanup can restore focus. Focus therefore falls back to the document body, forcing the user to tab through the panel again; move focus to the next or previous task row before applying the snooze, as the Tasks page does for rows that leave its list.

Useful? React with 👍 / 👎.

/>}
{filing && <FolderPicker
open anchor={rowRef} onClose={() => setFiling(false)}
value={folder} noneLabel={PERSONAL} noneIcon="person" label={`File “${task.title}”`}
Expand Down
Loading