feat(web): NetX workbench, UME-only UI, i18n, and header status

- Replace sidebar app with workbench home and module tabs (openOrFocusModule)

- Remove legacy pages; add module registry, shared tab channel, WEB.md

- Add zh/en i18n, global ToastProvider, restore oclaw bridge pill in header

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-27 11:18:30 +08:00
parent 664775927b
commit 282dbe75af
33 changed files with 1631 additions and 1677 deletions

View file

@ -0,0 +1,7 @@
export function AppsGridIcon() {
return (
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden>
<path d="M4 4h7v7H4V4zm9 0h7v7h-7V4zM4 13h7v7H4v-7zm9 0h7v7h-7v-7z" />
</svg>
);
}

View file

@ -0,0 +1,67 @@
import { useEffect, useRef, useState } from "react";
import { useI18n, type Locale } from "../i18n";
export function HeaderMenu() {
const { t, locale, setLocale } = useI18n();
const [open, setOpen] = useState(false);
const rootRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!open) return;
const onDocClick = (ev: MouseEvent) => {
if (!rootRef.current?.contains(ev.target as Node)) setOpen(false);
};
const onKey = (ev: KeyboardEvent) => {
if (ev.key === "Escape") setOpen(false);
};
document.addEventListener("mousedown", onDocClick);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("mousedown", onDocClick);
document.removeEventListener("keydown", onKey);
};
}, [open]);
const pick = (next: Locale) => {
setLocale(next);
setOpen(false);
};
return (
<div className="header-menu header-menu--on-brand" ref={rootRef}>
<button
type="button"
className="header-menu__trigger header-menu__trigger--on-brand"
aria-label={t("layout.moreMenu")}
aria-haspopup="menu"
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
>
⋯
</button>
{open ? (
<div className="header-menu__panel header-menu__panel--light" role="menu">
<div className="header-menu__label header-menu__label--light">{t("layout.language")}</div>
<button
type="button"
role="menuitemradio"
className={`header-menu__item header-menu__item--light${locale === "zh" ? " header-menu__item--active-light" : ""}`}
aria-checked={locale === "zh"}
onClick={() => pick("zh")}
>
{t("layout.langZh")}
</button>
<button
type="button"
role="menuitemradio"
className={`header-menu__item header-menu__item--light${locale === "en" ? " header-menu__item--active-light" : ""}`}
aria-checked={locale === "en"}
onClick={() => pick("en")}
>
{t("layout.langEn")}
</button>
</div>
) : null}
</div>
);
}

View file

@ -0,0 +1,46 @@
import { useEffect, useRef, useState } from "react";
type Props = {
text: string;
ariaLabel: string;
};
export function HelpHint({ text, ariaLabel }: Props) {
const [open, setOpen] = useState(false);
const rootRef = useRef<HTMLSpanElement>(null);
useEffect(() => {
if (!open) return;
const onDocClick = (ev: MouseEvent) => {
if (!rootRef.current?.contains(ev.target as Node)) setOpen(false);
};
const onKey = (ev: KeyboardEvent) => {
if (ev.key === "Escape") setOpen(false);
};
document.addEventListener("mousedown", onDocClick);
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("mousedown", onDocClick);
document.removeEventListener("keydown", onKey);
};
}, [open]);
return (
<span className="help-hint" ref={rootRef}>
<button
type="button"
className="help-hint__trigger"
aria-label={ariaLabel}
aria-expanded={open}
onClick={() => setOpen((v) => !v)}
>
?
</button>
{open ? (
<div className="help-hint__popover" role="tooltip">
{text}
</div>
) : null}
</span>
);
}

View file

@ -0,0 +1,15 @@
import type { ModuleIconTone } from "../config/modules";
type Props = {
tone: ModuleIconTone;
};
export function WorkbenchCardIcon({ tone }: Props) {
return (
<span className={`wb-card__icon wb-card__icon--${tone}`} aria-hidden>
<svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
<path d="M12 2a2 2 0 0 1 2 2v1.07A7.002 7.002 0 0 1 19.93 11H21a2 2 0 0 1 0 4h-1.07A7.002 7.002 0 0 1 13 20.93V22a2 2 0 0 1-4 0v-1.07A7.002 7.002 0 0 1 4.07 15H3a2 2 0 0 1 0-4h1.07A7.002 7.002 0 0 1 11 5.07V4a2 2 0 0 1 2-2zm0 6a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" />
</svg>
</span>
);
}