feat: add shared setup viewer with token detection and read-only mode

Detect ?share=token query param on setup detail page, fetch via
/api/shared/:token, and display read-only view with "Shared setup"
banner. Hide all owner controls (add items, share, delete, classification)
in shared view. Show "Link not available" error for invalid tokens.

Plan: 32-04 (Setup Sharing System - Shared Setup Viewer)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 18:04:41 +02:00
parent a531581623
commit 0b46eff243
2 changed files with 68 additions and 16 deletions

View File

@@ -74,6 +74,15 @@ export function usePublicSetup(setupId: number | null) {
});
}
export function useSharedSetup(token: string | null) {
return useQuery({
queryKey: ["shared-setup", token],
queryFn: () => apiGet<SetupWithItems>(`/api/shared/${token}`),
enabled: !!token,
retry: false,
});
}
export function useCreateSetup() {
const queryClient = useQueryClient();
return useMutation({