Skip to content

feat: inject related-documents drawer into preview pages#62

Merged
Svtter merged 3 commits into
mainfrom
worktree-preview-drawer
Jun 13, 2026
Merged

feat: inject related-documents drawer into preview pages#62
Svtter merged 3 commits into
mainfrom
worktree-preview-drawer

Conversation

@Svtter

@Svtter Svtter commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a floating button to HTML preview pages (/s/{id}/) that opens a right-side drawer listing documents that share the same category or project, plus a back-to-home link. Lets you jump between related docs without leaving the preview.

The drawer is injected by the existing InjectMiddleware alongside the live-reload script, so source files are never modified — it only appears when a doc is served through /s/{id}/.

Changes

  • session: GetPeers(sessionID, limit) — queries same-category and same-project peers (excludes self + soft-deleted, ordered by creation desc, capped at 20)
  • server: GET /api/sessions/{id}/peers endpoint
  • live: drawerCSS / drawerHTML / drawerJS constants; injectScript generalized to variadic snippets; CSS namespaced under #sth-drawer-* with !important for isolation

Behavior

  • Floating button (bottom-right) → click → right drawer slides in (320px, overlays content)
  • Drawer data is lazy-fetched on first open and cached for subsequent opens
  • Loading / error (with retry) / empty states handled
  • Non-invasive: original HTML files, downloads, and local-file opens contain zero drawer markup

Verification

  • go vet ./... clean; full go test ./... green
  • New unit tests: 7 in session (peers found/empty/deleted/ordering/limit/not-found), 3 in server (success/empty/not-found), 3 in live (injected into HTML, skipped for CSS + non-preview paths)
  • End-to-end smoke test: uploaded docs sharing category+project → drawer markup present in served HTML, /peers correctly returned peers in both byCategory and byProject; on-disk source file confirmed to have 0 drawer markers while the served page has them

OpenSpec

Planning artifacts under openspec/changes/preview-drawer/ (proposal, design, specs, tasks). This is a lighter-weight precursor to the planned document-relationships change (which adds explicit user-defined edges + a node page).

🤖 Generated with Claude Code

Agent and others added 2 commits June 13, 2026 15:41
Phase 1 planning for a slide-in drawer injected into HTML preview pages:
- GET /api/sessions/{id}/peers returns same-category and same-project docs
- Floating button + right-side drawer injected via existing InjectMiddleware
- Lazy fetch on click, loading/error/empty states, non-invasive to source files

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a floating button to HTML preview pages that opens a right-side
drawer listing documents sharing the same category or project, plus a
back-to-home link. The drawer is injected by InjectMiddleware alongside
the existing live-reload script, so source files remain untouched.

- session: GetPeers(sessionID, limit) queries same-category/same-project
  peers (excludes self + soft-deleted, ordered desc, capped at 20)
- server: GET /api/sessions/{id}/peers endpoint
- live: drawerCSS/drawerHTML/drawerJS constants; injectScript generalized
  to variadic snippets; CSS namespaced with !important for isolation

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sun-praise sun-praise deleted a comment from github-actions Bot Jun 13, 2026
@sun-praise sun-praise deleted a comment from github-actions Bot Jun 13, 2026
Move the completed preview-drawer change to
openspec/changes/archive/2026-06-13-preview-drawer and sync its delta
specs into baseline capabilities under openspec/specs/ (peers-api,
preview-drawer). No code changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

APIError: Authentication Fails, Your api key: ****3097 is invalid

opencode session  |  github run

@github-actions

Copy link
Copy Markdown

APIError: Authentication Fails, Your api key: ****3097 is invalid

opencode session  |  github run

@Svtter Svtter merged commit 954c07c into main Jun 13, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant