Conversation
There was a problem hiding this comment.
Pull request overview
Implements an initial tournaments system focused on registration flows, adding a dashboard UI (SSR React) plus Discord command-based registration, and introducing a Cloudflare Workflow to manage tournament lifecycle tasks (e.g., posting/updating registration messages).
Changes:
- Add tournament data model (DB schema + types) and endpoints/commands for registration & unregistration.
- Introduce SSR React “dashboard” pages/components and a custom esbuild-based build pipeline for Workers + static assets.
- Add OAuth-based login (Discord) with encrypted cookie tokens and admin-gated tournament creation/editing.
Reviewed changes
Copilot reviewed 58 out of 96 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| wrangler.toml | Switch worker entry to built dist output, add build command, assets routing, and new tournament workflow binding |
| tsconfig.json | Enable JSX/DOM libs and Node types for the new TSX/SSR setup |
| src/util/tournaments/parseTournamentData.ts | Parse/validate tournament creation/edit form payloads (admin-gated) |
| src/util/tournaments/createRegistrationMessage.ts | Build Discord Components V2 registration message from a template message |
| src/util/token.ts | Add encrypted cookie token creation/refresh/revoke and admin-role checks |
| src/util/strings.ts | Add placeholder() helper for template substitution |
| src/util/responses.tsx | Add SSR 403 response helper (React-based) + 405 helper |
| src/util/isMobile.ts | Add UA + Client Hint mobile detection helper |
| src/util/globals.ts | Add shared TextEncoder/TextDecoder instances |
| src/util/forms.ts | Add typed FormData parsing helpers (Temporal-based datetime parsing) |
| src/util/fetchCache.ts | Adjust fetch typing to non-CfProperties RequestInfo |
| src/util/createSolidPng.ts | Reuse shared TextEncoder rather than creating a new instance |
| src/util/capitalize.ts | Add forceCapitalize utility |
| src/util/Constants.ts | Add tournament-specific bitflags/enums |
| src/util/CommandHandler.ts | Reuse shared TextEncoder for signature verification |
| src/types.ts | Add JWT type, tournament-related DB types, and new Brawl API helper types |
| src/prepare.ts | Add logs for @discordjs/ws patching step |
| src/patchTypes.ts | Patch wrangler-generated d.ts output for local typing ergonomics |
| src/modules.d.ts | Add module declarations for build-time virtual modules and asset imports |
| src/index.tsx | New main Worker entry: SSR routes, tournaments endpoints, and Discord OAuth |
| src/index.ts | Remove old minimal worker entry |
| src/dom/tsconfig.json | Remove separate DOM tsconfig (consolidated into root config) |
| src/commands/tournament.ts | Add /tournament register flow and component handlers for registration/unregistration |
| src/commands/share.ts | Point tweet DOM handler import to src/app/handleTweet.js |
| src/commands/index.ts | Export new tournament command |
| src/commands/dev.ts | Use base64url encoding for shorten source id generation |
| src/commands/brawl.ts | Add language header; extend link/unlink flows to store player name |
| src/build.ts | New build pipeline: assets hashing, hydration bundles, SSR static generation, worker bundling |
| src/app/utils/useStyle.ts | Track styles used during SSR (style collection helper) |
| src/app/utils/useClient.tsx | SSR-to-client hydration bridge for client components |
| src/app/tournaments/new.page.tsx | New page for tournament creation |
| src/app/tournaments/[id]/edit.page.tsx | New page for tournament editing |
| src/app/tournaments.page.tsx | New tournaments listing page |
| src/app/styles/lazy.css | Base styles/fonts + common UI behaviors |
| src/app/predictions.page.tsx | Placeholder “work in progress” predictions page (static cached) |
| src/app/js/removeAuthParams.js | Client helper to remove auth query params from URL |
| src/app/index.page.tsx | New dashboard home page |
| src/app/img/background/background.avif | New background image asset |
| src/app/img/avatar/200.avif | New avatar image asset |
| src/app/img/avatar/160.avif | New avatar image asset |
| src/app/hydrate.tsx | Hydration bootstrap for client components |
| src/app/handleTweet.js | DOM mutation/XPath logic to normalize tweet page markup for sharing |
| src/app/components/layout.tsx | Shared HTML layout/head generation for SSR pages |
| src/app/components/forms.tsx | Shared form UI components used by tournament editor |
| src/app/components/UserAvatar.tsx | Avatar rendering via Discord CDN with responsive srcSet |
| src/app/components/Tournaments.tsx | Tournament listing UI (status + register/unregister + admin actions) |
| src/app/components/Tournament.tsx | Tournament create/edit form UI |
| src/app/components/Rounds.tsx | Client component to dynamically add round settings |
| src/app/components/Mode.tsx | Mode input with suggestions support |
| src/app/components/HomeButton.tsx | Shared button/link UI component |
| src/app/components/DiscordLogo.tsx | Discord SVG logo component |
| src/app/components/DefaultAvatar.tsx | Fallback avatar component |
| src/app/components/AuthMessage.tsx | Login/logout/error toast messaging based on URL params |
| src/app/404.page.tsx | Static cached 404 page |
| src/app/403.page.tsx | 403 page used by SSR forbidden responses |
| src/Tournament.ts | New Cloudflare Workflow to post/update registration messages and report errors |
| schema.sql | Add tournaments + participants schema and expand SupercellPlayers with name + new uniqueness constraints |
| public/manifest.json | Add PWA manifest for dashboard |
| public/_headers | Configure caching headers for static assets |
| public/.well-known/discord | Add Discord domain verification file |
| package.json | Add build tooling deps (esbuild/react) and update scripts |
| eslint.config.js | Extend linting to TSX/JSX files |
| .test.vars | Add SECRET_KEY env var for tests |
| .gitignore | Ignore build output and wrangler dir |
| .github/workflows/test.yml | Use npm ci --legacy-peer-deps in CI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 96 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 96 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 58 out of 96 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Copilot reviewed 58 out of 96 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes this PR makes:
Implement tournament system
Note that teams and tournament progression will be done later, but in the meantime everything else related to registration should be ready
The "Manage" button pointing to a non existent page is expected
Keys in
.test.varsare used for tests and are meant to be publicUsing
@meas guild id is known to work even if the channel is not a DMIn the js environment this runs, RegExp.escape is present