From b7406c4b54a8e0a7a7b80df6a99a7815be9c8c44 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 13 Mar 2026 18:01:20 +0100 Subject: [PATCH] Make player character color and icon optional Clicking an already-selected color or icon in the create/edit form now deselects it. PCs without a color use the default combatant styling; PCs without an icon show no icon. Domain, application, persistence, and display layers all updated to handle the optional fields. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/App.tsx | 4 +- apps/web/src/components/action-bar.tsx | 9 ++-- apps/web/src/components/color-palette.tsx | 2 +- .../src/components/create-player-modal.tsx | 14 +++--- apps/web/src/components/icon-grid.tsx | 2 +- apps/web/src/components/player-management.tsx | 11 ++--- apps/web/src/hooks/use-player-characters.ts | 12 ++++-- .../persistence/player-character-storage.ts | 13 ++++-- .../src/create-player-character-use-case.ts | 4 +- .../src/edit-player-character-use-case.ts | 4 +- .../__tests__/create-player-character.test.ts | 43 +++++++++++++++++++ .../__tests__/edit-player-character.test.ts | 16 +++++++ .../domain/src/create-player-character.ts | 8 ++-- packages/domain/src/edit-player-character.ts | 20 ++++++--- packages/domain/src/player-character-types.ts | 4 +- 15 files changed, 121 insertions(+), 45 deletions(-) diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index a4b7885..5692bba 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -431,8 +431,8 @@ export function App() { name, ac, maxHp, - color, - icon, + color: color ?? null, + icon: icon ?? null, }); } else { createPlayerCharacter(name, ac, maxHp, color, icon); diff --git a/apps/web/src/components/action-bar.tsx b/apps/web/src/components/action-bar.tsx index 631491f..ecae3eb 100644 --- a/apps/web/src/components/action-bar.tsx +++ b/apps/web/src/components/action-bar.tsx @@ -95,9 +95,12 @@ function AddModeSuggestions({