mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-25 03:42:06 +00:00
430872314b
* feat(web): admin modal Settings & overrides tab (TASK-1551) Lifts the inline-expand form into the modal's Settings tab via a new UserSettingsForm.svelte component. Per the plan, this is a parallel implementation — the inline expand in +page.svelte is intentionally left intact so behavior parity can be verified side-by-side before T1555 deletes it. Behaviour parity (all matches the existing inline-expand): - Role selector + promote/demote confirm with separate confirm button - Password reset (email path → "message" string from server; temp-password path → revealed code with a "share via secure channel" hint) - Account disable/enable toggle - Plan selector + structured plan_overrides grid + storage override with shorthand parsing (10 GB / 500 MB / -1 / raw bytes) and the live preview chip - Save button writes plan + plan_overrides in one PATCH; empty overrides → empty-string send (preserves the SetUserPlanOverrides clear path from the inline-expand) New for T1551 — typed-email confirmation on the destructive side of disable (matches the destructive-action confirm pattern called out in the task body). Disable button stays disabled until the typed input matches the user's email exactly; Cancel resets the typed value. Enable side does not require typing (it's reversible). Wiring: - UserModal.svelte gains an optional onUserUpdated callback prop. The Settings form bubbles every successful save through it; the page merges the refetched row into its users[] and the bound modalUser so both UIs (modal + inline-expand) see the same state. - Helpers (parsePlanOverrides, parseStorageInput, formatStorageBytes) are duplicated inside UserSettingsForm for this PR — collapsing back to one home happens in T1555 when the inline expand goes away. Two short-lived copies is cheaper than refactoring a soon-to-be-deleted block. Part of PLAN-1542. * fix: address Codex review on TASK-1551 1. Snapshot user.id at each async handler entry (changeRole, resetPassword, toggleDisable, saveUser) and the email at toggleDisable's entry. If the modal closes/swaps to another user mid-PATCH, the in-flight request now updates the row it was originally targeting rather than whatever user is currently displayed. Mirrors the inline-expand handlers' pattern. 2. Typed-email gate stays trim()-tolerant — paste from various sources often picks up whitespace. The button title and message copy now explicitly say "paste tolerant" so the behavior matches what's documented.
Pad Web UI
SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.
Development
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
activity/ ActivityFeed
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