feat(web): React 19 + Vite + Tailwind v4 + shadcn foundation

- design tokens ported verbatim from the product design, data-theme light/dark
- app shell: topbar, sidebar/rail/tabbar responsive nav, lang + theme menus
- ui primitives (button/card/badge/dot/chip/tabs/dialog/sheet/toast/kv/seg/progress)
- api client, reconnecting ws client, zustand stores, route guard to /connect
- full zh/en dictionaries (key parity test), 32 vitest specs, dist committed
This commit is contained in:
yuez committed 2026-10-21 11:33:36 +08:00
1 parent 4e98ef8658
commit 5b55e622ea
63 files changed
+8466

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { useParams } from "@tanstack/react-router";
import { useTranslation } from "react-i18next";
import { PageHeader } from "@/components/shared/page-header";
import { useSessionsStore } from "@/stores/sessions";
/** Placeholder for the chat route; the session tree/message stream land in W7c. */
export function ChatPage() {
const { t } = useTranslation();
const { sessionId } = useParams({ strict: false });
const session = useSessionsStore((state) => (sessionId ? state.getSession(sessionId) : undefined));
return (
<PageHeader
title={session?.name ?? t("nav.chat")}
subtitle={sessionId}
docTitle={t("nav.chat")}
/>
);
}
export function ChatIndexPage() {
const { t } = useTranslation();
return <PageHeader title={t("nav.chat")} subtitle={t("chat.search")} docTitle={t("nav.chat")} />;
}
+23
View File
@@ -0,0 +1,23 @@
import { useTranslation } from "react-i18next";
import { Icon } from "@/components/icons";
import { PageHeader } from "@/components/shared/page-header";
/** Placeholder for the pairing entry page; W7b builds the manual/scan flows. */
export function ConnectPage() {
const { t } = useTranslation();
return (
<div className="mx-auto w-full max-w-[32rem]">
<PageHeader
title={t("connect.title")}
subtitle={t("connect.subtitle")}
docTitle={t("connect.title")}
>
<p className="muted mt-3 flex items-start gap-2 text-[.8125rem]">
<Icon name="alert" className="mt-0.5 shrink-0" />
<span>{t("connect.secureNote")}</span>
</p>
</PageHeader>
</div>
);
}
+13
View File
@@ -0,0 +1,13 @@
import { useTranslation } from "react-i18next";
import { PageHeader } from "@/components/shared/page-header";
import { useConnectionStore } from "@/stores/connection";
/** Placeholder for the single-server status page; W7b fills the cards. */
export function StatusPage() {
const { t } = useTranslation();
const server = useConnectionStore((state) => state.server);
const subtitle = server ? `${server.name ?? "pi2.nvim"} · ${server.hostname ?? ""}` : t("status.notConnectedText");
return <PageHeader title={t("status.title")} subtitle={subtitle} docTitle={t("nav.status")} size="lg" />;
}
+20
View File
@@ -0,0 +1,20 @@
import { useParams } from "@tanstack/react-router";
import { useTranslation } from "react-i18next";
import { PageHeader } from "@/components/shared/page-header";
import { useWorkspacesStore } from "@/stores/workspaces";
/** Placeholder for the workspace detail route; W7b/W7c fill the content. */
export function WorkspacePage() {
const { t } = useTranslation();
const { workspaceId } = useParams({ strict: false });
const workspace = useWorkspacesStore((state) => state.items.find((item) => item.workspaceId === workspaceId));
return (
<PageHeader
title={workspace?.name ?? t("workspaces.title")}
subtitle={workspace?.cwd ?? workspaceId}
docTitle={t("workspaces.title")}
/>
);
}
+14
View File
@@ -0,0 +1,14 @@
import { useTranslation } from "react-i18next";
import { PageHeader } from "@/components/shared/page-header";
export function WorkspacesPage() {
const { t } = useTranslation();
return (
<PageHeader
title={t("workspaces.title")}
subtitle={t("workspaces.subtitle")}
docTitle={t("nav.workspaces")}
/>
);
}