Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Show notebook hierarchy in mobile editors

yoma81aa11c2bdb8
diff --git a/apps/mobile/src/screens/WorkspaceScreen.tsx b/apps/mobile/src/screens/WorkspaceScreen.tsx
index 007cf2c9..2cbef12a 100644
--- a/apps/mobile/src/screens/WorkspaceScreen.tsx
+++ b/apps/mobile/src/screens/WorkspaceScreen.tsx
@@ -1661,17 +1661,7 @@ const CreateMemoModal = ({
<ScrollView contentContainerStyle={styles.editorForm}>
<Text style={styles.label}>笔记本</Text>
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
- {notebooks.map((notebook) => (
- <NotebookPill
- active={(notebookId || fallbackNotebookId) === notebook.id}
- key={notebook.id}
- label={notebook.name}
- memoCount={notebook.memoCount}
- onPress={() => setNotebookId(notebook.id)}
- />
- ))}
- </ScrollView>
+ <NotebookPicker notebooks={notebooks} onChange={setNotebookId} selectedNotebookId={notebookId || fallbackNotebookId} />
<Text style={styles.label}>标题</Text>
<TextInput onChangeText={setTitle} placeholder={DEFAULT_MEMO_TITLE} placeholderTextColor="#94a3b8" style={styles.titleInput} value={title} />
@@ -3864,17 +3854,7 @@ const EditMemoModal = ({
<ScrollView contentContainerStyle={styles.editorForm}>
<Text style={styles.label}>笔记本</Text>
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
- {notebooks.map((notebook) => (
- <NotebookPill
- active={notebookId === notebook.id}
- key={notebook.id}
- label={notebook.name}
- memoCount={notebook.memoCount}
- onPress={() => setNotebookId(notebook.id)}
- />
- ))}
- </ScrollView>
+ <NotebookPicker notebooks={notebooks} onChange={setNotebookId} selectedNotebookId={notebookId} />
<Text style={styles.label}>标题</Text>
<TextInput onChangeText={setTitle} placeholder={DEFAULT_MEMO_TITLE} placeholderTextColor="#94a3b8" style={styles.titleInput} value={title} />
@@ -4202,6 +4182,28 @@ const NotebookParentSelector = ({
</ScrollView>
);
+const NotebookPicker = ({
+ notebooks,
+ onChange,
+ selectedNotebookId,
+}: {
+ notebooks: Notebook[];
+ onChange: (notebookId: string) => void;
+ selectedNotebookId: string;
+}) => (
+ <ScrollView horizontal showsHorizontalScrollIndicator={false}>
+ {flattenNotebooks(notebooks).map(({ depth, notebook }) => (
+ <NotebookPill
+ active={selectedNotebookId === notebook.id}
+ key={notebook.id}
+ label={`${" ".repeat(depth)}${depth > 0 ? "└ " : ""}${notebook.name}`}
+ memoCount={notebook.memoCount}
+ onPress={() => onChange(notebook.id)}
+ />
+ ))}
+ </ScrollView>
+);
+
const NotebookPill = ({
active,
label,