feat(admin): parks pages — details, gates, products & fees, photos (#45, PR 2) #143

Merged
amiryahaya merged 10 commits from feat/admin-parks into main 2026-11-02 14:38:23 +01:00
Owner

PR 2 of #45 (admin catalogue): the parks pages.

Design: docs/superpowers/specs/2026-11-02-admin-catalogue-design.md · Plan: docs/superpowers/plans/2026-11-02-admin-parks.md

What changes

API

  • ParkProduct gains seat_pool_id (nullable uuid) in the Go struct, the store select and OpenAPI. It is additive and admin-only, because ListParkProducts serves only the admin route. The seat-pool select needs it to show the current pool.

Admin portal (web/apps/admin/src/parks/, all admin_portal.administration.manage)

  • Menu: a "Catalogue" group (a group field on MenuEntry), holding Parks.
  • /parks: name, code and active columns, with name search and an active filter. Filtering happens in the browser because the admin list is unpaginated; there is a shortcut: comment for it.
  • /parks/new: opens the created park.
  • /parks/:id?tab=...:
    • Details: every field. The eight text fields are textareas with a Markdown Preview (@kws/ui Markdown). The form also has park categories (it always sends the full list) and active. Remove asks first.
    • Gates: add, edit and remove.
    • Products & fees:
      • Add a product. The picker hides every product already linked, active or not, because links are never deleted.
      • Each row has its order and active flag, an inline seat-pool select, and a price list per row.
      • Prices can be added and edited. An overlap is told apart from a stale version by the server's fixed detail, the same way rates do it.
    • Photos: upload the raw file through the generated client, checked in the browser for type, 5 MiB and 10 photos. Each photo's description and order can be edited, and photos can be removed. Previews use the public /v1/media/{id}; a park that is not active shows its description instead of a thumbnail.
  • Unsaved Details text survives switching tabs.
  • 409/404 show fixed texts with Reload and keep the user's input. The server's detail is never shown.
  • @kws/ui gains TextArea, a small shared ConfirmRemove is added, and CLAUDE.md gets a layout line.

Verification

  • make cover: 91.6 % total (minimum 80 %).
  • make lint: 0 issues. make contract: ok. Clients regenerated (TypeScript and Dart).
  • Web unit tests pass everywhere (admin 320, ticket 304, ui 47, auth 45), and typecheck is clean.
  • scripts/web-e2e.sh: ticket 207, admin 116. The admin count includes a new parks journey at 320, 768 and 1280 px, with axe checks on the list and every tab.
  • Real local run against the dev API (mock IdP, Super Admin):
    • Created a park and checked the Markdown preview: <script> stays text.
    • Added a gate, linked a product and saved a price.
    • Tried an overlapping price: the real 409 showed the overlap text.
    • Uploaded a photo and saw its public preview load.
    • Removed the photo, then the park.
    • The run found two issues, both now fixed with tests: unselected tabs looked selected, and the Preview buttons shared one name.
  • Review:
    • Pass 1 (complexity): no must-fix. I removed a duplicated seat-pool filter and a duplicated photo sort.
    • Pass 2 (correctness): one Important finding: a stale version on the seat pool was shown as "pool in use". It is fixed with a test.
    • I also fixed two more, re-graded up, each with a test that failed first:
      • Details edits were lost on a tab switch.
      • A mismatched image file got "try again".
    • The Pass 1 re-check of the fixes: Ship.

Decisions (differences from the design)

  • No price_overlap problem code: the page compares the fixed detail, as RateForm does. If the server text is reworded, an overlap would read as "someone else changed this"; a test pins the text.
  • Photo previews: they go through the public media route, so an inactive park has no thumbnail. An admin file route would be a later API change.
  • Seat pool: an inline select that writes on change.
  • Dates: text fields in YYYY-MM-DD, because the kit has no date input.
  • Preview: the rendered text shows below the textarea.

Known and deferred

  1. A concurrent 11th upload shows a generic failure.
  2. The browser's 10-photo check is skipped while the list is loading.
  3. A second seat-pool change during a write is dropped.
  4. No test covers a non-overlap 409 on price create.
  5. Tabs have no arrow-key navigation.
  6. A failed category list is silent.
  7. Description length counts UTF-16 units, not characters.
  8. TextArea has no test of its own.
  9. Reload does nothing after a failed new-park save.
  10. The coordinate check is duplicated.
  11. The load-error block is copied across pages (a LoadError follow-up).
  12. "Park saved." stays while editing again.
  13. An empty file shows the type text.
  • The dev database keeps the removed test park's product link and price, because there is no delete API for them.

🤖 Generated with Claude Code

PR 2 of #45 (admin catalogue): the parks pages. Design: `docs/superpowers/specs/2026-11-02-admin-catalogue-design.md` · Plan: `docs/superpowers/plans/2026-11-02-admin-parks.md` ## What changes **API** - `ParkProduct` gains `seat_pool_id` (nullable uuid) in the Go struct, the store select and OpenAPI. It is additive and admin-only, because `ListParkProducts` serves only the admin route. The seat-pool select needs it to show the current pool. **Admin portal** (`web/apps/admin/src/parks/`, all `admin_portal.administration.manage`) - **Menu:** a "Catalogue" group (a `group` field on `MenuEntry`), holding Parks. - **`/parks`:** name, code and active columns, with name search and an active filter. Filtering happens in the browser because the admin list is unpaginated; there is a `shortcut:` comment for it. - **`/parks/new`:** opens the created park. - **`/parks/:id?tab=...`:** - **Details:** every field. The eight text fields are textareas with a Markdown Preview (`@kws/ui` `Markdown`). The form also has park categories (it always sends the full list) and active. Remove asks first. - **Gates:** add, edit and remove. - **Products & fees:** - Add a product. The picker hides every product already linked, active or not, because links are never deleted. - Each row has its order and active flag, an inline seat-pool select, and a price list per row. - Prices can be added and edited. An overlap is told apart from a stale version by the server's fixed detail, the same way rates do it. - **Photos:** upload the raw file through the generated client, checked in the browser for type, 5 MiB and 10 photos. Each photo's description and order can be edited, and photos can be removed. Previews use the public `/v1/media/{id}`; a park that is not active shows its description instead of a thumbnail. - Unsaved Details text survives switching tabs. - 409/404 show fixed texts with Reload and keep the user's input. The server's `detail` is never shown. - `@kws/ui` gains `TextArea`, a small shared `ConfirmRemove` is added, and `CLAUDE.md` gets a layout line. ## Verification - `make cover`: **91.6 %** total (minimum 80 %). - `make lint`: 0 issues. `make contract`: ok. Clients regenerated (TypeScript and Dart). - Web unit tests pass everywhere (admin 320, ticket 304, ui 47, auth 45), and typecheck is clean. - `scripts/web-e2e.sh`: ticket 207, admin 116. The admin count includes a new parks journey at 320, 768 and 1280 px, with axe checks on the list and every tab. - Real local run against the dev API (mock IdP, Super Admin): - Created a park and checked the Markdown preview: `<script>` stays text. - Added a gate, linked a product and saved a price. - Tried an overlapping price: the real 409 showed the overlap text. - Uploaded a photo and saw its public preview load. - Removed the photo, then the park. - The run found two issues, both now fixed with tests: unselected tabs looked selected, and the Preview buttons shared one name. - Review: - **Pass 1 (complexity):** no must-fix. I removed a duplicated seat-pool filter and a duplicated photo sort. - **Pass 2 (correctness):** one Important finding: a stale version on the seat pool was shown as "pool in use". It is fixed with a test. - I also fixed two more, re-graded up, each with a test that failed first: - Details edits were lost on a tab switch. - A mismatched image file got "try again". - The Pass 1 re-check of the fixes: Ship. ## Decisions (differences from the design) - **No `price_overlap` problem code:** the page compares the fixed detail, as `RateForm` does. If the server text is reworded, an overlap would read as "someone else changed this"; a test pins the text. - **Photo previews:** they go through the public media route, so an inactive park has no thumbnail. An admin file route would be a later API change. - **Seat pool:** an inline select that writes on change. - **Dates:** text fields in `YYYY-MM-DD`, because the kit has no date input. - **Preview:** the rendered text shows below the textarea. ## Known and deferred 1. A concurrent 11th upload shows a generic failure. 2. The browser's 10-photo check is skipped while the list is loading. 3. A second seat-pool change during a write is dropped. 4. No test covers a non-overlap 409 on price create. 5. Tabs have no arrow-key navigation. 6. A failed category list is silent. 7. Description length counts UTF-16 units, not characters. 8. `TextArea` has no test of its own. 9. Reload does nothing after a failed new-park save. 10. The coordinate check is duplicated. 11. The load-error block is copied across pages (a `LoadError` follow-up). 12. "Park saved." stays while editing again. 13. An empty file shows the type text. - The dev database keeps the removed test park's product link and price, because there is no delete API for them. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also from the local run: unselected tabs no longer look selected, and each
Preview button names its field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(admin): review fixes for the parks pages (#45)
Some checks failed
ci / changes (pull_request) Successful in 25s
ci / clients (pull_request) Successful in 2m25s
ci / web (pull_request) Failing after 7m5s
ci / api (pull_request) Failing after 27m16s
ci / ci-gate (pull_request) Failing after 2s
999038986b
- a stale version on the seat pool select says so instead of 'pool in use'
- unsaved Details text survives a visit to another tab
- an image whose content is not its declared type gets the type text
- drop a browser filter and sort the server already does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge branch 'main' into feat/admin-parks
All checks were successful
ci / changes (pull_request) Successful in 1m25s
ci / clients (pull_request) Successful in 1m40s
ci / web (pull_request) Successful in 8m36s
ci / api (pull_request) Successful in 9m34s
ci / ci-gate (pull_request) Successful in 3s
713c71a75d
Sign in to join this conversation.
No reviewers
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
primatekuntech/kws!143
No description provided.