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

+