Skip to content

Conversation

@DylanDevelops
Copy link
Owner

This pull request introduces several changes to the GameContext and 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 use points instead of currentXP.

User Management Enhancements:

Game Functionality Improvements:

  • app/(gameplay)/game/_context/GameContext.tsx: Added a new mutation finishGame to 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 the finishGame mutation, 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: Replaced currentXP with points in the user schema to reflect the new points system.
  • convex/users.ts: Updated the upsertFromClerk mutation to initialize the points field instead of currentXP.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 divinewton merged commit 28c5651 into main Mar 26, 2025
4 checks passed
@divinewton divinewton deleted the points-system branch March 26, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants