@@ -133,7 +133,7 @@ function DesktopPanel({
onPin,
onUnpin,
children,
-}: {
+}: Readonly<{
isCollapsed: boolean;
side: "left" | "right";
creatureName: string;
@@ -143,7 +143,7 @@ function DesktopPanel({
onPin: () => void;
onUnpin: () => void;
children: ReactNode;
-}) {
+}>) {
const sideClasses = side === "left" ? "left-0 border-r" : "right-0 border-l";
const collapsedTranslate =
side === "right"
@@ -179,10 +179,10 @@ function DesktopPanel({
function MobileDrawer({
onDismiss,
children,
-}: {
+}: Readonly<{
onDismiss: () => void;
children: ReactNode;
-}) {
+}>) {
const { offsetX, isSwiping, handlers } = useSwipeToDismiss(onDismiss);
return (
@@ -239,7 +239,7 @@ export function StatBlockPanel({
onStartBulkImport,
onBulkImportDone,
sourceManagerMode,
-}: StatBlockPanelProps) {
+}: Readonly
) {
const [isDesktop, setIsDesktop] = useState(
() => globalThis.matchMedia("(min-width: 1024px)").matches,
);
diff --git a/apps/web/src/components/stat-block.tsx b/apps/web/src/components/stat-block.tsx
index ccecb2e..5c98efa 100644
--- a/apps/web/src/components/stat-block.tsx
+++ b/apps/web/src/components/stat-block.tsx
@@ -16,10 +16,10 @@ function abilityMod(score: number): string {
function PropertyLine({
label,
value,
-}: {
+}: Readonly<{
label: string;
value: string | undefined;
-}) {
+}>) {
if (!value) return null;
return (
@@ -34,7 +34,7 @@ function SectionDivider() {
);
}
-export function StatBlock({ creature }: StatBlockProps) {
+export function StatBlock({ creature }: Readonly) {
const abilities = [
{ label: "STR", score: creature.abilities.str },
{ label: "DEX", score: creature.abilities.dex },
diff --git a/apps/web/src/components/turn-navigation.tsx b/apps/web/src/components/turn-navigation.tsx
index e0e546a..5af9a81 100644
--- a/apps/web/src/components/turn-navigation.tsx
+++ b/apps/web/src/components/turn-navigation.tsx
@@ -15,7 +15,7 @@ export function TurnNavigation({
onAdvanceTurn,
onRetreatTurn,
onClearEncounter,
-}: TurnNavigationProps) {
+}: Readonly) {
const hasCombatants = encounter.combatants.length > 0;
const isAtStart = encounter.roundNumber === 1 && encounter.activeIndex === 0;
const activeCombatant = encounter.combatants[encounter.activeIndex];
diff --git a/packages/domain/src/edit-player-character.ts b/packages/domain/src/edit-player-character.ts
index eb59ccb..bcafc50 100644
--- a/packages/domain/src/edit-player-character.ts
+++ b/packages/domain/src/edit-player-character.ts
@@ -23,7 +23,7 @@ interface EditFields {
}
function validateFields(fields: EditFields): DomainError | null {
- if (fields.name !== undefined && fields.name.trim() === "") {
+ if (fields.name?.trim() === "") {
return {
kind: "domain-error",
code: "invalid-name",
@@ -81,9 +81,9 @@ function applyFields(
): PlayerCharacter {
return {
id: existing.id,
- name: fields.name === undefined ? existing.name : fields.name.trim(),
- ac: fields.ac === undefined ? existing.ac : fields.ac,
- maxHp: fields.maxHp === undefined ? existing.maxHp : fields.maxHp,
+ name: fields.name?.trim() ?? existing.name,
+ ac: fields.ac ?? existing.ac,
+ maxHp: fields.maxHp ?? existing.maxHp,
color:
fields.color === undefined
? existing.color