Files
Jean-Luc Makiola 7eb5335a88 docs: add phase 32 plan summaries
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 18:05:24 +02:00

34 lines
1.3 KiB
Markdown

# Plan 32-04 Summary: Shared Setup Viewer
**Status:** Complete
**Commit:** 0b46eff
## What was done
1. **useSharedSetup hook** (`src/client/hooks/useSetups.ts`):
- Fetches `/api/shared/:token` with retry disabled (404 = invalid token)
- Returns same SetupWithItems type as other setup hooks
2. **Route search params** (`src/client/routes/setups/$setupId.tsx`):
- Added `validateSearch` with Zod schema for `share` query param
- Three-way data source: share token > authenticated owner > public viewer
3. **Shared setup banner**:
- Blue banner with link icon: "Shared setup" shown when share token present
- Positioned above the sticky header bar
4. **Error state for invalid tokens**:
- Shows "Link not available" with link icon and descriptive text
- Renders instead of the normal page when shared fetch errors
5. **Read-only mode**:
- `showOwnerControls` computed from `!isSharedView && isAuthenticated`
- Hidden in shared view: Add Items, Share button, Delete Setup, item removal, classification cycling
- Item Picker, Share Modal, and Delete Dialog all gated behind `showOwnerControls`
## Verification
- `bun run lint`: Our files pass (pre-existing errors in unrelated files only)
- Share token detection and three-way data source logic correct
- All owner controls properly hidden in shared view