[added] Points System #38
Merged
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.