ai-powered-conversational-intelligence

Chat History — Frontend UI

This covers the UI layer specifically (component architecture, layout, what’s wired to what). For the backend design (tables, API routes, retention/soft-delete semantics), see the existing docs/chat-history-architecture.md and docs/chat-history-search.md — this document doesn’t repeat that content, only what changed on the frontend in this pass and how the pieces fit together.

Corrected assumption, verified against real code

Before this pass, it was easy to assume (and an earlier draft of this project’s own audit initially did) that server-side conversation history was “write-only” — persisted by POST /ask’s side effect but never read back into the UI. That’s false. The frontend genuinely calls the real read APIs:

This is real, tested (indirectly, via Sidebar.test.tsx and the extracted component tests below), and unchanged in this pass — the UI work here reorganizes where this logic is presented, not whether it works.

Component architecture (current)

Sidebar.tsx                    -- history navigation ONLY; owns
  |                                rename-in-progress state and the
  |                                `collapsed` icon-rail render path
  ├── useChatSearch()          -- hook: debounced GET /chat/search,
  |                                falls back to client-side title filter
  |                                when server history isn't active
  ├── ConversationSearch.tsx   -- presentational search input
  ├── ConversationSearchResults.tsx  -- server search results list
  └── ConversationList.tsx     -- recency-grouped list (Today/Yesterday/…)
        └── ConversationListItem.tsx  -- one row: select/rename/delete

Sidebar itself is rendered twice — once persistently in AppShell.tsx (desktop, lg:+, collapsible via the header’s SidebarToggle), once inside MobileNav.tsx’s slide-in Drawer (below lg:, always fully expanded) — the same component both times, distinguished only by an onNavigate callback the mobile drawer passes to close itself after a selection, and an optional collapsed prop the mobile drawer never passes. There is exactly one history-list implementation, not two to keep in sync.

Settings/Theme/Sign out do not live in Sidebar at all — see docs/navigation-and-actions.md for the single-owner UserMenu (header) those actions moved to, and docs/ui-production-audit.md for the duplicated Settings-dialog-plus-Sign-out-button pair (Sidebar footer + header, each independently stateful) this replaced.

What moved, what didn’t

Testing

Each extracted piece has its own test file, using fixture conversations built with the real newHistoryEntry/ConversationSummary types (not loosely-typed mocks):

Known limitations (unchanged from before this pass — not introduced

by it)