From 32b69f8df1735628e8018c54640836a1cb17a40b Mon Sep 17 00:00:00 2001 From: Lukas Date: Sat, 14 Mar 2026 15:13:39 +0100 Subject: [PATCH] Use Readonly props and optional chaining/nullish coalescing Mark component props as Readonly<> across 15 component files and simplify edit-player-character field access with optional chaining and nullish coalescing. Co-Authored-By: Claude Opus 4.6 --- apps/web/src/components/action-bar.tsx | 8 ++++---- .../web/src/components/bulk-import-prompt.tsx | 2 +- .../web/src/components/bulk-import-toasts.tsx | 2 +- apps/web/src/components/color-palette.tsx | 2 +- apps/web/src/components/combatant-row.tsx | 20 +++++++++---------- apps/web/src/components/condition-picker.tsx | 2 +- apps/web/src/components/condition-tags.tsx | 2 +- .../src/components/create-player-modal.tsx | 2 +- apps/web/src/components/icon-grid.tsx | 2 +- apps/web/src/components/player-management.tsx | 2 +- .../src/components/source-fetch-prompt.tsx | 2 +- apps/web/src/components/source-manager.tsx | 4 +++- apps/web/src/components/stat-block-panel.tsx | 18 ++++++++--------- apps/web/src/components/stat-block.tsx | 6 +++--- apps/web/src/components/turn-navigation.tsx | 2 +- packages/domain/src/edit-player-character.ts | 8 ++++---- 16 files changed, 43 insertions(+), 41 deletions(-) diff --git a/apps/web/src/components/action-bar.tsx b/apps/web/src/components/action-bar.tsx index 4617c53..0a24e1e 100644 --- a/apps/web/src/components/action-bar.tsx +++ b/apps/web/src/components/action-bar.tsx @@ -9,7 +9,7 @@ import { Plus, Users, } from "lucide-react"; -import { type RefObject, useDeferredValue, useState } from "react"; +import React, { type RefObject, useDeferredValue, useState } from "react"; import type { SearchResult } from "../hooks/use-bestiary.js"; import { cn } from "../lib/utils.js"; import { D20Icon } from "./d20-icon.js"; @@ -62,7 +62,7 @@ function AddModeSuggestions({ onConfirmQueued, onAddFromPlayerCharacter, onClear, -}: { +}: Readonly<{ nameInput: string; suggestions: SearchResult[]; pcMatches: PlayerCharacter[]; @@ -75,7 +75,7 @@ function AddModeSuggestions({ onSetQueued: (q: QueuedCreature | null) => void; onConfirmQueued: () => void; onAddFromPlayerCharacter?: (pc: PlayerCharacter) => void; -}) { +}>) { return (