AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(web): explain why the Inbox notebook cannot be deleted (#522)
X77c647f6b624f6
diff --git a/apps/web/src/components/NotebookPane.test.mjs b/apps/web/src/components/NotebookPane.test.mjsindex cc62f880..1bb27799 100644--- a/apps/web/src/components/NotebookPane.test.mjs+++ b/apps/web/src/components/NotebookPane.test.mjs@@ -147,3 +147,33 @@ describe("NotebookPane client downloads", () => {expect(source).not.toContain('src="/icons/platforms/');});});++const CLICK_GUARD = ` aria-disabled="true"+ onClick={(event) => {+ event.stopPropagation();+ }}`;+++describe("NotebookTreeItem inbox delete affordance", () => {+ test("explains why the starter Inbox notebook has no working delete action", () => {+ const treeItemSource = readFileSync(new URL("./NotebookTreeItem.tsx", import.meta.url), "utf8");+ const catalogs = ["en-US", "zh-CN", "ja", "pl"].map((locale) =>+ readFileSync(new URL(`../../../../packages/shared/src/i18n/${locale}.ts`, import.meta.url), "utf8"),+ );++ expect(treeItemSource).toContain('const isInbox = node.slug === "inbox"');++ // 说明必须是始终可见的 inline 文本:原生 title 在 disabled 项上不可达(pointer-events-none,+ // 且键盘焦点会跳过 disabled 项)。+ expect(treeItemSource).not.toContain('title={t("notebookTree.inboxDeleteHint")}');+ expect(treeItemSource.split('t("notebookTree.inboxDeleteHint")').length - 1).toBe(2);++ // 两个菜单各一份:行内操作菜单 + 右键菜单+ expect(treeItemSource).toContain(CLICK_GUARD);+ expect(treeItemSource).toContain('<ContextMenuSeparator className="my-1 h-px bg-slate-100" />\n <div');++ for (const catalog of catalogs) {+ expect(catalog).toContain("inboxDeleteHint:");+ }+ });+});diff --git a/apps/web/src/components/NotebookTreeItem.tsx b/apps/web/src/components/NotebookTreeItem.tsxindex d9db8c95..2bc0ecce 100644--- a/apps/web/src/components/NotebookTreeItem.tsx+++ b/apps/web/src/components/NotebookTreeItem.tsx@@ -328,7 +328,26 @@ export const NotebookTreeItem = ({<Pencil className="h-4 w-4" />{t("notebookTree.rename")}</button>- {!isInbox && (+ {isInbox ? (+ <>+ <div className="-mx-1 my-1 h-px bg-slate-100" />+ <div+ className="flex w-full cursor-not-allowed flex-col gap-0.5 rounded-sm px-2 py-1.5 text-left text-xs text-slate-400"+ aria-disabled="true"+ onClick={(event) => {+ event.stopPropagation();+ }}+ >+ <span className="flex items-center gap-2">+ <Trash2 className="h-4 w-4" />+ {t("notebookTree.deleteNotebook")}+ </span>+ <span className="pl-6 text-[11px] leading-4">+ {t("notebookTree.inboxDeleteHint")}+ </span>+ </div>+ </>+ ) : (<><div className="-mx-1 my-1 h-px bg-slate-100" /><button@@ -371,7 +390,23 @@ export const NotebookTreeItem = ({<Pencil className="h-4 w-4" />{t("notebookTree.rename")}</ContextMenuItem>- {!isInbox && (+ {isInbox ? (+ <>+ <ContextMenuSeparator className="my-1 h-px bg-slate-100" />+ <div+ className="flex cursor-not-allowed flex-col gap-0.5 px-3 py-1.5 text-xs text-slate-400"+ aria-disabled="true"+ >+ <span className="flex items-center gap-2">+ <Trash2 className="h-4 w-4" />+ {t("notebookTree.deleteNotebook")}+ </span>+ <span className="pl-6 text-[11px] leading-4">+ {t("notebookTree.inboxDeleteHint")}+ </span>+ </div>+ </>+ ) : (<><ContextMenuSeparator className="my-1 h-px bg-slate-100" /><ContextMenuItemdiff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.tsindex 52516b16..23ba6b65 100644--- a/packages/shared/src/i18n/en-US.ts+++ b/packages/shared/src/i18n/en-US.ts@@ -956,6 +956,7 @@ export const enUS = {renameAria: "Rename {{name}}",deleteNotebook: "Delete notebook",deleteAria: "Delete {{name}}",+ inboxDeleteHint: "Inbox is the default notebook for notes without one, and for notes restored after their original notebook was deleted, so it can't be deleted. You can rename it.",},settings: {title: "Me",diff --git a/packages/shared/src/i18n/ja.ts b/packages/shared/src/i18n/ja.tsindex a20411f3..91fc0e89 100644--- a/packages/shared/src/i18n/ja.ts+++ b/packages/shared/src/i18n/ja.ts@@ -945,6 +945,7 @@ export const ja = {renameAria: "{{name}} の名前を変更",deleteNotebook: "ノートブックを削除",deleteAria: "{{name}} を削除",+ inboxDeleteHint: "Inbox は所属先のないノート、および元のノートブックが削除された後に復元したノートの既定の保存先のため、削除できません。名前の変更は可能です。",},settings: {title: "マイ",diff --git a/packages/shared/src/i18n/pl.ts b/packages/shared/src/i18n/pl.tsindex 7a96d57a..13c72dba 100644--- a/packages/shared/src/i18n/pl.ts+++ b/packages/shared/src/i18n/pl.ts@@ -945,6 +945,7 @@ export const pl = {renameAria: "Zmień nazwę {{name}}",deleteNotebook: "Usuń notatnik",deleteAria: "Usuń {{name}}",+ inboxDeleteHint: "Inbox to domyślny notatnik dla notatek bez notatnika oraz notatek przywróconych po usunięciu ich pierwotnego notatnika, więc nie można go usunąć. Możesz zmienić jego nazwę.",},settings: {title: "Profil",diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.tsindex 81e097f0..77833446 100644--- a/packages/shared/src/i18n/zh-CN.ts+++ b/packages/shared/src/i18n/zh-CN.ts@@ -956,6 +956,7 @@ export const zhCN = {renameAria: "重命名 {{name}}",deleteNotebook: "删除笔记本",deleteAria: "删除 {{name}}",+ inboxDeleteHint: "Inbox 是没有指定笔记本的笔记、以及原笔记本被删除后恢复的笔记的默认归宿,因此不能删除。你可以重命名它。",},settings: {title: "我的",