Admin schedule view: read-only dashboard for practices and events #166

Closed
opened 2026-03-28 23:21:33 +00:00 by forgejo_admin · 1 comment
Contributor

Type

Feature

Lineage

Child of forgejo_admin/basketball-api#230 (decomposed parent). Backend complete: basketball-api#232 (models) and #233 (API) are merged. This is the frontend consumer.

Repo

forgejo_admin/westside-landing

User Story

story:WS-S13 As an admin, I want to see all scheduled program activities (practices, tournaments, games) in one view so that I know what's coming up for the program.

Context

The schedule backend is live on basketball-api:

  • GET /admin/schedule returns { practices: [...], events: [...] }
  • Practices have: label, day_of_week, start_time, end_time, location, division, notes, is_active
  • Events have: title, event_type, start_date, end_date, location, division, notes, parent_event_id

This ticket adds a read-only admin schedule view. CRUD forms (create/edit/delete) are a follow-up ticket — Marcus needs to SEE the data first.

Frontend patterns to follow (from existing admin pages):

  • Client-side data loading via onMount() + apiFetch() (no +page.js load functions)
  • Svelte 5 runes: $state, $derived, $effect
  • Division filter maps boys→"Kings", girls→"Queens" (use existing programStore or inline filter)
  • Error handling: show message + fallback data on API failure
  • Loading state: show spinner/skeleton while fetching

File Targets

Files to create:

  • src/routes/(app)/admin/schedule/+page.svelte — NEW. Admin schedule view page.

Pattern reference (do NOT modify):

  • src/routes/(app)/admin/+page.svelte — dashboard page pattern (onMount, apiFetch, card layout)
  • src/routes/(app)/admin/teams/+page.svelte — team management pattern (division filtering, grid layout)
  • src/routes/(public)/schedule/+page.svelte — existing public schedule page (card layout reference for how schedule data is displayed, Kings/Queens toggle)
  • src/lib/api.js — apiFetch pattern
  • src/lib/program.svelte.js — programStore for Kings/Queens toggle

Files NOT to touch:

  • src/routes/(app)/+layout.svelte — layout already protects /admin/* routes, no nav change needed for MVP
  • src/lib/api.js — no new API functions needed, apiFetch handles it
  • Any basketball-api files — backend is done

Acceptance Criteria

  • /admin/schedule route loads and displays data from GET /admin/schedule
  • Practices section: grouped by label (e.g., "Travel Teams", "17U Local Kings"), showing day, time, location, notes
  • Events section: sorted by start_date ascending, showing title, dates, location, event_type badge
  • Division filter: Kings/Queens toggle filters both practices and events by division
  • Loading state shown while API call is in flight
  • Error state shown if API call fails (with fallback message)
  • Matches existing admin page styling (card grid, section headers, consistent spacing)

Test Expectations

  • Visual verification: page renders practices and events from the API
  • Filter test: toggling Kings/Queens shows only the relevant division's data
  • Empty state: page handles gracefully if no practices or events exist
  • Run command: manual browser verification (no unit test framework in westside-app currently)

Constraints

  • Follow existing admin page patterns exactly — onMount() loading, $state/$derived for reactivity
  • Use apiFetch('/admin/schedule') — single API call, display both sections from the response
  • Use pure CSS variables from the existing design system — NO Tailwind (per convention)
  • Read-only only — no create/edit/delete buttons or forms in this ticket
  • Day of week display: map integer (0=Mon...6=Sun) to day name in the component
  • Time display: format "14:00" as "2:00 PM" for readability

Checklist

  • PR opened
  • No unrelated changes
  • Tested on mobile viewport (390px) and desktop
  • Parent: forgejo_admin/basketball-api#230
  • Backend: forgejo_admin/basketball-api#232 (models, merged), forgejo_admin/basketball-api#233 (API, merged)
  • project-westside-basketball
  • arch-domain-westside-basketball — updated with schedule entities
  • Follow-up: Admin schedule CRUD forms (create/edit/delete practices and events)
### Type Feature ### Lineage Child of `forgejo_admin/basketball-api#230` (decomposed parent). Backend complete: basketball-api#232 (models) and #233 (API) are merged. This is the frontend consumer. ### Repo `forgejo_admin/westside-landing` ### User Story `story:WS-S13` As an admin, I want to see all scheduled program activities (practices, tournaments, games) in one view so that I know what's coming up for the program. ### Context The schedule backend is live on basketball-api: - `GET /admin/schedule` returns `{ practices: [...], events: [...] }` - Practices have: label, day_of_week, start_time, end_time, location, division, notes, is_active - Events have: title, event_type, start_date, end_date, location, division, notes, parent_event_id This ticket adds a **read-only** admin schedule view. CRUD forms (create/edit/delete) are a follow-up ticket — Marcus needs to SEE the data first. **Frontend patterns to follow (from existing admin pages):** - Client-side data loading via `onMount()` + `apiFetch()` (no +page.js load functions) - Svelte 5 runes: `$state`, `$derived`, `$effect` - Division filter maps `boys`→"Kings", `girls`→"Queens" (use existing `programStore` or inline filter) - Error handling: show message + fallback data on API failure - Loading state: show spinner/skeleton while fetching ### File Targets Files to create: - `src/routes/(app)/admin/schedule/+page.svelte` — NEW. Admin schedule view page. Pattern reference (do NOT modify): - `src/routes/(app)/admin/+page.svelte` — dashboard page pattern (onMount, apiFetch, card layout) - `src/routes/(app)/admin/teams/+page.svelte` — team management pattern (division filtering, grid layout) - `src/routes/(public)/schedule/+page.svelte` — existing public schedule page (card layout reference for how schedule data is displayed, Kings/Queens toggle) - `src/lib/api.js` — apiFetch pattern - `src/lib/program.svelte.js` — programStore for Kings/Queens toggle Files NOT to touch: - `src/routes/(app)/+layout.svelte` — layout already protects /admin/* routes, no nav change needed for MVP - `src/lib/api.js` — no new API functions needed, apiFetch handles it - Any basketball-api files — backend is done ### Acceptance Criteria - [ ] `/admin/schedule` route loads and displays data from `GET /admin/schedule` - [ ] Practices section: grouped by label (e.g., "Travel Teams", "17U Local Kings"), showing day, time, location, notes - [ ] Events section: sorted by start_date ascending, showing title, dates, location, event_type badge - [ ] Division filter: Kings/Queens toggle filters both practices and events by division - [ ] Loading state shown while API call is in flight - [ ] Error state shown if API call fails (with fallback message) - [ ] Matches existing admin page styling (card grid, section headers, consistent spacing) ### Test Expectations - [ ] Visual verification: page renders practices and events from the API - [ ] Filter test: toggling Kings/Queens shows only the relevant division's data - [ ] Empty state: page handles gracefully if no practices or events exist - Run command: manual browser verification (no unit test framework in westside-app currently) ### Constraints - Follow existing admin page patterns exactly — `onMount()` loading, `$state`/`$derived` for reactivity - Use `apiFetch('/admin/schedule')` — single API call, display both sections from the response - Use pure CSS variables from the existing design system — NO Tailwind (per convention) - Read-only only — no create/edit/delete buttons or forms in this ticket - Day of week display: map integer (0=Mon...6=Sun) to day name in the component - Time display: format "14:00" as "2:00 PM" for readability ### Checklist - [ ] PR opened - [ ] No unrelated changes - [ ] Tested on mobile viewport (390px) and desktop ### Related - Parent: `forgejo_admin/basketball-api#230` - Backend: `forgejo_admin/basketball-api#232` (models, merged), `forgejo_admin/basketball-api#233` (API, merged) - `project-westside-basketball` - `arch-domain-westside-basketball` — updated with schedule entities - Follow-up: Admin schedule CRUD forms (create/edit/delete practices and events)
Author
Contributor

Scope Review: READY

Review note: review-639-2026-03-28
Ticket is fully scoped, all file targets verified, traceability complete, fits in a single agent pass (~3-4 min). No action needed before dispatch.

## Scope Review: READY Review note: `review-639-2026-03-28` Ticket is fully scoped, all file targets verified, traceability complete, fits in a single agent pass (~3-4 min). No action needed before dispatch.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/westside-app#166
No description provided.