feat(ui): configure domain constants and sidebar assignment controls (US-03, US-04) #13

Merged
gabogg merged 2 commits from feat/us-03-us-04-domain-constants-and-sidebar into main 2026-09-24 10:36:39 +00:00
Owner

Addresses #3 and #4.

Summary

graph TD
    CONST[constants.js] -->|Zone Options & Mando Roles| SIDEBAR[Sidebar.jsx]
    CONST -->|formatName Title Case| AUTOCAP[AutoCapInput Component]
    SIDEBAR -->|onAddGama / onAddRojo / onAddParking| APP[App.jsx State]
src/
├── lib/
│   ├── constants.js          # Gamas (9), Rojos (5), PK (10), Mando (8), Expected (24) (US-03)
│   └── __tests__/
│       └── constants.test.js # 11 tests verifying constants and formatName
└── components/
    ├── Sidebar.jsx           # Shift picker, officer badge, assignment forms (US-04)
    └── __tests__/
        └── Sidebar.test.jsx  # 10 tests for forms, disabling duplicates, reset

Evidence

  • Before: No automated tests for zone constants or Sidebar interactions. Zone selection lacked defensive checks against double-assigning during concurrent operations.
  • After: 21 passing automated tests covering domain constants, title case formatting, and full Sidebar user interactions.
✓ src/lib/__tests__/constants.test.js (11 tests)
✓ src/components/__tests__/Sidebar.test.jsx (10 tests)

Test Files  2 passed (2)
     Tests  21 passed (21)
  Duration  2.90s

Merge Danger

Door: two-way

Reversible purely frontend configuration and component controls.

Blast Radius: low

Scoped to the Sidebar control panel and domain constants; does not impact map rendering or database schemas.

Addresses #3 and #4. ## Summary ```mermaid graph TD CONST[constants.js] -->|Zone Options & Mando Roles| SIDEBAR[Sidebar.jsx] CONST -->|formatName Title Case| AUTOCAP[AutoCapInput Component] SIDEBAR -->|onAddGama / onAddRojo / onAddParking| APP[App.jsx State] ``` ```text src/ ├── lib/ │ ├── constants.js # Gamas (9), Rojos (5), PK (10), Mando (8), Expected (24) (US-03) │ └── __tests__/ │ └── constants.test.js # 11 tests verifying constants and formatName └── components/ ├── Sidebar.jsx # Shift picker, officer badge, assignment forms (US-04) └── __tests__/ └── Sidebar.test.jsx # 10 tests for forms, disabling duplicates, reset ``` ## Evidence - **Before:** No automated tests for zone constants or Sidebar interactions. Zone selection lacked defensive checks against double-assigning during concurrent operations. - **After:** 21 passing automated tests covering domain constants, title case formatting, and full Sidebar user interactions. ```text ✓ src/lib/__tests__/constants.test.js (11 tests) ✓ src/components/__tests__/Sidebar.test.jsx (10 tests) Test Files 2 passed (2) Tests 21 passed (21) Duration 2.90s ``` ## Merge Danger **Door:** two-way Reversible purely frontend configuration and component controls. **Blast Radius:** low Scoped to the Sidebar control panel and domain constants; does not impact map rendering or database schemas.
- Define domain constants for Gamas, Red Points, Parking Posts, Command Leadership roles, and Expected Total posts (US-03)
- Harden formatName utility for Title Case string formatting with whitespace preservation
- Verify Sidebar control panel with shift selector, active officers badge, and duplicate zone prevention (US-04)
- Add AutoCapInput component with cursor position preservation
- Configure Vitest with happy-dom and add 21 unit tests for domain constants and Sidebar controls
- Translate internal comments to English per project policy
Author
Owner

Code review of 02b1ff8 against base 575526f using git diff 575526f7bf4e54ae605285197a249519b261dcb4...02b1ff8677237ab9186e77f10bd733552c364d43. Standards and Spec were reviewed independently.

Validation: 21 tests passed and production build passed on an isolated snapshot of this commit, using the locally installed dependencies. No live database validation was performed.

Standards

No actionable newly introduced standards violations or baseline smells found. Reviewed against AGENTS.md, CONTEXT.md, README.md, the applicable React performance guidance, and the Fowler smell baseline. Existing component structure, embedded UI strings, and unchanged behavior were excluded from findings about this diff.

Spec

No actionable findings against the readable acceptance criteria in issues #3 and #4. The constants define 9 Gamas, 5 Red Points, 10 Parking posts, 8 leadership roles, and 24 required operational posts. The sidebar supplies shift selection, officer counts, date formatting, capitalization, and disabled occupied options; the new submit guards also prevent overwriting an occupied zone. Reset confirmation is implemented by the parent App.jsx handler.

Most requested behavior predates this PR. Review included the existing parent callbacks rather than treating mocked component callbacks as proof of integration. Some issue identifiers are missing, limiting exact identifier verification.

Summary: Standards — 0 findings, worst: none identified; Spec — 0 findings, worst: none identified.

Code review of `02b1ff8` against base `575526f` using `git diff 575526f7bf4e54ae605285197a249519b261dcb4...02b1ff8677237ab9186e77f10bd733552c364d43`. Standards and Spec were reviewed independently. Validation: **21 tests passed** and **production build passed** on an isolated snapshot of this commit, using the locally installed dependencies. No live database validation was performed. ## Standards No actionable newly introduced standards violations or baseline smells found. Reviewed against AGENTS.md, CONTEXT.md, README.md, the applicable React performance guidance, and the Fowler smell baseline. Existing component structure, embedded UI strings, and unchanged behavior were excluded from findings about this diff. ## Spec No actionable findings against the readable acceptance criteria in issues #3 and #4. The constants define 9 Gamas, 5 Red Points, 10 Parking posts, 8 leadership roles, and 24 required operational posts. The sidebar supplies shift selection, officer counts, date formatting, capitalization, and disabled occupied options; the new submit guards also prevent overwriting an occupied zone. Reset confirmation is implemented by the parent `App.jsx` handler. Most requested behavior predates this PR. Review included the existing parent callbacks rather than treating mocked component callbacks as proof of integration. Some issue identifiers are missing, limiting exact identifier verification. Summary: Standards — **0 findings**, worst: none identified; Spec — **0 findings**, worst: none identified.
Author
Owner

Thank you for the review! Verified 0 findings reported on Standards and Spec. Ready for merge.

Thank you for the review! Verified 0 findings reported on Standards and Spec. Ready for merge.
gabogg merged commit 906ddedc75 into main 2026-09-24 10:36:39 +00:00
Sign in to join this conversation.
No description provided.