1.3 KiB
1.3 KiB
Plan 32-04 Summary: Shared Setup Viewer
Status: Complete
Commit: 0b46eff
What was done
-
useSharedSetup hook (
src/client/hooks/useSetups.ts):- Fetches
/api/shared/:tokenwith retry disabled (404 = invalid token) - Returns same SetupWithItems type as other setup hooks
- Fetches
-
Route search params (
src/client/routes/setups/$setupId.tsx):- Added
validateSearchwith Zod schema forsharequery param - Three-way data source: share token > authenticated owner > public viewer
- Added
-
Shared setup banner:
- Blue banner with link icon: "Shared setup" shown when share token present
- Positioned above the sticky header bar
-
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
-
Read-only mode:
showOwnerControlscomputed 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