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
refactor(editor): streamline header title and scale down metadata chrome
tianma-if0ac0ac345681
diff --git a/apps/web/src/components/DiagramEditorPane.tsx b/apps/web/src/components/DiagramEditorPane.tsxindex 313ed315..35867ad7 100644--- a/apps/web/src/components/DiagramEditorPane.tsx+++ b/apps/web/src/components/DiagramEditorPane.tsx@@ -3062,6 +3062,26 @@ export const DiagramEditorPane = ({<TooltipContent>{t("diagram.back")}</TooltipContent></Tooltip>)}+ titleInput={(+ <MemoTitleInput+ value={title}+ readOnly={readOnly}+ placeholder={kindLabel}+ ariaLabel={t("diagram.title")}+ onValueChange={(nextTitle) => {+ titleRef.current = nextTitle;+ setTitle(nextTitle);+ setDirtyVersion((current) => current + 1);+ const graph = graphRef.current;+ if (graph) {+ setDirty(savedSnapshotRef.current !== diagramEditorSnapshot(+ nextTitle,+ graphToDocument(graph, document.kind, themeRef.current, structureRef.current),+ ));+ }+ }}+ />+ )}/><div className="flex shrink-0 items-center gap-1">@@ -3081,7 +3101,7 @@ export const DiagramEditorPane = ({<m.spankey={saveStatus}className={cn(- "hidden items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium sm:inline-flex",+ "hidden items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] font-medium sm:inline-flex",saveStatusClassName,)}role="status"@@ -3166,26 +3186,6 @@ export const DiagramEditorPane = ({</div><div className={MEMO_EDITOR_TITLE_REGION_CLASS_NAME}>- <div className="min-w-0">- <MemoTitleInput- value={title}- readOnly={readOnly}- placeholder={kindLabel}- ariaLabel={t("diagram.title")}- onValueChange={(nextTitle) => {- titleRef.current = nextTitle;- setTitle(nextTitle);- setDirtyVersion((current) => current + 1);- const graph = graphRef.current;- if (graph) {- setDirty(savedSnapshotRef.current !== diagramEditorSnapshot(- nextTitle,- graphToDocument(graph, document.kind, themeRef.current, structureRef.current),- ));- }- }}- />- </div><MemoEditorMetadataRowcontentMarkdown={memo.contentMarkdown}disabled={readOnly}diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsxindex c03fdd03..27be766d 100644--- a/apps/web/src/components/EditorPane.tsx+++ b/apps/web/src/components/EditorPane.tsx@@ -3551,12 +3551,24 @@ const RichEditorPane = ({<ChevronLeft className="h-4 w-4" /></Button>)}+ titleInput={(+ <MemoTitleInput+ value={title}+ readOnly={effectiveReadOnly}+ onValueChange={(nextTitle) => {+ setTitle(nextTitle);+ persistCurrentDraft(nextTitle, tagsText, getMobilePlainTextValue());+ markDirty();+ }}+ placeholder={t("common.untitledMemo")}+ />+ )}/><div className="flex shrink-0 items-center gap-1">{isMemoShared && !readOnly && (<Button- className="h-8 gap-1.5 rounded-full bg-emerald-50 px-2 text-xs font-semibold text-emerald-700 ring-1 ring-inset ring-emerald-200 hover:bg-emerald-100 hover:text-emerald-800 focus-visible:ring-emerald-500"+ className="h-7 gap-1 rounded-full bg-emerald-50 px-2 text-[11px] font-medium text-emerald-700 ring-1 ring-inset ring-emerald-200 hover:bg-emerald-100 hover:text-emerald-800 focus-visible:ring-emerald-500"size="sm"variant="ghost"type="button"@@ -3564,7 +3576,7 @@ const RichEditorPane = ({aria-label={t("sharing.manage")}onClick={() => setShareOpen(true)}>- <Share2 className="h-3.5 w-3.5" aria-hidden="true" />+ <Share2 className="h-3 w-3" aria-hidden="true" /><span className="hidden sm:inline">{t("sharing.active")}</span></Button>)}@@ -3606,7 +3618,7 @@ const RichEditorPane = ({)}<m.spankey={`${saveState}-${String(hasUnsavedChanges)}`}- className={cn("hidden items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium sm:inline-flex", saveStateClassName)}+ className={cn("hidden items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] font-medium sm:inline-flex", saveStateClassName)}role="status"aria-live="polite"title={saveConflictReason ?? undefined}@@ -3694,7 +3706,7 @@ const RichEditorPane = ({{!effectiveReadOnly && (<IconTooltip label={`${t("aiAssistant.open")} (${formatShortcutBinding(shortcutSettings.openAiAssistant)})`}><Button className="hidden h-8 w-8 text-emerald-600 transition-colors hover:bg-emerald-50 hover:text-emerald-800 focus-visible:ring-2 focus-visible:ring-emerald-300 sm:inline-flex" size="icon" variant="ghost" aria-label={t("aiAssistant.open")} onClick={openAiAssistant}>- <Sparkles className="h-5 w-5" strokeWidth={2.25} />+ <Sparkles className="h-4 w-4" strokeWidth={1.75} /></Button></IconTooltip>)}@@ -3741,11 +3753,11 @@ const RichEditorPane = ({{wechatCopyState === "copying" ? (<LoaderCircle className="h-4 w-4 animate-spin" />) : wechatCopyState === "copied" ? (- <Check className="h-5 w-5" strokeWidth={2.75} />+ <Check className="h-4 w-4" strokeWidth={2.25} />) : wechatCopyState === "error" ? (- <CircleAlert className="h-5 w-5" strokeWidth={2.25} />+ <CircleAlert className="h-4 w-4" strokeWidth={1.75} />) : (- <WeChatIcon className="h-5 w-5" />+ <WeChatIcon className="h-4 w-4" />)}</Button></TooltipTrigger>@@ -3879,18 +3891,6 @@ const RichEditorPane = ({</div><div className={MEMO_EDITOR_TITLE_REGION_CLASS_NAME}>- <div className="min-w-0">- <MemoTitleInput- value={title}- readOnly={effectiveReadOnly}- onValueChange={(nextTitle) => {- setTitle(nextTitle);- persistCurrentDraft(nextTitle, tagsText, getMobilePlainTextValue());- markDirty();- }}- placeholder={t("common.untitledMemo")}- />- </div><MemoEditorMetadataRowcontentMarkdown={currentMarkdownForAi}disabled={effectiveReadOnly}@@ -3914,7 +3914,7 @@ const RichEditorPane = ({<IconTooltip label={`${t(desktopReadingProtection ? "editor.disableReadingProtection" : "editor.enableReadingProtection")} (${formatShortcutBinding(shortcutSettings.toggleReadingProtection)})`}><ButtonclassName={cn(- "hidden shrink-0 sm:inline-flex",+ "hidden h-7 w-7 shrink-0 sm:inline-flex",desktopReadingProtection && "bg-slate-100 text-slate-700 ring-1 ring-inset ring-slate-300 hover:bg-slate-200 hover:text-slate-900")}size="icon"@@ -3923,7 +3923,7 @@ const RichEditorPane = ({aria-pressed={desktopReadingProtection}onClick={toggleDesktopReadingProtection}>- {desktopReadingProtection ? <Lock className="h-4 w-4" /> : <LockOpen className="h-4 w-4" />}+ {desktopReadingProtection ? <Lock className="h-3.5 w-3.5" /> : <LockOpen className="h-3.5 w-3.5" />}</Button></IconTooltip>)}diff --git a/apps/web/src/components/EditorTagPicker.tsx b/apps/web/src/components/EditorTagPicker.tsxindex f8177e7b..6cff2779 100644--- a/apps/web/src/components/EditorTagPicker.tsx+++ b/apps/web/src/components/EditorTagPicker.tsx@@ -151,7 +151,7 @@ export const EditorTagPicker = ({ contentMarkdown, disabled, loadTags, title, va<buttontype="button"disabled={disabled}- className="flex h-7 min-w-0 max-w-[32rem] items-center gap-1 rounded-md border border-transparent px-1.5 text-left text-xs text-slate-500 outline-none transition hover:border-slate-200 hover:bg-slate-50 focus-visible:border-emerald-300 focus-visible:ring-2 focus-visible:ring-emerald-500/15 disabled:opacity-50 sm:h-8 sm:gap-1.5 sm:px-2 sm:text-sm"+ className="flex h-7 min-w-0 max-w-[32rem] items-center gap-1 rounded-md border border-transparent px-1.5 text-left text-xs text-slate-500 outline-none transition hover:border-slate-200 hover:bg-slate-50 focus-visible:border-emerald-300 focus-visible:ring-2 focus-visible:ring-emerald-500/15 disabled:opacity-50 sm:gap-1.5 sm:px-2"aria-label={t("editor.tagPicker.open")}onClick={() => setOpen(true)}>@@ -160,13 +160,13 @@ export const EditorTagPicker = ({ contentMarkdown, disabled, loadTags, title, va{selectedTags.slice(0, 3).map((tag) => (<spankey={tag}- className="rounded-sm border border-emerald-200/70 bg-emerald-50/70 px-1.5 py-0.5 text-[11px] font-medium text-emerald-800 transition-colors sm:text-xs"+ className="rounded-sm border border-emerald-200/70 bg-emerald-50/70 px-1.5 py-0.5 text-[11px] font-medium text-emerald-800 transition-colors">#{tag}</span>))}{selectedTags.length > 3 && (- <span className="text-[11px] font-medium text-slate-400 sm:text-xs">+{selectedTags.length - 3}</span>+ <span className="text-[11px] font-medium text-slate-400">+{selectedTags.length - 3}</span>)}</span>) : (@@ -182,20 +182,20 @@ export const EditorTagPicker = ({ contentMarkdown, disabled, loadTags, title, vatype="button"disabled={disabled || suggesting || selectedTags.length >= 24 || (!title.trim() && !contentMarkdown.trim())}className={aiStatus.kind === "error"- ? "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-rose-700 outline-none transition hover:bg-rose-50 focus-visible:ring-2 focus-visible:ring-rose-500/20 disabled:opacity-50 sm:h-8 sm:w-8"+ ? "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-rose-700 outline-none transition hover:bg-rose-50 focus-visible:ring-2 focus-visible:ring-rose-500/20 disabled:opacity-50": aiStatus.kind === "success"- ? "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-50 text-emerald-700 outline-none transition focus-visible:ring-2 focus-visible:ring-emerald-500/20 disabled:opacity-50 sm:h-8 sm:w-8"- : "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-emerald-700 outline-none transition hover:bg-emerald-50 focus-visible:ring-2 focus-visible:ring-emerald-500/20 disabled:opacity-50 sm:h-8 sm:w-8"}+ ? "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-emerald-50 text-emerald-700 outline-none transition focus-visible:ring-2 focus-visible:ring-emerald-500/20 disabled:opacity-50"+ : "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-emerald-700 outline-none transition hover:bg-emerald-50 focus-visible:ring-2 focus-visible:ring-emerald-500/20 disabled:opacity-50"}aria-label={aiDescription}onClick={() => void generateAndApplyTags()}>{suggesting- ? <Loader2 className="h-3.5 w-3.5 animate-spin sm:h-4 sm:w-4" />+ ? <Loader2 className="h-3.5 w-3.5 animate-spin" />: aiStatus.kind === "success"- ? <Check className="h-3.5 w-3.5 sm:h-4 sm:w-4" />+ ? <Check className="h-3.5 w-3.5" />: aiStatus.kind === "error"- ? <CircleAlert className="h-3.5 w-3.5 sm:h-4 sm:w-4" />- : <TagPlus className="h-3.5 w-3.5 sm:h-4 sm:w-4" />}+ ? <CircleAlert className="h-3.5 w-3.5" />+ : <TagPlus className="h-3.5 w-3.5" />}</button></TooltipTrigger><TooltipContent side="bottom">{aiDescription}</TooltipContent>diff --git a/apps/web/src/components/MemoEditorHeaderActions.tsx b/apps/web/src/components/MemoEditorHeaderActions.tsxindex d242d3af..58c645e8 100644--- a/apps/web/src/components/MemoEditorHeaderActions.tsx+++ b/apps/web/src/components/MemoEditorHeaderActions.tsx@@ -53,11 +53,11 @@ export const MemoEditorHeaderActions = ({aria-label={t("editor.searchCurrentMemo")}onClick={onSearch}>- <Search className="h-5 w-5" strokeWidth={2.25} />+ <Search className="h-4 w-4" strokeWidth={1.75} /></Button></IconTooltip>{textNoteActions}- <GitHubRepositoryLink className="hidden h-8 w-8 justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 min-[1600px]:inline-flex" iconClassName="h-5 w-5" />+ <GitHubRepositoryLink className="hidden h-8 w-8 justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 min-[1600px]:inline-flex" iconClassName="h-4 w-4" /><IconTooltip label={t("systemInfo.title")}><ButtonclassName="relative hidden h-8 w-8 text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-950 focus-visible:ring-2 focus-visible:ring-emerald-500/70 min-[1600px]:inline-flex"@@ -66,7 +66,7 @@ export const MemoEditorHeaderActions = ({aria-label={t("systemInfo.title")}onClick={() => handleSystemInfoOpenChange(true)}>- <Info className="h-5 w-5" strokeWidth={2.25} />+ <Info className="h-4 w-4" strokeWidth={1.75} />{deployedUpdateUnseen ? <span className="absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-emerald-500 ring-2 ring-white" /> : null}</Button></IconTooltip>diff --git a/apps/web/src/components/MemoEditorMetadataRow.tsx b/apps/web/src/components/MemoEditorMetadataRow.tsxindex 8dc3e12f..d424cd05 100644--- a/apps/web/src/components/MemoEditorMetadataRow.tsx+++ b/apps/web/src/components/MemoEditorMetadataRow.tsx@@ -61,7 +61,7 @@ export const MemoEditorMetadataRow = ({disabled={disabled || notebookUpdatePending}onValueChange={onNotebookChange}>- <SelectTrigger className="h-8 min-w-0 whitespace-nowrap border-transparent bg-transparent px-2 text-sm font-medium text-slate-600 hover:border-slate-200 hover:bg-slate-50 hover:text-slate-900">+ <SelectTrigger className="h-7 min-w-0 whitespace-nowrap border-transparent bg-transparent px-2 text-xs font-medium text-slate-600 hover:border-slate-200 hover:bg-slate-50 hover:text-slate-900"><SelectValue placeholder={t("editor.notebookPlaceholder")}>{currentNotebookLabel}</SelectValue></SelectTrigger><SelectContent className="max-h-60 rounded-md border border-slate-200 bg-card py-1 shadow-md">diff --git a/apps/web/src/components/MemoEditorTopRowLeading.tsx b/apps/web/src/components/MemoEditorTopRowLeading.tsxindex 1d375e8e..2e2315d4 100644--- a/apps/web/src/components/MemoEditorTopRowLeading.tsx+++ b/apps/web/src/components/MemoEditorTopRowLeading.tsx@@ -9,19 +9,22 @@ export const MemoEditorTopRowLeading = ({mobileBackButton,updatedLabel,onToggleDesktopFocusMode,+ titleInput,}: {desktopFocusMode: boolean;- mobileBackButton: ReactNode;+ mobileBackButton?: ReactNode;updatedLabel: string;onToggleDesktopFocusMode: () => void;+ titleInput?: ReactNode;}) => {const { t } = useTranslation();const focusModeLabel = t(desktopFocusMode ? "editor.exitFocusMode" : "editor.focusMode");return (- <div className="flex min-w-0 items-center gap-2 text-sm">+ <div className="flex min-w-0 flex-1 items-center gap-2 text-sm">{mobileBackButton}- <div className="hidden items-center lg:flex">+ {titleInput && <div className="min-w-0 flex-1">{titleInput}</div>}+ <div className="hidden shrink-0 items-center lg:flex"><IconTooltip label={focusModeLabel}><Buttonsize="sm"diff --git a/apps/web/src/components/MemoTitleInput.test.mjs b/apps/web/src/components/MemoTitleInput.test.mjsindex aec1af03..1359bfa2 100644--- a/apps/web/src/components/MemoTitleInput.test.mjs+++ b/apps/web/src/components/MemoTitleInput.test.mjs@@ -7,8 +7,8 @@ const diagramSource = readFileSync(new URL("./DiagramEditorPane.tsx", import.metdescribe("shared memo title input", () => {test("owns the title appearance and input constraints", () => {- expect(componentSource).toContain("text-xl font-bold");- expect(componentSource).toContain("sm:text-2xl");+ expect(componentSource).toContain("text-sm font-semibold");+ expect(componentSource).toContain("sm:text-base");expect(componentSource).not.toContain("lg:text-[26px]");expect(componentSource).toContain("focus-visible:bg-muted");expect(componentSource).toContain("maxLength={160}");diff --git a/apps/web/src/components/MemoTitleInput.tsx b/apps/web/src/components/MemoTitleInput.tsxindex 916c0bb5..2883cedc 100644--- a/apps/web/src/components/MemoTitleInput.tsx+++ b/apps/web/src/components/MemoTitleInput.tsx@@ -1,21 +1,31 @@+import type { ComponentPropsWithoutRef } from "react";+import { cn } from "@/lib/utils";+type MemoTitleInputProps = {ariaLabel?: string;+ className?: string;onValueChange: (value: string) => void;placeholder: string;readOnly?: boolean;value: string;-};+} & Omit<ComponentPropsWithoutRef<"input">, "onChange" | "value">;export const MemoTitleInput = ({ariaLabel,+ className,onValueChange,placeholder,readOnly = false,value,+ ...props}: MemoTitleInputProps) => (<input+ {...props}aria-label={ariaLabel ?? placeholder}- className="block w-full rounded-md border-0 bg-transparent text-xl font-bold leading-snug text-slate-950 outline-none transition placeholder:text-slate-300 focus-visible:bg-muted focus-visible:shadow-[inset_3px_0_0_var(--brand-green)] read-only:text-slate-600 read-only:focus-visible:bg-transparent read-only:focus-visible:shadow-none sm:text-2xl"+ className={cn(+ "block w-full rounded-md border-0 bg-transparent px-2 py-1 text-sm font-semibold leading-tight text-slate-900 outline-none transition placeholder:text-slate-300 hover:bg-slate-100/60 focus-visible:bg-muted focus-visible:shadow-[inset_3px_0_0_var(--brand-green)] read-only:text-slate-600 read-only:hover:bg-transparent read-only:focus-visible:bg-transparent read-only:focus-visible:shadow-none sm:text-base",+ className+ )}maxLength={160}onChange={(event) => onValueChange(event.target.value)}placeholder={placeholder}diff --git a/apps/web/src/components/NotebookPane.test.mjs b/apps/web/src/components/NotebookPane.test.mjsindex c4c9f24f..8d13382e 100644--- a/apps/web/src/components/NotebookPane.test.mjs+++ b/apps/web/src/components/NotebookPane.test.mjs@@ -47,7 +47,7 @@ test("keeps the desktop sync status bar and sidebar chrome compact without shrintest("lists diagram note types in the create menu without beta badges", () => {const createTypeMenu = source.split("const CreateMemoTypeItems")[1]?.split("const getSyncStatusLabel")[0];- const diagramSection = createTypeMenu?.split('onCreateMemo("table")')[0];+ const diagramSection = createTypeMenu?.split('onCreateMemo("infographic")')[0];expect(createTypeMenu).toContain('onCreateMemo()');expect(createTypeMenu).toContain('onCreateMemo("mind-map")');diff --git a/apps/web/src/components/ThemeToggle.tsx b/apps/web/src/components/ThemeToggle.tsxindex 85bfcc61..3d931757 100644--- a/apps/web/src/components/ThemeToggle.tsx+++ b/apps/web/src/components/ThemeToggle.tsx@@ -26,7 +26,7 @@ export const ThemeToggle = ({ className, showLabel = false }: { className?: striaria-label={label}onClick={() => setPreference(nextTheme)}>- {resolvedTheme === "dark" ? <SunMedium className="h-5 w-5" strokeWidth={2.25} /> : <MoonStar className="h-5 w-5" strokeWidth={2.25} />}+ {resolvedTheme === "dark" ? <SunMedium className="h-4 w-4" strokeWidth={1.75} /> : <MoonStar className="h-4 w-4" strokeWidth={1.75} />}{showLabel && <span className="inline text-xs font-medium lg:hidden">{label}</span>}</Button></TooltipTrigger>diff --git a/apps/web/src/components/execution/ExecutionCenterButton.tsx b/apps/web/src/components/execution/ExecutionCenterButton.tsxindex d38eafe9..89a5110f 100644--- a/apps/web/src/components/execution/ExecutionCenterButton.tsx+++ b/apps/web/src/components/execution/ExecutionCenterButton.tsx@@ -32,7 +32,7 @@ export const ExecutionCenterButton = ({ onClick, className }: ExecutionCenterBut)}onClick={onClick}>- <FileClock className="h-5 w-5" strokeWidth={2.1} />+ <FileClock className="h-4 w-4" strokeWidth={1.75} /></Button></TooltipTrigger><TooltipContent side="bottom">{t("executionHistory.openCenter")}</TooltipContent>