diff --git a/src/inventory.tsx b/src/inventory.tsx index 52f70b1..7f69a79 100644 --- a/src/inventory.tsx +++ b/src/inventory.tsx @@ -112,6 +112,7 @@ export function Inventory({ onClose, session, onTearToBoard }: { onClose?: () => // onto the board as a note (when a board tear handler is available). function NotebookTool({ playthroughId, onTear }: { playthroughId?: string; onTear?: (text: string) => void }) { const [pages, setPages] = useState<{ id: string; text: string }[]>([]) + const [draft, setDraft] = useState('') useEffect(() => { if (!playthroughId) return fetch(`/api/playthroughs/${playthroughId}/notebook`).then(r => r.ok ? r.json() : []).then(setPages).catch(() => {}) @@ -121,10 +122,20 @@ function NotebookTool({ playthroughId, onTear }: { playthroughId?: string; onTea setPages(list => list.filter(page => page.id !== id)) } const tear = (page: { id: string; text: string }) => { onTear?.(page.text); void remove(page.id) } + const add = async () => { + const text = draft.trim() + if (!text || !playthroughId) return + const res = await fetch(`/api/playthroughs/${playthroughId}/notebook`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ text }) }) + if (res.ok) { const page = await res.json(); setPages(list => [...list, { id: page.id, text: page.text }]); setDraft('') } + } return
FIELD NOTEBOOK
- {!pages.length &&

Nothing noted yet. During a conversation, use “✎ Note this” to jot down what someone says.

} + {playthroughId &&
+