Refactor New Game to several smaller elements #30

Closed
opened 2025-10-30 14:58:41 +01:00 by froxxxy · 11 comments
Owner
No description provided.
Collaborator

Setup: Updated repository .gitea pointer to this issue for traceability. This ensures all subsequent refactor commits will reference the correct issue.

Commit: 892c01d188

Next: Start extracting components from src/components/NewGame.tsx into src/components/new-game/ in small, reviewable steps.

Setup: Updated repository `.gitea` pointer to this issue for traceability. This ensures all subsequent refactor commits will reference the correct issue. Commit: 892c01d188a847af1d0b765e1a69f21593f45c72 Next: Start extracting components from `src/components/NewGame.tsx` into `src/components/new-game/` in small, reviewable steps.
Collaborator

Step 1: Extracted PlayerSelectModal into its own module.

Changes:

  • Added src/components/new-game/PlayerSelectModal.tsx
  • Updated src/components/NewGame.tsx to import modal

Commit: 8aac1d476a

Impact: Purely structural; no behavioral changes. Proceeding to extract wizard steps incrementally.

Step 1: Extracted `PlayerSelectModal` into its own module. Changes: - Added `src/components/new-game/PlayerSelectModal.tsx` - Updated `src/components/NewGame.tsx` to import modal Commit: 8aac1d476ac50de2abc41dc0537de70a13024be0 Impact: Purely structural; no behavioral changes. Proceeding to extract wizard steps incrementally.
Collaborator

Step 2: Extracted Player1Step into its own module and wired imports.

Changes:

  • Added src/components/new-game/Player1Step.tsx
  • Updated src/components/NewGame.tsx to import Player1Step

Commit: f8b461e189

Impact: Structural refactor only; no behavior changes. Next: extract Player2Step and Player3Step.

Step 2: Extracted `Player1Step` into its own module and wired imports. Changes: - Added `src/components/new-game/Player1Step.tsx` - Updated `src/components/NewGame.tsx` to import `Player1Step` Commit: f8b461e189b03c85360ec5aef37b48f5701ad839 Impact: Structural refactor only; no behavior changes. Next: extract Player2Step and Player3Step.
Collaborator

Step 3: Extracted Player2Step and Player3Step into separate modules and updated imports.

Changes:

  • Added src/components/new-game/Player2Step.tsx
  • Added src/components/new-game/Player3Step.tsx
  • Updated src/components/NewGame.tsx to import both

Commit: af0ffe8517

Impact: Structural refactor; no behavior changes. Next: extract GameTypeStep and RaceToStep.

Step 3: Extracted `Player2Step` and `Player3Step` into separate modules and updated imports. Changes: - Added `src/components/new-game/Player2Step.tsx` - Added `src/components/new-game/Player3Step.tsx` - Updated `src/components/NewGame.tsx` to import both Commit: af0ffe8517d601fc1b82420e9ecdd7ed9b0ecf8c Impact: Structural refactor; no behavior changes. Next: extract GameTypeStep and RaceToStep.
Collaborator

Step 4: Extracted GameTypeStep and RaceToStep into separate modules.

Changes:

  • Added src/components/new-game/GameTypeStep.tsx
  • Added src/components/new-game/RaceToStep.tsx
  • Updated src/components/NewGame.tsx to import both

Commit: d6ea0125df

Impact: Structural refactor only; no behavior changes. Next: extract BreakRuleStep and BreakOrderStep.

Step 4: Extracted `GameTypeStep` and `RaceToStep` into separate modules. Changes: - Added `src/components/new-game/GameTypeStep.tsx` - Added `src/components/new-game/RaceToStep.tsx` - Updated `src/components/NewGame.tsx` to import both Commit: d6ea0125df9ca0218c2a03fbb064d4b1bca6b574 Impact: Structural refactor only; no behavior changes. Next: extract BreakRuleStep and BreakOrderStep.
Collaborator

Step 5: Extracted BreakRuleStep and BreakOrderStep into separate modules.

Changes:

  • Added src/components/new-game/BreakRuleStep.tsx
  • Added src/components/new-game/BreakOrderStep.tsx
  • Updated src/components/NewGame.tsx to import both

Commit: 2b17027801

Impact: Structural refactor; no behavior changes. Next: finalize exports/imports and lint.

Step 5: Extracted `BreakRuleStep` and `BreakOrderStep` into separate modules. Changes: - Added `src/components/new-game/BreakRuleStep.tsx` - Added `src/components/new-game/BreakOrderStep.tsx` - Updated `src/components/NewGame.tsx` to import both Commit: 2b17027801e95b2ac95619f3d137db69f2f79098 Impact: Structural refactor; no behavior changes. Next: finalize exports/imports and lint.
Collaborator

Refactor complete: Split NewGame into modular step components.

Summary of changes:

  • Extracted: PlayerSelectModal, Player1Step, Player2Step, Player3Step, GameTypeStep, RaceToStep, BreakRuleStep, BreakOrderStep
  • New files under src/components/new-game/
  • NewGame.tsx now imports and re-exports these components
  • Lints: clean; no errors

Commits:

If you want, I can add an index.ts barrel in new-game/ for cleaner imports, or proceed to refactor state orchestration into a dedicated container/hook.

Refactor complete: Split `NewGame` into modular step components. Summary of changes: - Extracted: PlayerSelectModal, Player1Step, Player2Step, Player3Step, GameTypeStep, RaceToStep, BreakRuleStep, BreakOrderStep - New files under `src/components/new-game/` - `NewGame.tsx` now imports and re-exports these components - Lints: clean; no errors Commits: - 892c01d188a847af1d0b765e1a69f21593f45c72 – .gitea -> issue #30 - 8aac1d476ac50de2abc41dc0537de70a13024be0 – extract PlayerSelectModal - f8b461e189b03c85360ec5aef37b48f5701ad839 – extract Player1Step - af0ffe8517d601fc1b82420e9ecdd7ed9b0ecf8c – extract Player2/3 Steps - d6ea0125df9ca0218c2a03fbb064d4b1bca6b574 – extract GameType/RaceTo Steps - 2b17027801e95b2ac95619f3d137db69f2f79098 – extract BreakRule/BreakOrder Steps If you want, I can add an `index.ts` barrel in `new-game/` for cleaner imports, or proceed to refactor state orchestration into a dedicated container/hook.
Collaborator

Future enhancement notes (not implemented yet):

  1. Add a barrel file at src/components/new-game/index.ts
  • Cleaner imports: import { Player1Step, RaceToStep } from '.../new-game'
  • Lower churn when moving files internally; import sites remain stable
  • Better discoverability of the folder's public API
  • Tree-shaking remains effective with named exports
  • Caveat: keep the barrel curated to avoid exposing internals
  1. Extract orchestration into a useNewGameWizard hook (or container)
  • Separation of concerns: steps remain presentational; hook owns state/flow
  • Testability: unit-test state machine (next/back/validate) without UI
  • Reusability: same flow can power multiple UIs
  • Smaller components and less prop drilling via a typed API
  • Maintainability: centralized place for transitions/side-effects/persistence
  • Caveat: requires upfront API design and a light refactor

Context: Refactor New Game to several smaller elements #30

Future enhancement notes (not implemented yet): 1) Add a barrel file at `src/components/new-game/index.ts` - Cleaner imports: `import { Player1Step, RaceToStep } from '.../new-game'` - Lower churn when moving files internally; import sites remain stable - Better discoverability of the folder's public API - Tree-shaking remains effective with named exports - Caveat: keep the barrel curated to avoid exposing internals 2) Extract orchestration into a `useNewGameWizard` hook (or container) - Separation of concerns: steps remain presentational; hook owns state/flow - Testability: unit-test state machine (next/back/validate) without UI - Reusability: same flow can power multiple UIs - Smaller components and less prop drilling via a typed API - Maintainability: centralized place for transitions/side-effects/persistence - Caveat: requires upfront API design and a light refactor Context: Refactor New Game to several smaller elements #30
Collaborator

Committed changes to default Break rule and selected styling.

  • Commit: 64fedd3024
  • Files:
    • src/components/new-game/BreakRuleStep.tsx
    • src/components/NewGame.module.css

Summary:

  • Default Break rule to 'winnerbreak' in BreakRuleStep
  • Selected quick-pick button styling aligned with Race To buttons
  • Simplified Weiter button (rule is always defined)

This commit references and closes this issue (Fixes #30).

Committed changes to default Break rule and selected styling. - Commit: 64fedd3024326c7835d8bda6ba9fc2447b036318 - Files: - src/components/new-game/BreakRuleStep.tsx - src/components/NewGame.module.css Summary: - Default Break rule to 'winnerbreak' in BreakRuleStep - Selected quick-pick button styling aligned with Race To buttons - Simplified Weiter button (rule is always defined) This commit references and closes this issue (Fixes #30).
Collaborator

Committed UI update to highlight selected players in BreakOrderStep.tsx (mirrors selection UX from BreakRuleStep.tsx).

Commit: 9175d505c2

  • Adds selected styling to first/second player buttons for clear visual feedback.
  • Part of new game flow improvements.

Refs #30

Committed UI update to highlight selected players in `BreakOrderStep.tsx` (mirrors selection UX from `BreakRuleStep.tsx`). Commit: 9175d505c2c510eb5a2ce75353cfb5e0235d4709 - Adds `selected` styling to first/second player buttons for clear visual feedback. - Part of new game flow improvements. Refs #30
Collaborator

Added Docker Compose configuration file (compose.yml) for deployment.

Commit: f8d895ab21ac5267f6371f97addd98c0c966c01d

Changes:

  • Added compose.yml with nginx service configuration
  • Configured Traefik labels for reverse proxy routing to score.bsc-gp.de
  • Set up service to serve static files from ./dist directory
  • Configured SSL/TLS with automatic certificate resolution
  • Uses external Traefik network for integration

The service is now ready for containerized deployment with reverse proxy support.

Added Docker Compose configuration file (`compose.yml`) for deployment. **Commit**: f8d895ab21ac5267f6371f97addd98c0c966c01d **Changes:** - Added `compose.yml` with nginx service configuration - Configured Traefik labels for reverse proxy routing to `score.bsc-gp.de` - Set up service to serve static files from `./dist` directory - Configured SSL/TLS with automatic certificate resolution - Uses external Traefik network for integration The service is now ready for containerized deployment with reverse proxy support.
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: froxxxy/bscscore#30