Files
pad/web/README.md
T
xarmian d24df55670 refactor(web): delete unmounted components carrying real logic (TASK-2632) (#1163)
A one-shot sweep, not a standing process. Two dead components had been found
incidentally in one week, each discovered only because someone was about to
change behaviour it appeared to depend on -- VersionHistory during BUG-2608
(its apparent liveness would have blocked a default history limit) and
EditorToolbar before it. Retired UI left in-tree costs every future reader who
greps for a component, finds a plausible implementation, and reasons about
behaviour nobody mounts; it also silently constrains fixes.

Instrument, two passes over all 110 components under web/src/lib/components:

1. Plain substring grep of each basename across web/src + web/e2e. Four
   zero-hit. This pass counts COMMENTS as liveness, so it under-reports
   deadness -- conservative in the safe direction.
2. Import/mount-only regex (a from-import of the .svelte path, a dynamic
   import of it, or a <Name element). Six zero-hit; the two extras were
   exactly the comment-shadowed cases pass 1 could not see.

Controls: a known-live component (BacklinksPanel) resolves to its single
consumer under both passes; each of the six candidates then took a repo-wide
plain grep with no include filters, and every surviving hit was read. Pass 2's
one known blind spot -- a component referenced only by vi.mock(path) -- was
checked by enumerating every vi.mock target ending in .svelte; all are
.svelte.ts store/service modules except CommentEditor, which is independently
imported. None of the six is in that set.

Deleted (six dead, two cascade orphans):

- activity/ActivityFeed.svelte -- a live /activity route page and
  TimelineActivityCard both exist; neither touches it.
- charts/LineChart.svelte and charts/layers/Lines.svelte -- from the TASK-1632
  LayerCake library; only BarChart reached the insights pages. Lines had
  exactly one consumer (LineChart), so it falls with it. AxisX/AxisY stay:
  shared with BarChart.
- charts/Sparkline.svelte (TASK-1638) -- its only repo-wide reference was a
  prose comment recording that PLAN-1542 chose not to show it. Zero mounts.
- editor/MermaidRenderer.svelte -- superseded by the MermaidCodeBlock NodeView
  in Editor.svelte, which owns the render queue, toggle and error state.
- versions/VersionHistory.svelte -- the BUG-2608 find. The live path is
  ItemTimeline to TimelineVersionCard to DiffView; DiffView stays.
- attachments/fixtures/LightboxStub.svelte and fixtures/lightboxStub.ts -- a
  pair that referenced only each other. Their last consumer was removed by the
  TASK-2489 atomic cutover, so they were orphaned rather than born dead.

Nothing was reclassified live-but-obscure, so no import-site comments were
owed. Two docs updated so no artifact points at a deleted file: the web README
component tree drops the activity/ line, and the UserOverviewTab comment now
says the Sparkline component was deleted here and is recoverable from history,
rather than leaving a dangling decision record.

Git history is the archive; anything worth resurrecting is one revert away.

Claude-Session: https://claude.ai/code/session_017jD6t1zjxGSq47SQpZfp1V
2026-08-19 11:39:39 -04:00

63 lines
2.3 KiB
Markdown

# Pad Web UI
SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.
## Development
```bash
npm install
npm run dev # Dev server at localhost:5173 (proxies API to localhost:7777)
npm run build # Production build to build/
npm run check # Type checking with svelte-check
```
When developing, run the Go backend separately with `make dev` from the project root.
## Building for Production
**Do not build in isolation.** Always use `make build` from the project root — this builds the web frontend, then compiles the Go binary with the build output embedded via `//go:embed`.
## Stack
- **Svelte 5** with runes (`$state`, `$derived`, `$effect`)
- **SvelteKit 2** with `adapter-static` (SPA mode)
- **Tiptap** block editor with markdown round-trip
- **svelte-dnd-action** for drag-and-drop in board/list views
- **SSE** for real-time updates
- **TypeScript** throughout
## Structure
```
src/
routes/ SvelteKit pages
+layout.svelte App shell (sidebar + main)
+page.svelte Landing/redirect
[workspace]/
+page.svelte Dashboard (collections, phases, activity)
+layout.svelte SSE connection per workspace
[collection]/
+page.svelte Collection view (board/list)
[collection]/[item]/
+page.svelte Item detail + editor
conventions/ Purpose-built conventions page
playbooks/ Purpose-built playbooks page
settings/ Workspace settings
lib/
api/client.ts HTTP API client
components/
layout/ Sidebar, navigation
editor/ Tiptap editor, raw markdown editor
fields/ FieldEditor, relation picker
items/ ItemCard, ItemDetail
collections/ BoardView, ListView
common/ StatusBadge, badges, modals
search/ CommandPalette
stores/ Svelte 5 reactive stores
workspace.svelte.ts Workspace state
collections.svelte.ts Collection + item state
ui.svelte.ts Sidebar, mobile state
types/index.ts TypeScript types and constants
app.css Global styles and design tokens
```