From b5ac1df4e3a23e5b690e514788a137cf00ee9d5d Mon Sep 17 00:00:00 2001 From: rossw01 Date: Fri, 23 Jan 2026 11:53:57 +0000 Subject: [PATCH] Temp(?) note refactors --- src/components/AppSidebar.tsx | 27 ++++++++++++++++++--------- src/components/NoteEditor.tsx | 11 ++++++++--- src/contexts/ActiveNoteContext.tsx | 9 ++++----- src/contexts/NotesStore.tsx | 20 +++++++++++--------- 4 files changed, 41 insertions(+), 26 deletions(-) diff --git a/src/components/AppSidebar.tsx b/src/components/AppSidebar.tsx index 06a9e4c..0904623 100644 --- a/src/components/AppSidebar.tsx +++ b/src/components/AppSidebar.tsx @@ -10,12 +10,28 @@ import ListItem from "./ListItem" import { useNote } from "../contexts/ActiveNoteContext" import { useNotesStore } from "../contexts/NotesStore" import { useTheme } from "../contexts/ThemeContext" +import { ReactNode } from "react" function AppSidebar() { const { notes, createNote } = useNotesStore() - const { setCurrentNote } = useNote() + const { setCurrentNoteId } = useNote() const { theme, toggleTheme } = useTheme() + const buildNoteListItems = () => { + const out: ReactNode[] = [] + notes.forEach((note, key, _) => { + out.push( + setCurrentNoteId(note.id)} + /> + ) + }) + return out; + } + return ( @@ -32,14 +48,7 @@ function AppSidebar() {
- {notes.map((note) => ( - setCurrentNote(note)} - /> - ))} + {buildNoteListItems()}