From 0835961bc9ab660c4c2ab50b839e38f7bcc2caf8 Mon Sep 17 00:00:00 2001 From: bot-hermes Date: Wed, 29 Jul 2026 19:26:13 +0000 Subject: [PATCH] 23: note templates - localStorage templates (Meeting notes, Daily journal, Brain dump) --- apps/web/app/(dashboard)/notes/page.tsx | 26 ++++ apps/web/components/notes/note-templates.tsx | 124 +++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 apps/web/components/notes/note-templates.tsx diff --git a/apps/web/app/(dashboard)/notes/page.tsx b/apps/web/app/(dashboard)/notes/page.tsx index fa07576..a05f763 100644 --- a/apps/web/app/(dashboard)/notes/page.tsx +++ b/apps/web/app/(dashboard)/notes/page.tsx @@ -5,6 +5,7 @@ import { Plus, FileText, Link2, GitBranch, Trash2, Pin, Archive, Search, PinOff, import dynamic from 'next/dynamic'; import { toast } from 'sonner'; import { Button } from '@/components/ui/button'; +import { NoteTemplates } from '@/components/notes/note-templates'; import { Card } from '@/components/ui/card'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Badge } from '@/components/ui/badge'; @@ -162,6 +163,28 @@ export default function NotesPage() { } } + async function createNoteWithContent(content: string) { + if (!domainId) return; + try { + const response = await fetch("/api/domains/" + domainId + "/notes", { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + title: 'Untitled note', + content, + }), + }); + if (!response.ok) throw new Error('Unable to create note.'); + const newNote = await response.json(); + setNotes((current) => [newNote, ...current]); + setSelectedNote(newNote); + toast.success('Note created from template'); + } catch (error) { + console.error('Failed to create note:', error); + toast.error('Unable to create note'); + } + } + async function createNote() { if (!domainId) return; try { @@ -315,6 +338,9 @@ export default function NotesPage() { ))} )} + { + createNoteWithContent(content); + }} /> + + + + + Choose a template + + Start with a pre-formatted note template. + + + +
+ {templates.map((template) => ( + + ))} +
+ + + Templates are stored locally in your browser. + +
+
+ + ); +}