Skip to content

feat(annotations): non-modal, draggable, multi-thread reading companion#7

Merged
ijbo merged 1 commit into
mainfrom
feat/reading-companion-threads
Jun 23, 2026
Merged

feat(annotations): non-modal, draggable, multi-thread reading companion#7
ijbo merged 1 commit into
mainfrom
feat/reading-companion-threads

Conversation

@ijbo

@ijbo ijbo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Reworks the annotation "Ask AI" thread panel from a single anchored modal into a reading companion — so you can keep reading and ask in parallel, exactly as requested.

Before: the panel was modal (blocked the text behind it), one-at-a-time (opening a second closed the first), and couldn't be moved.

Changes

1. Non-modal + draggable

  • Removed the full-screen backdrop from the Q&A path — the document stays readable and scrollable.
  • Panels are draggable by their header (new grip handle), with cascade positioning and click-to-front.

2. Multiple threads in parallel

  • Each annotation opens its own panel; opening another no longer closes the previous.
  • Per-conversation state (streaming, web-search, attachments, model) moved from module globals onto each panel element, so threads stream concurrently without clobbering.

3. Right-side Threads dock

  • An optional right rail holds docked threads as stacked cards; the document column reflows away from it (mirrors the existing AI-panel reflow) so nothing overlaps the text.
  • Live thread count; collapses when empty; any thread toggles between floating ↔ docked via a header button. Full-width on mobile.

Verified live (browser preview)

  • Two annotations → two parallel panels, 0 modal overlays
  • Cascade offset + z-index bring-to-front ✅
  • Header drag moves a floating panel ✅
  • Dock in → document reflows (app-container shrinks by the dock width); pop-out → restores ✅
  • Close → cleanup + width restored ✅

Quality

  • Vite build clean; smoke suite 22/22.
  • Refactored the drag handlers to a single shared document listener (not per-panel) to avoid listener accumulation.
  • ESLint: no new errors (pre-existing no-useless-assignment warnings untouched).

Honest limitation

Parallel threads share the globally-selected AI model — switching a panel's model switches the active model — because the local inference backend runs one model at a time. The UI supports independent threads; true per-thread concurrent models would need backend work.

🤖 Generated with Claude Code

Rework the annotation Ask-AI thread panel from a single anchored modal into a
"reading companion": non-modal floating panels you can drag, multiple open at
once, plus an optional right-side dock the document reflows around.

- per-panel state (was module globals) so threads stream in parallel
- non-modal: no backdrop, document stays readable; opening a 2nd keeps the 1st
- draggable by header; cascade + bring-to-front; single shared drag controller
- right-side Threads dock with document reflow + live count; dock<->float toggle

Verified live: 2 parallel panels, drag, dock reflow, pop-out, cleanup.
Build clean; smoke 22/22.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ijbo ijbo merged commit 6ad9754 into main Jun 23, 2026
4 checks passed
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