Port playground dashboard to SSR routes with basketball-api backend #7
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-landing!7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "5-promote-playground-dashboard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Ports the proven SvelteKit tryout-day dashboard from html-playground into westside-app's proper SSR route structure. Replaces direct Postgres queries with a basketball-api REST client, splits the single-page SPA into three SSR routes (landing, admin triage, coach card grid), and updates the global theme to match the playground dark design.
Changes
src/lib/server/api.js-- NEW. Basketball-API client with fetchRoster, checkIn, and assignNumber functions using BASKETBALL_API_URL env var via $env/dynamic/private.src/lib/server/db.js-- DELETED. No longer using direct Postgres.package.json-- Removed pg dependency.src/routes/+page.server.js-- REWRITTEN. Fetches roster via API, derives stats (total, checked-in, tryout numbers, paid, registered).src/routes/+page.svelte-- REWRITTEN. Landing page with 5 stat cards and nav links. Dark theme matching playground.src/routes/+layout.svelte-- UPDATED. Global styles: #0a0a0a background, system-ui font, #c41230 red accent.src/routes/admin/+page.server.js-- NEW. SSR load with triage grouping (ready/needs-waiver/needs-everything) plus form actions for check-in and assign-number.src/routes/admin/+page.svelte-- REWRITTEN. Full admin triage view with stats bar, search, status filter, triage sections (green/yellow/red), player rows with avatar/initials, check-in toggle, assign-number, copy-registration-link, walk-up placeholder, and payment/waiver status badges. Svelte 5 runes plus SvelteKit form actions with use:enhance.src/routes/coach/+page.server.js-- NEW. SSR load for coach roster view.src/routes/coach/+page.svelte-- REWRITTEN. Coach card grid with search by name, position filter, 2-column layout with photo/initials, tryout number badge, and dimmed "Not Yet Checked In" section. Svelte 5 runes.package-lock.json-- Updated to reflect removed pg dependency.Test Plan
Review Checklist
Related
Self-Review
Read 100% of the diff (1625 lines, 11 files changed, +1182/-219).
Finding (fixed)
Undefined
addWalkup()reference in walkup form -- The admin page walkup form had anonkeydownhandler callingaddWalkup(), which was defined in the playground's client-side SPA but not in the SSR version (no backend endpoint exists for walk-up players yet). This would cause a runtime error if a user pressed Enter in the input. Fixed in commitfc47b23by removing the broken handler.Verified
npm run buildsucceeds (both before and after fix)pgordb.jsremainuse:enhancefor check-in and assign-number mutationsgraduating_classdisplayed as'30format viaformatGradClass()helperCloses #5present in PR bodyPR #7 Review
Port playground dashboard to SSR routes with basketball-api backend
Reviewed: all 11 changed files (+1181/-219). Read every line of every source file on the
5-promote-playground-dashboardbranch.BLOCKERS
1. k8s/deployment.yaml still references DATABASE_URL (not updated in this PR)
k8s/deployment.yamllines 25-29 still injectDATABASE_URLfromwestside-app-secrets:The app no longer uses Postgres -- it needs
BASKETBALL_API_URLto reach the basketball-api service. Without this change, the deployed app will fall back tohttp://localhost:8000(the default inapi.jsline 3) which will fail in the cluster. This file was in scope for this PR (the whole point is switching from Postgres to API) and must be updated before merge.2. Walk-up player form is a dead end
src/routes/admin/+page.sveltelines 107-120 render a "+ Walk-up Player" button that expands to show a text input and Cancel button. However:walkupNamestate variable is never sent to any endpointadmin/+page.server.jsThis is a non-functional UI element. Either remove the walk-up UI entirely (and file a follow-up issue for when the API supports player creation), or wire it up. Leaving dead interactive UI that accepts input but does nothing is a user-facing bug.
NITS
1. Hardcoded Tailscale hostname in copyFormLink
src/routes/admin/+page.svelteline 38:This bakes the Tailscale hostname into client-side JavaScript. Consider deriving this from an env var exposed via
$env/dynamic/public(e.g.,PUBLIC_REGISTRATION_BASE_URL), or at minimum extract it as a constant at the top of the script block. Not blocking since it works for the current single-deployment setup, but it will break if the hostname ever changes.2. Unused CSS class
card-grid-dimsrc/routes/coach/+page.svelteline 88 appliesclass="card-grid card-grid-dim"but no.card-grid-dimCSS rule exists in the file. The dim effect is achieved via.card-dimon individualplayer-cardelements, so this class reference is dead. Harmless but sloppy.3. Landing page 5-card stats grid is unbalanced at desktop
src/routes/+page.svelteusesgrid-template-columns: repeat(3, 1fr)for the stats section, but there are now 5 stat cards (Total, Checked In, Tryout Numbers, Paid, Registered). This results in a 3+2 layout where the bottom row has 2 cards that don't span the full width. The mobile breakpoint (repeat(2, 1fr)) handles this more gracefully. Consider switching torepeat(5, 1fr)on desktop or adjusting the layout.4.
use:enhancecallback factory creates per-render closuressrc/routes/admin/+page.sveltelines 154 and 166 useuse:enhance={handleAction(player.id)}which calls the factory function during render, creating a new closure per player per render cycle. Functionally correct but worth noting for large rosters. Not blocking.SOP COMPLIANCE
5-promote-playground-dashboardreferences issue #5)Closes #5.gitignoreproperly excludes.env*; Woodpecker secrets usefrom_secret)pgfully removed from package.json and package-lock.json; zeropg/db.js/DATABASE_URLimports in src/CODE QUALITY NOTES
Positive:
api.jsclient helper is well-structured with JSDoc, proper error handling, and correct use of$env/dynamic/privateforBASKETBALL_API_URL$props(),$state(),$derived()-- no legacy stores or$:reactive statementsenhancewithinvalidateAll()for optimistic revalidationgraduating_classdisplayed viaformatGradClass()helper in both admin and coach views (Phase 3 requirement met)#0a0a0abg,#c41230accent,#141414cardsPOST /api/roster/{tenant}/check-in/{id}andPOST /api/roster/{tenant}/assign-number/{id})VERDICT: NOT APPROVED
Two blockers must be resolved before merge:
k8s/deployment.yamlto useBASKETBALL_API_URLinstead ofDATABASE_URL