90 lines
3.7 KiB
Markdown
90 lines
3.7 KiB
Markdown
---
|
|
id: "03-send-now-queue-controls"
|
|
title: "Add Send Now queue controls"
|
|
status: done
|
|
wave: 3
|
|
depends_on: ["02-replacement-turn-dispatch"]
|
|
plan: "plan.md"
|
|
spec: "../../specs/ui/message-queue-send-now.md"
|
|
---
|
|
|
|
# Task 03: Add Send Now queue controls
|
|
|
|
## Intent
|
|
|
|
Expose the new action through the shared queue API/hook and add accessible row
|
|
and header controls that work through hover/focus on desktop and direct touch on
|
|
coarse-pointer layouts.
|
|
|
|
## Acceptance
|
|
|
|
1. The API and hook send the exact `entry`/`all` payloads, map stable errors,
|
|
and refetch authoritative queue state after every result.
|
|
2. Every row exposes hover/focus **Send Now** on fine pointers and an always-
|
|
visible 44px touch control on coarse pointers; header **Send Now** appears
|
|
immediately before **Clear all** and sends the whole snapshot.
|
|
3. Duplicate actions are disabled during local loading or authoritative
|
|
cancellation, all new copy is localized, and the narrow header wraps without
|
|
adding another scroll owner or horizontal overflow.
|
|
|
|
## Files likely touched
|
|
|
|
- `apps/web/lib/api/domains/queue-api.ts`
|
|
- `apps/web/lib/api/domains/queue-api.test.ts`
|
|
- `apps/web/hooks/domains/session/use-queue.ts`
|
|
- `apps/web/hooks/domains/session/use-queue.test.ts`
|
|
- `apps/web/components/task/chat/queued-ghost-list.tsx`
|
|
- `apps/web/components/task/chat/queued-ghost-list.test.tsx`
|
|
- `apps/web/components/task/chat/queued-ghost-message.tsx`
|
|
- `apps/web/components/task/chat/queued-ghost-message.test.tsx`
|
|
- `apps/web/src/locales/en/chat.json`
|
|
- pseudo-locale catalog output if regenerated by the repository script
|
|
|
|
## Dependencies
|
|
|
|
- Task 02 WebSocket request, response, and error contract.
|
|
|
|
## Parallelism
|
|
|
|
Sequential. It owns the shared frontend surface required by both E2E scenarios.
|
|
|
|
## Inputs
|
|
|
|
- Spec: What, API Surface, Responsive and Mobile Behavior.
|
|
- Plan: Frontend and Responsive and Mobile Contract.
|
|
- Nearest mobile exemplar:
|
|
`apps/web/e2e/tests/chat/mobile-message-queue-management.spec.ts`.
|
|
- Existing patterns: `drainQueuedMessage`, `useQueuePanelHandlers`,
|
|
`RowActions`, and session `cancellation_pending` selectors.
|
|
|
|
## Verification
|
|
|
|
Bootstrap once if this worktree has no dependencies:
|
|
|
|
```bash
|
|
cd apps && pnpm install --frozen-lockfile
|
|
```
|
|
|
|
Then run:
|
|
|
|
```bash
|
|
cd apps && pnpm --filter @kandev/web test -- --run lib/api/domains/queue-api.test.ts hooks/domains/session/use-queue.test.ts components/task/chat/queued-ghost-message.test.tsx components/task/chat/queued-ghost-list.test.tsx
|
|
cd apps/web && pnpm run typecheck
|
|
cd apps && pnpm --filter @kandev/web run lint
|
|
cd apps && pnpm --filter @kandev/web run i18n:ratchet && pnpm --filter @kandev/web run i18n:check
|
|
```
|
|
|
|
## Output contract
|
|
|
|
Report files changed, desktop/mobile interaction details, RED and GREEN test
|
|
commands/results, typecheck/lint/i18n outcomes, rendered verification evidence
|
|
or its exact blocker, risks, and synchronize this task plus `plan.md`
|
|
status/results.
|
|
|
|
## Results
|
|
|
|
- Added typed `sendQueuedNow` API errors, exact entry/all payloads, authoritative refetches on every result, and `sendEntryNow`/`sendAllNow` queue-hook actions with loading and cancellation guards.
|
|
- Added localized row and header Send Now controls. Desktop row actions use hover/focus reveal, coarse-pointer layouts keep 44px controls visible, the header order is Run next / Send Now / Clear all / collapse, and the action group wraps without adding a scroll owner.
|
|
- GREEN: focused queue API/hook/list/message suite — 4 files, 97 tests passed; `cd apps/web && pnpm run typecheck` passed; full web lint passed; `i18n:pseudo`, `i18n:check`, and `i18n:ratchet` passed.
|
|
- Missing/raced entries reconcile through the authoritative queue state and show focused localized feedback; no optimistic removal is retained.
|