Merged
Conversation
This also accounts for unauthenticated users
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the game functionality by integrating Clerk for user management, adding a new finishGame mutation to update user points at the end of a game, and updating the schema and configuration to support a points-based system.
- Integrated Clerk for user management in GameContext.
- Added a finishGame mutation to update user points and update routing upon game completion.
- Updated the user schema, authentication configuration, and upsert mutation to replace currentXP with points.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| convex/users.ts | Replaced currentXP with points in user upsert mutation |
| convex/schema.ts | Updated the user schema field from currentXP to points |
| convex/game.ts | Added finishGame mutation with documentation |
| convex/auth.config.ts | Updated Clerk domain configuration using an environment variable |
| app/(gameplay)/game/_context/GameContext.tsx | Integrated Clerk user retrieval and updated nextRound to use finishGame |
Comments suppressed due to low confidence (2)
convex/game.ts:188
- Consider adding tests for the finishGame mutation to cover both cases when a userID is provided (with and without a matching user) and when no userID is provided.
export const finishGame = mutation({
app/(gameplay)/game/_context/GameContext.tsx:136
- Consider adding tests for the nextRound function to ensure that the finishGame mutation integration and the subsequent routing logic correctly handle the earnedPoints value.
const nextRound = async () => {
divinewton
approved these changes
Mar 26, 2025
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.
This pull request introduces several changes to the
GameContextand related files to enhance user handling and game functionality. The most significant changes include integrating Clerk for user management, adding a mutation to finish the game, and updating the schema to usepointsinstead ofcurrentXP.User Management Enhancements:
app/(gameplay)/game/_context/GameContext.tsx: Integrated Clerk for user management by importinguseUserand fetching the user data usinguseQuery. [1] [2]Game Functionality Improvements:
app/(gameplay)/game/_context/GameContext.tsx: Added a new mutationfinishGameto handle the end of the game, updating the score and routing to the results page. [1] [2]convex/game.ts: Added detailed documentation and implementation for thefinishGamemutation, which updates user points and handles various scenarios based on the presence of a user ID.Configuration and Schema Updates:
convex/auth.config.ts: Updated the Clerk domain to use an environment variable for better configuration management.convex/schema.ts: ReplacedcurrentXPwithpointsin the user schema to reflect the new points system.convex/users.ts: Updated theupsertFromClerkmutation to initialize thepointsfield instead ofcurrentXP.