Don't make code changes outside of this file. Help me edit this prompt so that Townie with Claude Opus 4.5 gives best results.
I want to change the postgame workflow to support club leaderboards.
After the user gets their scored results,
-
header
-
resultsTable
-
clubNameInput
-
userNameInput
-
submitToLeaderboardButton
-
club names should be a string of only 26 letters in the alphabet. no digits or other characters or spaces.(ie, can be input using the keyboard component)
-
club names should be no more than 25 characters long
likewise for players:
- player names should be a string of 26 letters in the alphabet. no digits or other characters or spaces.(ie, can be input using the keyboard component)
- player names should be no more than 25 characters long
each submission gets a unique id, two players can submit with the same userName and clubName
Here's what I was thinking for data needed to be collected to support the leaderboard view. Although submitted at is not currently needed, it should be included. if this is insufficient, or could be handled better, make those changes.
-
submission_id
-
game_id
-
club_name
-
user_name
-
submitted_at: timestamp when the user submitted to finish the final round, ending the game.
-
total_points: sum of length of every valid submission, as displayed on the postGame resultsTable.
-
submissions: array of strings containing the words the user played, in order
-
submission_validity : array of booleans of same length of submission, true for valid words and false for invalid,
-
create a file scripts/initDbResults.ts to initialize a game_results table where these are stored.
- add leaderboard as a gameState.
- the user transitions to the leaderboard state after they press the submitToLeaderboardButton
- the leaderboard view displays a scrollable table with the results of every submission of to that club.
- the results should be sorted by default from most total points to least
- reuse the roundIndicator, but with an extra unconnected dot for total points, to allow the user to change the sort order to sort by round.
- if two users have the same total points, use the username as a tiebreaker for sort order.
- if two users have the same number of points for a round, use the submitted word as the first tiebreaker, followed by user_name.
- The club name should be autopopulated (but editable) if the user navigated to the app via a path with "/club/{clubname}/" (or "/club/{clubname}" without the terminal "/")
- if a user inputs the url with a path "/club/{clubname}/leaderboard/" into their browser, that should take them to club leaderboard
- if there are no player submissions with that club name, indicate "nobody in the club has played yet!"
- when the user navigates from the postGame to leaderboard gameState, update the path in the browser as well.
add the edited version below here: