diff --git a/apps/web/src/views/notebook.tsx b/apps/web/src/views/notebook.tsx index d18699f3ca..8cfab13afb 100644 --- a/apps/web/src/views/notebook.tsx +++ b/apps/web/src/views/notebook.tsx @@ -163,6 +163,7 @@ function SubNotebooks({ const notebooks = useNotebookStore((store) => store.notebooks); const contextNotes = useNotesStore((store) => store.contextNotes); const context = useNotesStore((store) => store.context); + const [title, setTitle] = useState(); const saveViewState = useCallback((id: string) => { if (!treeRef.current?.viewState) return; @@ -198,8 +199,15 @@ function SubNotebooks({ }); }, [contextNotes, context]); - if (!rootId) return null; + useEffect(() => { + (async function () { + const notebook = await db.notebooks.notebook(rootId); + if (!notebook) return; + setTitle(notebook.title); + })(); + }); + if (!rootId) return null; return ( {isCollapsed ? : } - NOTEBOOKS + {title?.toUpperCase()} @@ -269,7 +277,6 @@ function SubNotebooks({ - { - if (id === "root") { - prev.push({ - data: { notebook: { title: "Root" } }, - index: id, - isFolder: true, - canMove: false, - canRename: false, - children: [rootId] - }); - return prev; - } + // if (id === "root") { + // prev.push({ + // data: { notebook: { title: "Root" } }, + // index: id, + // isFolder: true, + // canMove: false, + // canRename: false, + // children: [rootId] + // }); + // return prev; + // } const notebook = notebooks[id]; if (!notebook) return prev; @@ -401,7 +408,7 @@ function SubNotebooks({ {children} )} - rootItem="root" + rootItem={rootId} treeLabel="Tree Example" />