Skip to content

feat(ui): add generation history panel - #19

Merged
prateekchaplot merged 2 commits into
mainfrom
arch/tts/t3.3
Nov 21, 2026
Merged

prateekchaplot merged 2 commits into
mainfrom
arch/tts/t3.3

Conversation

@prateekchaplot

Copy link
Copy Markdown
Owner

Task T3.3 (History) from docs/ARCHITECTURE.md §14.2 (P3 — UI against contracts). Implements FR-08 / AC13: history preview, restore, and individual deletion.

What changed

  • frontend/src/components/HistoryPanel.tsx (new): native <details> disclosure after PlaybackPanel, collapsed by default on narrow viewports (≤ 700 px) per §12. Loads api.listGenerations() on mount and once per terminal current generation that is not already listed.
  • Restore: getGeneration + getAudioBlob → SELECT_HISTORY_ITEM (no SSE, per the T3.1/T3.2 contract). Only succeeded rows are restorable; the restored blob URL is revoked when playback moves on or on unmount.
  • Delete: deleteGeneration → HISTORY_DELETED; disabled for queued/running/cancelling rows (API answers 409 GENERATION_BUSY).
  • App.tsx: replaces the T3.1/T3.2 history placeholder with HistoryPanel.
  • styles.css: additive history/disclosure rules.
  • docs/TASKS.md: T3.3 recorded as Doing with verification, decisions, and frozen downstream labels.

Verification

  • 93 Vitest tests (10 new); ESLint; tsc --noEmit; Prettier (CRLF); live + mock vite build.
  • Mock-mode headless Chromium, 15/15 checks: narrow viewport starts collapsed, summary toggles open, empty state, two entries render preview/voice/<time>, restore loads subtitle text + <audio>, deleting one entry keeps the other, deleting the open entry clears playback, no console errors.
  • 196 pytest; Ruff check/format on src/tts tests; strict mypy; git diff --check.

Decisions

  • Restore does not overwrite input text or voice/rate/volume (§12's SELECT_HISTORY_ITEM only carries detail + audio).
  • Failed/cancelled rows stay visible and deletable but are not restorable; no delete confirmation dialog (T4.2 can add one).
  • The panel's open state is read once at mount from matchMedia; resizing later does not force-collapse it.
  • Mock history is session-only; live persistence and 20-entry eviction remain T4.1's scope.

Shared-file note

App.tsx and styles.css are not owned by T3.3 but received additive edits; T3.1/T3.2 explicitly reserved the history placeholder for this task. contracts.ts, appContext.tsx, api/*, and the mock are untouched (all needed actions/methods already existed).

Frozen downstream

T5.1's AC13 spec can rely on: classes .history-item, .history-preview, .history-meta, .history-actions; aria-label="Open generation: <preview>" / aria-label="Delete generation: <preview>"; count line N saved generation(s); empty state "Nothing here yet. Generate audio and it will appear in this list."

@prateekchaplot
prateekchaplot merged commit dce6ca5 into main Nov 21, 2026
5 checks passed
@prateekchaplot
prateekchaplot deleted the arch/tts/t3.3 branch November 21, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant