Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(wiki): frame the wiki like the Agentic IDE

rubenluetke10-beep0e13e9541e48
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index 71cf41b9e0..4d692633a2 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -15,6 +15,7 @@ import { SectionNavButtons } from "@/components/layout/SectionNavButtons";
import { IdeLayoutSwitch } from "@/components/agentic/threads/IdeLayoutSwitch";
import { IDE_SECTIONS } from "@/lib/ideSections";
import { IdeSidePanelToggle } from "@/components/agentic/sidePanel/IdeSidePanelToggle";
+import { WikiInspectorToggle } from "@/components/wiki/WikiInspectorToggle";
import { useDesktopChrome, WindowControls } from "@/components/layout/WindowControls";
/**
@@ -98,6 +99,7 @@ export function TopBar() {
<div className="flex shrink-0 items-center">
<CodingModeBadge />
<IdeCaptionPanelToggle />
+ <WikiCaptionPanelToggle />
{controls === "trailing" && (
<WindowControls controls={controls} maximized={chrome.maximized} onCommand={chrome.command} />
)}
@@ -122,6 +124,12 @@ function IdeCaptionSwitch() {
);
}
+/** The Wiki inspector's open / close button, only on the Wiki section. */
+function WikiCaptionPanelToggle() {
+ const onWiki = useEventStore((s) => s.activeSection === "memory");
+ return onWiki ? <WikiInspectorToggle /> : null;
+}
+
/** The IDE side panel's open / close button, only on the IDE. */
function IdeCaptionPanelToggle() {
const onIde = useEventStore((s) => IDE_SECTIONS.includes(s.activeSection));
diff --git a/jarvis/ui/web/frontend/src/components/wiki/WikiInspector.tsx b/jarvis/ui/web/frontend/src/components/wiki/WikiInspector.tsx
index ad7a4f5d47..dc07c26cc0 100644
--- a/jarvis/ui/web/frontend/src/components/wiki/WikiInspector.tsx
+++ b/jarvis/ui/web/frontend/src/components/wiki/WikiInspector.tsx
@@ -12,7 +12,7 @@
*/
import { useMemo, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
-import { ArrowUpRight, RefreshCw } from "lucide-react";
+import { Activity, ArrowUpRight, FileText, RefreshCw } from "lucide-react";
import { cn } from "@/lib/utils";
import { useT, useUiLanguage } from "@/i18n";
@@ -34,6 +34,7 @@ import {
type LibraryItem,
} from "@/lib/wikiModel";
import { KindGlyph } from "@/components/wiki/KindGlyph";
+import { WIKI_INSPECTOR_ID } from "@/store/wikiPanel";
export type WikiHealthVisual = "green" | "amber" | "red" | "unknown";
@@ -119,21 +120,33 @@ export interface WikiInspectorProps {
export function WikiInspector(props: WikiInspectorProps) {
const t = useT();
+ const onPage = Boolean(props.selectedSlug);
+ const HeadIcon = onPage ? FileText : Activity;
+ // The Agentic IDE's side panel, in the Wiki: one step lighter than the
+ // stage, a rule on its left edge, and a 44 px head that lines up with the
+ // stage's own tab bar so the two read as one row.
return (
<aside
- className="flex h-full min-h-0 w-[280px] shrink-0 flex-col overflow-y-auto border-l border-border bg-sidebar 2xl:w-[320px]"
- data-testid={props.selectedSlug ? "wiki-inspector-page" : "wiki-backlinks-placeholder"}
+ id={WIKI_INSPECTOR_ID}
+ className="flex h-full min-h-0 w-[300px] shrink-0 flex-col border-l border-border bg-card/40"
+ data-testid={onPage ? "wiki-inspector-page" : "wiki-backlinks-placeholder"}
aria-label={t("wiki_ui.inspector_label")}
>
- {props.selectedSlug ? (
- <PageContext
- slug={props.selectedSlug}
- itemsBySlug={props.itemsBySlug}
- onSelect={props.onSelect}
- />
- ) : (
- <Overview {...props} />
- )}
+ <div className="flex h-11 shrink-0 items-center gap-2 border-b border-border px-4 text-sm font-medium text-foreground">
+ <HeadIcon className="h-4 w-4 text-muted-foreground" aria-hidden />
+ {t(onPage ? "wiki_ui.inspector_page" : "wiki_ui.inspector_overview")}
+ </div>
+ <div className="min-h-0 flex-1 overflow-y-auto">
+ {props.selectedSlug ? (
+ <PageContext
+ slug={props.selectedSlug}
+ itemsBySlug={props.itemsBySlug}
+ onSelect={props.onSelect}
+ />
+ ) : (
+ <Overview {...props} />
+ )}
+ </div>
</aside>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/wiki/WikiInspectorToggle.tsx b/jarvis/ui/web/frontend/src/components/wiki/WikiInspectorToggle.tsx
new file mode 100644
index 0000000000..99b14bf8e4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/wiki/WikiInspectorToggle.tsx
@@ -0,0 +1,39 @@
+import { PanelRightClose, PanelRightOpen } from "lucide-react";
+
+import { useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { WIKI_INSPECTOR_ID, useWikiPanelStore } from "@/store/wikiPanel";
+
+/**
+ * Opens and shuts the Wiki section's right-hand inspector from the window
+ * caption — the same place and the same glyph as the Agentic IDE's side-panel
+ * toggle, so the two sections share one habit. Kept free of the Wiki's own
+ * modules: the caption is in the startup chunk.
+ */
+export function WikiInspectorToggle({ className }: { className?: string }) {
+ const t = useT();
+ const open = useWikiPanelStore((state) => state.open);
+ const setOpen = useWikiPanelStore((state) => state.setOpen);
+ const label = t(open ? "wiki_ui.inspector_collapse" : "wiki_ui.inspector_expand");
+ const Icon = open ? PanelRightClose : PanelRightOpen;
+ return (
+ <button
+ type="button"
+ onClick={() => setOpen(!open)}
+ title={label}
+ aria-label={label}
+ aria-expanded={open}
+ aria-controls={WIKI_INSPECTOR_ID}
+ data-testid="wiki-inspector-toggle"
+ className={cn(
+ "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md",
+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ open && "text-foreground",
+ className,
+ )}
+ >
+ <Icon aria-hidden className="h-4 w-4" />
+ </button>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/wiki/WikiLibrary.tsx b/jarvis/ui/web/frontend/src/components/wiki/WikiLibrary.tsx
index adaf5d0abf..4f639ec2e8 100644
--- a/jarvis/ui/web/frontend/src/components/wiki/WikiLibrary.tsx
+++ b/jarvis/ui/web/frontend/src/components/wiki/WikiLibrary.tsx
@@ -35,6 +35,8 @@ export interface WikiLibraryProps {
isError: boolean;
selectedSlug: string | null;
onSelect: (slug: string) => void;
+ /** Drawn above the filter: the section's title, stats and search. */
+ header?: ReactNode;
}
export function WikiLibrary({
@@ -43,6 +45,7 @@ export function WikiLibrary({
isError,
selectedSlug,
onSelect,
+ header,
}: WikiLibraryProps) {
const t = useT();
const language = useUiLanguage();
@@ -70,11 +73,12 @@ export function WikiLibrary({
return (
<aside
- className="flex h-full min-h-0 w-[240px] shrink-0 flex-col border-r border-border bg-sidebar 2xl:w-[272px]"
+ className="flex h-full min-h-0 w-[264px] shrink-0 flex-col"
data-testid="wiki-tree-sidebar"
aria-label={t("wiki_ui.library_label")}
>
- <div className="shrink-0 p-3">
+ {header}
+ <div className="shrink-0 px-3 pb-2">
<div className="relative">
<Search
className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-faint"
@@ -91,9 +95,9 @@ export function WikiLibrary({
aria-label={t("wiki_ui.filter_placeholder")}
data-testid="wiki-library-filter"
className={cn(
- "h-8 w-full rounded-md border border-border bg-background pl-8 pr-7 text-sm text-foreground",
+ "h-8 w-full rounded-lg border border-transparent bg-transparent pl-8 pr-7 text-sm text-foreground hover:bg-secondary/60",
"placeholder:text-foreground-faint [&::-webkit-search-cancel-button]:hidden",
- "transition-colors focus-visible:border-accent focus-visible:outline-none",
+ "transition-colors focus-visible:border-border focus-visible:bg-input focus-visible:outline-none",
)}
/>
{filtering && (
@@ -227,10 +231,10 @@ function Row({
data-testid={testId}
title={item.title}
className={cn(
- "flex h-8 w-full items-center gap-2.5 rounded-md px-2 text-left text-base transition-colors",
+ "flex h-8 w-full items-center gap-2.5 rounded-lg px-2 text-left text-base transition-colors",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
active
- ? "bg-accent-soft text-foreground-strong"
+ ? "bg-secondary text-foreground-strong"
: "text-foreground-secondary hover:bg-secondary hover:text-foreground",
)}
>
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index ff29005558..544b10af36 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -4211,7 +4211,11 @@
"subtitle_curated": "kuratiert {0}",
"stage_label": "Gedächtniskarte und Seite",
"tab_map": "Gedächtniskarte",
- "close_page": "Seite schließen"
+ "close_page": "Seite schließen",
+ "inspector_collapse": "Seitenleiste ausblenden",
+ "inspector_expand": "Seitenleiste einblenden",
+ "inspector_overview": "Überblick",
+ "inspector_page": "Diese Seite"
},
"skill_create_dialog": {
"title": "Skill erstellen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 95c1475fb7..6f72f4b48a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -4211,7 +4211,11 @@
"subtitle_curated": "curated {0}",
"stage_label": "Memory map and page",
"tab_map": "Memory map",
- "close_page": "Close page"
+ "close_page": "Close page",
+ "inspector_collapse": "Hide the side panel",
+ "inspector_expand": "Show the side panel",
+ "inspector_overview": "Overview",
+ "inspector_page": "This page"
},
"skill_create_dialog": {
"title": "Create skill",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index fd06ebaeff..817f8834c6 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -4211,7 +4211,11 @@
"subtitle_curated": "curada {0}",
"stage_label": "Mapa de memoria y página",
"tab_map": "Mapa de memoria",
- "close_page": "Cerrar página"
+ "close_page": "Cerrar página",
+ "inspector_collapse": "Ocultar el panel lateral",
+ "inspector_expand": "Mostrar el panel lateral",
+ "inspector_overview": "Resumen",
+ "inspector_page": "Esta página"
},
"skill_create_dialog": {
"title": "Crear habilidad",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
index f1ba88169c..cb7541519d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/zh.json
@@ -4213,7 +4213,11 @@
"subtitle_curated": "整理于 {0}",
"stage_label": "记忆地图与页面",
"tab_map": "记忆地图",
- "close_page": "关闭页面"
+ "close_page": "关闭页面",
+ "inspector_collapse": "隐藏侧边栏",
+ "inspector_expand": "显示侧边栏",
+ "inspector_overview": "概览",
+ "inspector_page": "此页面"
},
"skill_create_dialog": {
"title": "创建技能",
diff --git a/jarvis/ui/web/frontend/src/store/wikiPanel.ts b/jarvis/ui/web/frontend/src/store/wikiPanel.ts
new file mode 100644
index 0000000000..eccff45d64
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/store/wikiPanel.ts
@@ -0,0 +1,39 @@
+import { create } from "zustand";
+
+/**
+ * Whether the Wiki section's right-hand inspector is open.
+ *
+ * The toggle lives in the window caption (like the Agentic IDE's side panel)
+ * and the section reads it, so the answer is one small store. It survives a
+ * reload through localStorage, which may be unavailable (private window,
+ * blocked storage) — then the panel simply starts open.
+ */
+const OPEN_KEY = "jarvis.wiki.inspector.open.v1";
+
+function readOpen(): boolean {
+ try {
+ return localStorage.getItem(OPEN_KEY) !== "0";
+ } catch {
+ return true;
+ }
+}
+
+interface WikiPanelState {
+ open: boolean;
+ setOpen: (open: boolean) => void;
+}
+
+export const useWikiPanelStore = create<WikiPanelState>((set) => ({
+ open: readOpen(),
+ setOpen: (open) => {
+ try {
+ localStorage.setItem(OPEN_KEY, open ? "1" : "0");
+ } catch {
+ // Storage unavailable: the choice holds for this session only.
+ }
+ set({ open });
+ },
+}));
+
+/** DOM id of the inspector, for the caption toggle's aria-controls. */
+export const WIKI_INSPECTOR_ID = "wiki-inspector";
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.test.tsx b/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
index 278aa993b9..041cfebb52 100644
--- a/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/WikiView.test.tsx
@@ -6,10 +6,11 @@
* client-side projection of that contract.
*/
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { WikiView } from "@/views/WikiView";
+import { useWikiPanelStore } from "@/store/wikiPanel";
import { PageRenderer, preprocessWikilinks } from "@/components/wiki/PageRenderer";
import { PageHeader } from "@/components/wiki/PageHeader";
import type {
@@ -277,6 +278,19 @@ describe("WikiView — populated tree", () => {
expect(screen.queryByTestId("wiki-backlinks-placeholder")).not.toBeNull();
});
+ it("hides the side panel when the caption toggle closes it", async () => {
+ useWikiPanelStore.setState({ open: false });
+ try {
+ renderWithClient(<WikiView />);
+ await screen.findByTestId("wiki-folder-entity");
+ expect(screen.queryByTestId("wiki-backlinks-placeholder")).toBeNull();
+ act(() => useWikiPanelStore.getState().setOpen(true));
+ expect(screen.queryByTestId("wiki-backlinks-placeholder")).not.toBeNull();
+ } finally {
+ useWikiPanelStore.setState({ open: true });
+ }
+ });
+
it("clicking a leaf in the tree switches to the page tab and loads the page", async () => {
renderWithClient(<WikiView />);
diff --git a/jarvis/ui/web/frontend/src/views/WikiView.tsx b/jarvis/ui/web/frontend/src/views/WikiView.tsx
index f3fe66dcbc..fa68f064a4 100644
--- a/jarvis/ui/web/frontend/src/views/WikiView.tsx
+++ b/jarvis/ui/web/frontend/src/views/WikiView.tsx
@@ -10,7 +10,7 @@
*
* ┌───────────┬──────────────────────────────┬────────────┐
* │ library │ stage: memory map | page │ inspector │
- * │ 272 px │ (fills the rest) │ 320 px │
+ * │ 264 px │ (fills the rest) │ 300 px │
* └───────────┴──────────────────────────────┴────────────┘
*
* The library finds a page, the stage shows it (or the whole vault as a
@@ -21,10 +21,10 @@ import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } fro
import { BookOpen, Maximize2, Minimize2, Network, Search, X } from "lucide-react";
import { useQuery } from "@tanstack/react-query";
-import { ViewHeader } from "@/views/ChatsView";
import { cn } from "@/lib/utils";
import { useT, useUiLanguage } from "@/i18n";
import { useEventStore } from "@/store/events";
+import { useWikiPanelStore } from "@/store/wikiPanel";
import {
fetchWikiHealth,
fetchWikiTree,
@@ -80,6 +80,8 @@ export function WikiView(): JSX.Element {
const [isReindexing, setIsReindexing] = useState(false);
const [reindexError, setReindexError] = useState<string | null>(null);
const searchRef = useRef<WikiSearchHandle>(null);
+ const inspectorOpen = useWikiPanelStore((s) => s.open);
+ const setInspectorOpen = useWikiPanelStore((s) => s.setOpen);
// A staged "open this page" request from another section (e.g. the Contacts
// detail's wiki link). `seq` bumps on every request, so re-opening the same
@@ -230,7 +232,6 @@ export function WikiView(): JSX.Element {
: [
t("wiki_ui.subtitle_pages").replace("{0}", formatCount(totalPages, language)),
t("wiki_ui.subtitle_links").replace("{0}", formatCount(totalLinks, language)),
- curated ? t("wiki_ui.subtitle_curated").replace("{0}", curated) : "",
]
.filter(Boolean)
.join(" · ");
@@ -239,53 +240,50 @@ export function WikiView(): JSX.Element {
? itemsBySlug.get(selectedSlug)?.title ?? cleanTitle(selectedSlug)
: "";
- return (
- <div className="flex h-full min-h-0 flex-col" data-testid="wiki-view">
- <ViewHeader
- icon={<BookOpen className="h-4 w-4" />}
- title={t("wiki_ui.title")}
- subtitle={subtitle}
- right={
- <>
- <button
- type="button"
- onClick={() => searchRef.current?.open()}
- data-testid="wiki-search-trigger"
- className="flex h-8 w-48 items-center gap-2 2xl:w-60 rounded-md border border-border bg-background px-2.5 text-sm text-foreground-faint transition-colors hover:border-border-strong hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- <Search className="h-3.5 w-3.5 shrink-0" aria-hidden />
- <span className="flex-1 truncate text-left">{t("wiki_ui.search_placeholder")}</span>
- <kbd className="rounded-sm border border-border px-1.5 font-mono text-xs leading-5">
- {IS_MAC ? "⌘K" : "Ctrl K"}
- </kbd>
- </button>
- <button
- type="button"
- onClick={closePage}
- data-testid="wiki-health-chip"
- data-visual={healthQuery.isLoading ? "loading" : healthVisual}
- title={t("wiki_ui.health_chip_title")}
- className="inline-flex h-8 items-center gap-2 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
- >
- <span
- className={cn(
- "h-2 w-2 rounded-full",
- healthQuery.isLoading ? "animate-pulse bg-faint-foreground" : HEALTH_DOT_STYLE[healthVisual],
- )}
- aria-hidden
- />
- {healthQuery.isLoading ? t("wiki_health.checking") : t(HEALTH_LABEL_KEY[healthVisual])}
- </button>
- <ObsidianStatus
- onOpenSetup={(s) => {
- setSetupHint(s);
- setDialogOpen(true);
- }}
- />
- </>
- }
+ const inspector = (
+ <WikiInspector
+ selectedSlug={selectedSlug}
+ itemsBySlug={itemsBySlug}
+ health={health}
+ healthLoading={healthQuery.isLoading}
+ isReindexing={isReindexing}
+ reindexError={reindexError}
+ onReindex={handleReindex}
+ onSelect={handleSelect}
+ />
+ );
+
+ const healthChip = (
+ <button
+ type="button"
+ onClick={() => {
+ closePage();
+ setInspectorOpen(true);
+ }}
+ data-testid="wiki-health-chip"
+ data-visual={healthQuery.isLoading ? "loading" : healthVisual}
+ title={t("wiki_ui.health_chip_title")}
+ className="inline-flex h-8 items-center gap-2 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"
+ >
+ <span
+ className={cn(
+ "h-2 w-2 rounded-full",
+ healthQuery.isLoading ? "animate-pulse bg-faint-foreground" : HEALTH_DOT_STYLE[healthVisual],
+ )}
+ aria-hidden
/>
+ {healthQuery.isLoading ? t("wiki_health.checking") : t(HEALTH_LABEL_KEY[healthVisual])}
+ </button>
+ );
+ // The section is drawn the way the Agentic IDE is: the window's gray ground
+ // carries the navigation column (title, search, the page library), and the
+ // working surface is one sheet in the room colour with a hairline rim and a
+ // rounded top-left corner. Inside the sheet the stage and the inspector are
+ // separated by a rule, and the inspector sits one step lighter — the IDE's
+ // side panel. Every region has an edge; nothing bleeds into its neighbour.
+ return (
+ <div className="flex h-full min-h-0 bg-sidebar" data-testid="wiki-view">
{dialogOpen && setupHint && (
<ObsidianSetupDialog
open={dialogOpen}
@@ -306,130 +304,155 @@ export function WikiView(): JSX.Element {
<WikiSearch ref={searchRef} onResultClick={handleSelect} />
- {treeQuery.isError ? (
- <div className="flex flex-1 items-center justify-center border-t border-border p-6">
- <p role="alert" className="max-w-reading text-base text-destructive" data-testid="wiki-tree-error">
- {t("wiki_view.load_error")}
- </p>
- </div>
- ) : !treeQuery.isLoading && totalPages === 0 ? (
- // An empty vault can itself be a symptom (a failed bootstrap writes
- // nothing), so the health rail stays beside the empty state.
- <div className="flex min-h-0 flex-1 overflow-hidden border-t border-border">
- <div className="flex min-w-0 flex-1 items-center justify-center p-6">
- <WikiEmptyState />
+ {!isGraphExpanded && (
+ <WikiLibrary
+ folders={folders}
+ isLoading={treeQuery.isLoading}
+ isError={treeQuery.isError}
+ selectedSlug={selectedSlug}
+ onSelect={handleSelect}
+ header={
+ <div className="px-4 pb-3 pt-3">
+ <div className="flex items-center gap-2.5">
+ <BookOpen className="h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
+ <h1 className="truncate text-lg font-semibold text-foreground-strong">{t("wiki_ui.title")}</h1>
+ </div>
+ <p className="mt-1 truncate text-sm text-muted-foreground" title={subtitle} data-testid="wiki-subtitle">
+ {subtitle}
+ </p>
+ {curated && totalPages > 0 && (
+ <p className="truncate text-sm text-foreground-faint">
+ {t("wiki_ui.subtitle_curated").replace("{0}", curated)}
+ </p>
+ )}
+ <button
+ type="button"
+ onClick={() => searchRef.current?.open()}
+ data-testid="wiki-search-trigger"
+ className="mt-4 flex h-8 w-full items-center gap-2 rounded-lg border border-border bg-input px-2.5 text-sm text-muted-foreground transition-colors hover:border-border-strong hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <Search className="h-3.5 w-3.5 shrink-0" aria-hidden />
+ <span className="flex-1 truncate text-left">{t("wiki_ui.search_placeholder")}</span>
+ <span className="flex shrink-0 items-center gap-0.5" aria-hidden>
+ {(IS_MAC ? ["⌘", "K"] : ["Ctrl", "K"]).map((key) => (
+ <kbd key={key} className="rounded border border-border bg-background px-1 font-sans text-xs leading-4 text-muted-foreground">
+ {key}
+ </kbd>
+ ))}
+ </span>
+ </button>
+ </div>
+ }
+ />
+ )}
+
+ <div
+ id="wiki-workspace"
+ className={cn(
+ "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background",
+ isGraphExpanded
+ ? // Expanded means the whole window: the map is the one thing in
+ // this app that gets better the more room it has.
+ "fixed inset-0 z-[100]"
+ : "rounded-tl-xl border-l border-t border-border",
+ )}
+ data-testid="wiki-workspace"
+ data-graph-expanded={isGraphExpanded ? "true" : "false"}
+ >
+ {treeQuery.isError ? (
+ <div className="flex flex-1 items-center justify-center p-6">
+ <p role="alert" className="max-w-reading text-base text-destructive" data-testid="wiki-tree-error">
+ {t("wiki_view.load_error")}
+ </p>
</div>
- <WikiInspector
- selectedSlug={null}
- itemsBySlug={itemsBySlug}
- health={health}
- healthLoading={healthQuery.isLoading}
- isReindexing={isReindexing}
- reindexError={reindexError}
- onReindex={handleReindex}
- onSelect={handleSelect}
- />
- </div>
- ) : (
- <div
- id="wiki-workspace"
- className={cn(
- "flex min-h-0 flex-1 overflow-hidden border-t border-border",
- // Expanded means the whole window: the map is the one thing in
- // this app that gets better the more room it has.
- isGraphExpanded && "fixed inset-0 z-[100] border-t-0 bg-background",
- )}
- data-testid="wiki-workspace"
- data-graph-expanded={isGraphExpanded ? "true" : "false"}
- >
- {!isGraphExpanded && (
- <WikiLibrary
- folders={folders}
- isLoading={treeQuery.isLoading}
- isError={treeQuery.isError}
- selectedSlug={selectedSlug}
- onSelect={handleSelect}
- />
- )}
-
- <section className="flex min-w-0 flex-1 flex-col" aria-label={t("wiki_ui.stage_label")}>
- <div className="flex h-11 shrink-0 items-stretch gap-1 border-b border-border px-3">
- <StageTab
- active={centreTab === "graph"}
- onClick={() => setCentreTab("graph")}
- icon={<Network className="h-3.5 w-3.5" aria-hidden />}
- label={t("wiki_ui.tab_map")}
- testId="wiki-tab-graph"
- />
- {selectedSlug && (
+ ) : !treeQuery.isLoading && totalPages === 0 ? (
+ // An empty vault can itself be a symptom (a failed bootstrap writes
+ // nothing), so the health rail stays beside the empty state.
+ <div className="flex min-h-0 flex-1">
+ <div className="flex min-w-0 flex-1 items-center justify-center p-6">
+ <WikiEmptyState />
+ </div>
+ {inspectorOpen && inspector}
+ </div>
+ ) : (
+ <div className="flex min-h-0 flex-1">
+ <section className="flex min-w-0 flex-1 flex-col" aria-label={t("wiki_ui.stage_label")}>
+ <div className="flex h-11 shrink-0 items-stretch gap-1 border-b border-border px-3">
<StageTab
- active={centreTab === "page"}
- onClick={() => {
- setCentreTab("page");
- setIsGraphExpanded(false);
- }}
- label={selectedTitle}
- testId="wiki-tab-page"
- onClose={closePage}
- closeLabel={t("wiki_ui.close_page")}
+ active={centreTab === "graph"}
+ onClick={() => setCentreTab("graph")}
+ icon={<Network className="h-3.5 w-3.5" aria-hidden />}
+ label={t("wiki_ui.tab_map")}
+ testId="wiki-tab-graph"
/>
- )}
- {centreTab === "graph" && (
- <button
- type="button"
- className="ml-auto inline-flex h-8 items-center gap-1.5 self-center rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- onClick={() => setIsGraphExpanded((expanded) => !expanded)}
- aria-controls="wiki-workspace"
- aria-expanded={isGraphExpanded}
- aria-label={t(
- isGraphExpanded ? "wiki_graph.restore_view_title" : "wiki_graph.expand_view_title",
- )}
- title={t(
- isGraphExpanded ? "wiki_graph.restore_view_title" : "wiki_graph.expand_view_title",
- )}
- data-testid="wiki-graph-expand-toggle"
- >
- {isGraphExpanded ? (
- <Minimize2 className="h-3.5 w-3.5" aria-hidden />
- ) : (
- <Maximize2 className="h-3.5 w-3.5" aria-hidden />
+ {selectedSlug && (
+ <StageTab
+ active={centreTab === "page"}
+ onClick={() => {
+ setCentreTab("page");
+ setIsGraphExpanded(false);
+ }}
+ label={selectedTitle}
+ testId="wiki-tab-page"
+ onClose={closePage}
+ closeLabel={t("wiki_ui.close_page")}
+ />
+ )}
+ <div className="ml-auto flex items-center gap-1 self-center">
+ {healthChip}
+ <ObsidianStatus
+ onOpenSetup={(s) => {
+ setSetupHint(s);
+ setDialogOpen(true);
+ }}
+ />
+ {centreTab === "graph" && (
+ <button
+ type="button"
+ className="inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ onClick={() => setIsGraphExpanded((expanded) => !expanded)}
+ aria-controls="wiki-workspace"
+ aria-expanded={isGraphExpanded}
+ aria-label={t(
+ isGraphExpanded ? "wiki_graph.restore_view_title" : "wiki_graph.expand_view_title",
+ )}
+ title={t(
+ isGraphExpanded ? "wiki_graph.restore_view_title" : "wiki_graph.expand_view_title",
+ )}
+ data-testid="wiki-graph-expand-toggle"
+ >
+ {isGraphExpanded ? (
+ <Minimize2 className="h-3.5 w-3.5" aria-hidden />
+ ) : (
+ <Maximize2 className="h-3.5 w-3.5" aria-hidden />
+ )}
+ <span>{t(isGraphExpanded ? "wiki_graph.restore" : "wiki_graph.expand")}</span>
+ </button>
)}
- <span>{t(isGraphExpanded ? "wiki_graph.restore" : "wiki_graph.expand")}</span>
- </button>
- )}
- </div>
+ </div>
+ </div>
- <div
- className={cn(
- "relative min-h-0 flex-1",
- centreTab === "page" ? "overflow-y-auto" : "overflow-hidden",
- )}
- >
- {centreTab === "graph" && (
- <Suspense fallback={<GraphSkeleton />}>
- <WikiGraph onNodeClick={handleSelect} highlightSlug={selectedSlug ?? undefined} />
- </Suspense>
- )}
- {centreTab === "page" && selectedSlug && (
- <PageRenderer key={selectedSlug} slug={selectedSlug} onWikilinkClick={handleSelect} />
- )}
- </div>
- </section>
-
- {!isGraphExpanded && (
- <WikiInspector
- selectedSlug={selectedSlug}
- itemsBySlug={itemsBySlug}
- health={health}
- healthLoading={healthQuery.isLoading}
- isReindexing={isReindexing}
- reindexError={reindexError}
- onReindex={handleReindex}
- onSelect={handleSelect}
- />
- )}
- </div>
- )}
+ <div
+ className={cn(
+ "relative min-h-0 flex-1",
+ centreTab === "page" ? "overflow-y-auto" : "overflow-hidden",
+ )}
+ >
+ {centreTab === "graph" && (
+ <Suspense fallback={<GraphSkeleton />}>
+ <WikiGraph onNodeClick={handleSelect} highlightSlug={selectedSlug ?? undefined} />
+ </Suspense>
+ )}
+ {centreTab === "page" && selectedSlug && (
+ <PageRenderer key={selectedSlug} slug={selectedSlug} onWikilinkClick={handleSelect} />
+ )}
+ </div>
+ </section>
+
+ {!isGraphExpanded && inspectorOpen && inspector}
+ </div>
+ )}
+ </div>
{toast && (
<div