feat: add bookmarks to events and bookmark page - #5
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (3)
WalkthroughAdds a bookmark feature: UI button and page, client-side integration with Convex queries/mutations, and backend interaction/schema changes to store and query user bookmarks and interactions. Changes
Sequence DiagramsequenceDiagram
participant User
participant UI as BookmarkButton (client)
participant Auth
participant Convex as Convex API
participant DB as Database
User->>UI: Click bookmark icon
UI->>Auth: Ensure authenticated
alt unauthenticated
Auth->>User: Prompt sign-in
else authenticated
UI->>Convex: toggleBookmark(eventId)
Convex->>DB: Read recent interactions for user/event
alt recent toggle found
Convex->>DB: Insert patch entry (unbookmark/bookmark)
else no recent toggle
Convex->>DB: Insert new bookmark interaction
end
Convex-->>UI: {bookmarked: true|false}
UI->>Convex: invalidate/refresh isEventBookmarked query
Convex->>DB: Query latest bookmark state
Convex-->>UI: updated status
UI->>User: Update icon, aria-pressed, show toast
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/components/bookmark-button.tsx`:
- Line 72: The ternary in the BookmarkButton component is redundant—both
branches return "icon"—so replace size={size === "sm" ? "icon" : "icon"} with a
single explicit value or the actual prop: if the control should always be the
icon size, use size="icon"; if it should vary with the incoming prop, use
size={size} (or map size to the correct tokens). Update the occurrence in
bookmark-button.tsx (the component using the size prop) accordingly.
In `@packages/backend/convex/interactions.ts`:
- Around line 115-121: The query that builds bookmarks
(ctx.db.query("interactions").withIndex("by_user_type", q => q.eq("userId",
user._id).eq("type", "bookmark")).order("desc").collect()) relies on Convex's
default ordering by _creationTime for the descending/newest-first result; add a
concise inline comment next to this call (or above where bookmarks is defined)
stating that .order("desc") orders by _creationTime (newest first) so future
readers know this is implicit and intentionally used.
- Around line 10-11: The function requireUserId currently types ctx as any;
replace that with the proper Convex server context type and remove the cast when
calling authComponent.safeGetAuthUser: import the appropriate Convex context
type (e.g., QueryContext or MutationContext) from "convex/server" and change the
signature to async function requireUserId(ctx: QueryContext) (or MutationContext
/ a union that matches where this function is used), or if
authComponent.safeGetAuthUser requires extra fields, declare a small interface
(e.g., interface AuthCtx extends QueryContext { auth: AuthType }) and use that
type for ctx; then call authComponent.safeGetAuthUser(ctx) without the as any
cast so TypeScript enforces correctness for requireUserId and
authComponent.safeGetAuthUser.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
apps/web/src/routeTree.gen.tsis excluded by!**/routeTree.gen.tspackages/backend/convex/_generated/api.d.tsis excluded by!**/_generated/**,!**/_generated/**
📒 Files selected for processing (7)
apps/web/src/components/bookmark-button.tsxapps/web/src/components/feed/event-card.tsxapps/web/src/components/header.tsxapps/web/src/routes/bookmarks.tsxapps/web/src/routes/event.$slug.tsxpackages/backend/convex/interactions.tspackages/backend/convex/schema.ts
This was referenced Mar 1, 2026
Merged
This was referenced Apr 25, 2026
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit