Skip to content

feat(leaderboard): add next WPM pace caret modes (@torturado)#8236

Open
torturado wants to merge 8 commits into
monkeytypegame:masterfrom
torturado:master
Open

feat(leaderboard): add next WPM pace caret modes (@torturado)#8236
torturado wants to merge 8 commits into
monkeytypegame:masterfrom
torturado:master

Conversation

@torturado

Copy link
Copy Markdown
Contributor

Description

Adds next and nextDaily pace caret modes. These modes retrieve the next distinct WPM value from the all-time or daily leaderboard and use it as the target pace.

The backend adds the required leaderboard routes, DAL queries, daily leaderboard validation, contracts, and controller tests. The frontend exposes the new settings and validates them against the current test mode and server
configuration.

When the Settings page loaded before the asynchronous server configuration request completed, nextDaily could remain hidden for the entire session. PaceCaret now subscribes to the server configuration query so the option appears
once the configuration is available.

Checks

  • Adding quotes?
    • Make sure to follow the quotes documentation
    • Make sure to include translations for the quotes in the description (or another comment) so we can verify their content.
  • Adding a language?
    • Make sure to follow the languages documentation
    • Add language to packages/schemas/src/languages.ts
    • Add language to exactly one group in frontend/src/ts/constants/languages.ts
    • Add language json file to frontend/static/languages
  • Adding a theme?
    • Make sure to follow the themes documentation
    • Add theme to packages/schemas/src/themes.ts
    • Add theme to frontend/src/ts/constants/themes.ts
    • (optional) Add theme css file to frontend/static/themes
    • Add some screenshots of the theme, especially with different test settings (colorful, flip colors) to your pull request
  • Adding a layout?
    • Make sure to follow the layouts documentation
    • Add layout to packages/schemas/src/layouts.ts
    • Add layout json file to frontend/static/layouts
  • Adding a font?
    • Make sure to follow the fonts documentation
    • Add font file to frontend/static/webfonts
    • Add font to packages/schemas/src/fonts.ts
    • Add font to frontend/src/ts/constants/fonts.ts
  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard.
  • Make sure to include my GitHub username prefixed with @ inside parentheses at the end of the PR title.

- Implemented `getNextLeaderboardWpm` and `getNextDailyLeaderboardWpm` functions in the leaderboard controller.
- Added corresponding routes for `/leaderboards/next` and `/leaderboards/daily/next`.
- Updated DAL to fetch the next WPM based on user entries.
- Enhanced tests to cover authentication and response scenarios for the new endpoints.
- Introduced new pace caret options for "next" and "nextDaily" in the frontend configuration.
- Added `useQuery` to fetch server configuration in the `PaceCaret` component.
- Updated `isPaceCaretModeAvailable` and `hasDailyLeaderboard` functions to utilize server configuration data.
- Enhanced filtering logic for pace caret options based on server settings.
Copilot AI review requested due to automatic review settings July 15, 2026 10:21
@monkeytypegeorge monkeytypegeorge added backend Server stuff frontend User interface or web stuff api A change to the Application Programming Interface (API) packages Changes in local packages labels Jul 15, 2026
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds new pace caret modes that target the next distinct leaderboard WPM (“next” all-time, “nextDaily” daily), spanning schema/contracts, backend routes/controllers/DAL, and frontend settings + test logic; also makes the Settings UI react to async server-configuration so nextDaily appears once config loads.

Changes:

  • Add /leaderboards/next + /leaderboards/daily/next contract + backend handlers/queries + controller tests.
  • Add frontend query + test init logic to fetch next WPM and drive pace-caret speed.
  • Add frontend availability gating + Settings/commandline UI exposure for next/nextDaily.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/schemas/src/configs.ts Extends PaceCaret enum with next/nextDaily.
packages/contracts/src/leaderboards.ts Adds response schema + contract routes for next-WPM endpoints.
frontend/src/ts/test/pace-caret.ts Initializes remote pace-caret modes by fetching next WPM (and awaiting config for daily).
frontend/src/ts/queries/leaderboards.ts Adds Solid Query options + fetch helper for next pace-caret WPM.
frontend/src/ts/config/pace-caret-options.ts Centralizes availability checks + context building for pace-caret modes.
frontend/src/ts/config/metadata.tsx Updates pace-caret description/labels; blocks unavailable next* selections.
frontend/src/ts/components/pages/test/modes-notice/TestModesNotice.tsx Adjusts notice formatting/visibility for nextDaily + async WPM availability.
frontend/src/ts/components/pages/settings/custom-setting/PaceCaret.tsx Filters options based on auth + server config; subscribes to server configuration query.
frontend/src/ts/commandline/commandline-metadata.ts Exposes next/nextDaily options + availability gating for commandline config.
backend/src/utils/daily-leaderboards.ts Adds daily leaderboard “next WPM” computation.
backend/src/dal/leaderboards.ts Adds Mongo query to get next all-time leaderboard WPM above current user’s WPM.
backend/src/api/routes/leaderboards.ts Wires new routes to controller handlers.
backend/src/api/controllers/leaderboard.ts Implements getNextLeaderboardWpm + getNextDailyLeaderboardWpm.
backend/tests/api/controllers/leaderboard.spec.ts Adds controller tests for both next-WPM endpoints.

Comment thread backend/src/utils/daily-leaderboards.ts Outdated
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 15, 2026
Comment thread backend/src/dal/leaderboards.ts Outdated
Comment thread packages/contracts/src/leaderboards.ts
Wraps the value as { next } while preserving null responses.
@github-actions

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 15, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jul 15, 2026
@torturado
torturado requested a review from Copilot July 16, 2026 07:12
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread frontend/src/ts/config/pace-caret-options.ts
Comment thread backend/src/dal/leaderboards.ts
Comment thread packages/contracts/src/leaderboards.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api A change to the Application Programming Interface (API) backend Server stuff frontend User interface or web stuff packages Changes in local packages waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants