Implement client-side threads/comments for track pages#84
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add TypeScript types for Thread, Comment, API responses - Add translation keys (en/fr) for threads - Create GET /api/threads endpoint with cursor-based pagination - Create GET /api/threads/recent endpoint for global feed - Create POST /api/threads endpoint (creates thread via RPC) - Create POST /api/threads/[threadId]/comments endpoint (replies) - Create thread store for client-side state management - Create ThreadList, ThreadItem, ThreadForm components - Wire comments tab into track detail page Co-authored-by: alexisbohns <58178426+alexisbohns@users.noreply.github.com>
- Replace any types with proper types (User, Comment[]) - Rename body to payload for request parsing clarity - Use explicit interface types for parsed JSON bodies Co-authored-by: alexisbohns <58178426+alexisbohns@users.noreply.github.com>
alexisbohns
left a comment
There was a problem hiding this comment.
I don't understand why but I can't log-in with Google anymore. I tried on the Vercel Preview of the PR and it's not working. I'm never logged when I come back from Google. It's perfectly working on another PR's preview. Is there something that can be broken by this PR on authentication?
This PR doesn't modify any authentication-related files. The only files changed are new thread/comment components, API routes, types, stores, translations, and the track page ( The login issue is likely caused by the Vercel preview URL not being included in Google OAuth's authorized redirect URIs. Each preview deployment gets a unique URL, and Google will reject the callback if that URL isn't whitelisted. You may need to add the preview URL pattern (or a wildcard) to your Google OAuth app's authorized redirect URIs and to Supabase's redirect allowlist. |
|
But it would also not work on other Vercel previews. The problem is only on this PR, I can't test it. The wildcard has already been set on Supabase for the redirection. |
Adds thread-based commenting system for track pages: API endpoints, client stores, UI components, and i18n support.
API endpoints (
src/routes/api/threads/)/api/threads?entityType=track&entityId=...&limit=...&cursor=...— Fetch threads for a track with cursor-based pagination on(last_activity_at, id). Returns threads with grouped comments./api/threads/recent?limit=...&cursor=...— Global recent activity feed./api/threads— Create thread + root comment viacreate_thread_with_commentRPC. Validates kind (comment|question), body non-empty, entityId UUID format./api/threads/[threadId]/comments— Post reply to thread. SupportsparentCommentIdfor nested replies.All POST routes require auth. All routes return clean JSON errors, never raw DB errors.
Types (
src/lib/types/threads.ts)Thread,Comment,ThreadWithComments,ThreadsResponse, request/response types for create and reply.Client store (
src/lib/stores/threads.ts)Svelte stores for thread state +
fetchThreads,createThread,postReplyactions that call the API and refresh state.UI components
ThreadList— Renders threads with load-more paginationThreadItem— Thread card: root comment, expandable replies, inline reply formThreadForm— New thread creation with body + kind toggleTrack page integration
Added "Comments" tab to
tracks/[track_id]alongside existing Timeline/Versions/Lyrics tabs.i18n
17 translation keys added to both
en.ymlandfr.ymlunderthreads.*.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.