(fix) harden and polish TigerSpot homepage - #19
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c25aa3c12c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (this.loadPromise) { | ||
| return this.loadPromise; |
There was a problem hiding this comment.
Force a fresh user load after dev login
If a developer opens and submits the custom dev-login form while the initial /api/auth/me request is still pending, devLoginAs() completes the login POST and calls load(), but this branch reuses the pre-login request instead of fetching the newly authenticated user. The method then reports success and navigates to /menu with user still null, causing an immediate redirect back to the login page. Authentication-changing operations need to bypass or invalidate the in-flight load before refreshing the user.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
eh not in my scope idc 😇
There was a problem hiding this comment.
Pull request overview
This PR hardens the frontend homepage/menu experience by making user/auth and dashboard data loading more resilient, while also polishing responsive layout and accessibility across shared UI components.
Changes:
- Updated
getChallenges()/listTournaments()to returnnullon failure and adjusted callers to handle fallbacks safely. - Added resilient menu loading with partial-failure handling, accessible loading status, and retry UI; deduped concurrent
userStore.load()calls. - Polished shared UI (Header, cards, icons, colors, reduced motion) for improved responsiveness and accessibility.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/frontend/src/routes/versus/+page.svelte | Handles getChallenges() possibly returning null by falling back to empty response. |
| apps/frontend/src/routes/tournament/+page.svelte | Falls back to [] when tournaments API returns null. |
| apps/frontend/src/routes/menu/+page.svelte | Adds resilient parallel loading with status messaging and retry UI. |
| apps/frontend/src/routes/layout.css | Adds --color-orange-ink, improves button foreground contrast, and adds reduced-motion handling. |
| apps/frontend/src/routes/admin/tournaments/+page.svelte | Falls back to [] when tournaments API returns null. |
| apps/frontend/src/routes/admin/+page.svelte | Falls back to [] when tournaments API returns null. |
| apps/frontend/src/lib/stores/user.svelte.ts | Dedupes concurrent user loads via an internal loadPromise. |
| apps/frontend/src/lib/components/StatCard.svelte | Renames valueColor → valueClass and removes incorrect style usage. |
| apps/frontend/src/lib/components/icons.ts | Exports IconDefinition type for reuse. |
| apps/frontend/src/lib/components/Icon.svelte | Uses exported IconDefinition type for stronger typing. |
| apps/frontend/src/lib/components/Header.svelte | Refactors nav items and adds active-route styling / accessibility attributes. |
| apps/frontend/src/lib/components/GameModeCard.svelte | Improves layout wrapping and readability for small screens. |
| apps/frontend/src/lib/components/Card.svelte | Switches variant colors to use CSS variables for consistency. |
| apps/frontend/src/lib/api/versus.ts | Changes getChallenges() to return null on error/missing data. |
| apps/frontend/src/lib/api/tournament.ts | Changes listTournaments() to return null on error/missing data. |
Suppressed comments (1)
apps/frontend/src/lib/components/Header.svelte:27
- After switching to
$app/stores, thepageimport is a store and needs to be referenced as$pagein the template. Otherwisepage.urlwill not be the current URL and can cause runtime/compile issues.
aria-current={page.url.pathname === item.href ? 'page' : undefined}
class="min-h-11 min-w-11 px-2 font-bold text-sm uppercase transition-colors inline-flex items-center justify-center gap-2 {page
.url.pathname === item.href
? 'text-orange-ink'
: 'hover:text-orange-ink'}"
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -1,41 +1,35 @@ | |||
| <script lang="ts"> | |||
| import { page } from '$app/state'; | |||
| if (statsData) stats = statsData; | ||
| if (challengesData) { | ||
| pendingChallenges = challengesData.received.length + challengesData.active.length; | ||
| } | ||
| if (tournamentsData) { | ||
| activeTournaments = tournamentsData.filter( | ||
| (t) => t.status === 'open' || t.status === 'in_progress' | ||
| ).length; | ||
| } | ||
| if (dailyData) dailyCompleted = dailyData.hasPlayed; |
Summary
Testing
pnpm --filter tigerspot-new buildpnpm --filter tigerspot-new check(retains four pre-existing dynamic-route parameter errors outside this change)Before
After
(PR written by Codex)