From 1ef2f6338cf824ccaa4126313ee52e9e0db4aa47 Mon Sep 17 00:00:00 2001 From: Bas van Rossem Date: Thu, 19 Feb 2026 16:26:47 +0100 Subject: [PATCH] feat(web): implement weapons section with add/edit/detail modals and notes Adds WeaponCard with inline ammo stepper and status dropdown, AddWeaponModal, WeaponDetailModal with full editing, and debounced NotesSection. Co-Authored-By: Claude Opus 4.6 --- web/src/components/dashboard/NotesSection.tsx | 38 +++++ .../components/dashboard/WeaponsSection.tsx | 61 ++++++++ web/src/components/weapons/AddWeaponModal.tsx | 100 +++++++++++++ web/src/components/weapons/WeaponCard.tsx | 57 ++++++++ .../components/weapons/WeaponDetailModal.tsx | 137 ++++++++++++++++++ web/src/index.css | 96 ++++++++++++ web/src/pages/ShipDashboardPage.tsx | 12 +- 7 files changed, 499 insertions(+), 2 deletions(-) create mode 100644 web/src/components/dashboard/NotesSection.tsx create mode 100644 web/src/components/dashboard/WeaponsSection.tsx create mode 100644 web/src/components/weapons/AddWeaponModal.tsx create mode 100644 web/src/components/weapons/WeaponCard.tsx create mode 100644 web/src/components/weapons/WeaponDetailModal.tsx diff --git a/web/src/components/dashboard/NotesSection.tsx b/web/src/components/dashboard/NotesSection.tsx new file mode 100644 index 0000000..ba11278 --- /dev/null +++ b/web/src/components/dashboard/NotesSection.tsx @@ -0,0 +1,38 @@ +import { useState, useEffect, useRef } from 'react'; +import type { Ship } from '../../types/ship'; + +interface Props { + notes: string | null; + onUpdate: (patch: Partial) => void; +} + +export default function NotesSection({ notes, onUpdate }: Props) { + const [value, setValue] = useState(notes ?? ''); + const debounceRef = useRef | null>(null); + + // Sync from server updates + useEffect(() => { + setValue(notes ?? ''); + }, [notes]); + + const handleChange = (text: string) => { + setValue(text); + if (debounceRef.current) clearTimeout(debounceRef.current); + debounceRef.current = setTimeout(() => { + onUpdate({ notes: text || null }); + }, 500); + }; + + return ( +
+

Notes

+