// ———— App Shell (Sidebar + Topbar) ————
const { useState, useEffect, useMemo, useRef } = React;
const NAV = [
{ id: "collect", label: "采集", icon: Icon.Collect, badge: null },
{ id: "library", label: "知识库", icon: Icon.Library, badge: null },
{ id: "search", label: "搜索", icon: Icon.SearchPage },
{ id: "settings", label: "设置", icon: Icon.Settings },
];
function Sidebar({ page, onNav, onLogout }) {
const email = window.API ? window.API.currentEmail() : "";
const initial = email ? email[0].toUpperCase() : "?";
const [version, setVersion] = useState("...");
useEffect(() => {
fetch("/api/version")
.then(r => r.json())
.then(d => setVersion((d.version || "").slice(0, 16) || "v?.?"))
.catch(() => setVersion("v?.?"));
}, []);
return (
);
}
function Topbar({ page }) {
const titles = {
collect: "采集任务",
library: "知识库",
search: "语义搜索",
settings: "设置",
};
return (