Temp(?) note refactors

This commit is contained in:
2026-01-23 11:53:57 +00:00
parent b5a84c076d
commit b5ac1df4e3
4 changed files with 41 additions and 26 deletions

View File

@@ -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(
<ListItem
key={key}
id={note.id}
label={note.title}
onSelect={() => setCurrentNoteId(note.id)}
/>
)
})
return out;
}
return (
<Sidebar>
@@ -32,14 +48,7 @@ function AppSidebar() {
<SidebarContent>
<ScrollArea className="h-full px-2 py-2">
<div className="space-y-1 py-2">
{notes.map((note) => (
<ListItem
key={note.id}
id={note.id}
label={note.title}
onSelect={() => setCurrentNote(note)}
/>
))}
{buildNoteListItems()}
</div>
<Button