feat(ui): split main shell into navigable pages
这个提交存在于:
父节点
bc93f24cdc
当前提交
cbe88dd592
共有 4 个文件被更改,包括 771 次插入 和 126 次删除
|
|
@ -112,3 +112,11 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo
|
|||
- Q5????????????/????????????????????????????
|
||||
- Q6????? JSON manifest ???? UI?????????????PNG/WebP ??????????????
|
||||
- ?????`2e84ea5`?`5dfac59`?`e0b48c0`?`9f235a3`?`4f13581`?`1828c61` ???? Forgejo?
|
||||
|
||||
## 2026-07-20??????????
|
||||
|
||||
- ?????????????????????????????????????
|
||||
- ????????????????/????/????????????
|
||||
- ???????????????????????????????????????????
|
||||
- ??????????????/?????????????????? Windows ?????
|
||||
- ?????TypeScript?ESLint?Vitest 6/6?Vite production build ???
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
|
|
@ -46,6 +46,14 @@ const emptyPolicy: ConnectionPolicyStatus = {
|
|||
duplicateServerInstanceWarnings: [],
|
||||
};
|
||||
|
||||
function openConnectionsPage() {
|
||||
fireEvent.click(screen.getByRole("button", { name: /连接/ }));
|
||||
}
|
||||
|
||||
function openDiagnosticsPage() {
|
||||
fireEvent.click(screen.getByRole("button", { name: /诊断与设置/ }));
|
||||
}
|
||||
|
||||
function mockBaseCommands(options?: {
|
||||
profiles?: ConnectionProfile[];
|
||||
slots?: ConnectionSlot[];
|
||||
|
|
@ -110,8 +118,10 @@ describe("App", () => {
|
|||
it("renders the verified Rust bootstrap status", async () => {
|
||||
render(<App />);
|
||||
|
||||
openDiagnosticsPage();
|
||||
expect(await screen.findByText("ready")).toBeInTheDocument();
|
||||
expect(screen.getByText("desktop-v1alpha1")).toBeInTheDocument();
|
||||
openConnectionsPage();
|
||||
expect(screen.getByText("连接 Profile")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
|
@ -137,7 +147,7 @@ describe("App", () => {
|
|||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText(/IPC unavailable:/)).toBeInTheDocument();
|
||||
expect(await screen.findByText(/IPC .*不可用:/)).toBeInTheDocument();
|
||||
expect(screen.queryByText("unexpected")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
|
@ -194,6 +204,7 @@ describe("App", () => {
|
|||
vi.spyOn(window, "confirm").mockReturnValue(true);
|
||||
|
||||
render(<App />);
|
||||
openConnectionsPage();
|
||||
expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument();
|
||||
|
||||
fireEvent.change(screen.getByLabelText("显示名称"), {
|
||||
|
|
@ -280,6 +291,7 @@ describe("App", () => {
|
|||
mockBaseCommands({ profiles });
|
||||
|
||||
render(<App />);
|
||||
openConnectionsPage();
|
||||
|
||||
fireEvent.change(await screen.findByLabelText("陪伴 Profile"), {
|
||||
target: { value: profiles[0].id },
|
||||
|
|
@ -333,6 +345,7 @@ describe("App", () => {
|
|||
});
|
||||
|
||||
render(<App />);
|
||||
openConnectionsPage();
|
||||
expect(await screen.findByText("尚未保存 Profile。")).toBeInTheDocument();
|
||||
|
||||
fireEvent.change(screen.getByLabelText("显示名称"), {
|
||||
|
|
@ -433,6 +446,7 @@ describe("App", () => {
|
|||
});
|
||||
|
||||
render(<App />);
|
||||
openConnectionsPage();
|
||||
|
||||
expect(
|
||||
await screen.findByLabelText("重复服务器实例提示"),
|
||||
|
|
|
|||
487
src/App.tsx
487
src/App.tsx
|
|
@ -7,6 +7,10 @@ import { ProfileManager } from "./features/profiles/ProfileManager";
|
|||
import { PetPackImporter } from "./features/pet/PetPackImporter";
|
||||
import { bootstrapStatusSchema, type BootstrapStatus } from "./types/bootstrap";
|
||||
|
||||
type PageKey = "chat" | "connections" | "desktop" | "pet" | "diagnostics";
|
||||
type ChatLayout = "single" | "focus-companion" | "focus-operations";
|
||||
type ChatSlot = "companion" | "operations";
|
||||
|
||||
const initialStatus: BootstrapStatus = {
|
||||
appVersion: "unknown",
|
||||
platform: "unknown",
|
||||
|
|
@ -15,21 +19,33 @@ const initialStatus: BootstrapStatus = {
|
|||
databaseSchemaVersion: 4,
|
||||
};
|
||||
|
||||
const navigation: Array<{ key: PageKey; label: string; description: string }> =
|
||||
[
|
||||
{ key: "chat", label: "聊天", description: "陪伴与运维对话" },
|
||||
{ key: "connections", label: "连接", description: "实例与槽位管理" },
|
||||
{ key: "desktop", label: "桌面行为", description: "快速聊天与状态气泡" },
|
||||
{ key: "pet", label: "桌宠", description: "形象与活动范围" },
|
||||
{
|
||||
key: "diagnostics",
|
||||
label: "诊断与设置",
|
||||
description: "运行状态与安全边界",
|
||||
},
|
||||
];
|
||||
|
||||
export function App() {
|
||||
const view = new URLSearchParams(window.location.search).get("view");
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const view = params.get("view");
|
||||
const isQuickView = view === "quick";
|
||||
const isBubbleView = view === "bubble";
|
||||
const quickSlot = new URLSearchParams(window.location.search).get("slot");
|
||||
const quickSlot = params.get("slot");
|
||||
const [page, setPage] = useState<PageKey>("chat");
|
||||
const [status, setStatus] = useState(initialStatus);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [chatLayout, setChatLayout] = useState<
|
||||
"single" | "focus-companion" | "focus-operations"
|
||||
>("single");
|
||||
const [quickTarget, setQuickTarget] = useState<"companion" | "operations">(
|
||||
() =>
|
||||
localStorage.getItem("astrbot.quickTarget") === "operations"
|
||||
? "operations"
|
||||
: "companion",
|
||||
const [chatLayout, setChatLayout] = useState<ChatLayout>("single");
|
||||
const [quickTarget, setQuickTarget] = useState<ChatSlot>(() =>
|
||||
localStorage.getItem("astrbot.quickTarget") === "operations"
|
||||
? "operations"
|
||||
: "companion",
|
||||
);
|
||||
const [bubbleTarget, setBubbleTarget] = useState<"main" | "quick">(() =>
|
||||
localStorage.getItem("astrbot.bubbleTarget") === "quick" ? "quick" : "main",
|
||||
|
|
@ -50,7 +66,7 @@ export function App() {
|
|||
}, [refreshStatus]);
|
||||
|
||||
if (isBubbleView) return <StatusBubble />;
|
||||
if (isQuickView)
|
||||
if (isQuickView) {
|
||||
return (
|
||||
<main className="quick-app-shell">
|
||||
<ChatPanel
|
||||
|
|
@ -64,120 +80,164 @@ export function App() {
|
|||
/>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="app-shell">
|
||||
<header className="hero">
|
||||
<p className="eyebrow">P02 路 dual connections</p>
|
||||
<h1>AstrBot Desktop</h1>
|
||||
<p className="subtitle">
|
||||
鍙屽疄渚嬮櫔浼翠笌鏈満鍔╂墜鐨勫畨鍏?Windows
|
||||
瀹㈡埛绔伐绋嬪簳搴с€?{" "}
|
||||
</p>
|
||||
</header>
|
||||
<aside className="app-sidebar">
|
||||
<div className="brand-lockup">
|
||||
<div className="brand-mark">A</div>
|
||||
<div>
|
||||
<strong>AstrBot Desktop</strong>
|
||||
<span>Companion workspace</span>
|
||||
</div>
|
||||
</div>
|
||||
<nav className="primary-nav" aria-label="主导航">
|
||||
{navigation.map((item) => (
|
||||
<button
|
||||
key={item.key}
|
||||
type="button"
|
||||
className={page === item.key ? "nav-item active" : "nav-item"}
|
||||
onClick={() => setPage(item.key)}
|
||||
>
|
||||
<span className="nav-item-icon">{navIcon(item.key)}</span>
|
||||
<span>
|
||||
<strong>{item.label}</strong>
|
||||
<small>{item.description}</small>
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
<div className="sidebar-footer">
|
||||
<span className="connection-dot" />
|
||||
<span>本地客户端已启动</span>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section className="status-grid" aria-label="bootstrap status">
|
||||
<StatusCard label="Rust Core" value={status.rustCore} />
|
||||
<StatusCard label="Platform" value={status.platform} />
|
||||
<StatusCard label="App Version" value={status.appVersion} />
|
||||
<StatusCard label="Protocol" value={status.protocolVersion} />
|
||||
</section>
|
||||
<StatusCard
|
||||
label="Database Schema"
|
||||
value={String(status.databaseSchemaVersion)}
|
||||
/>
|
||||
|
||||
{error ? <p className="error-banner">IPC unavailable: {error}</p> : null}
|
||||
|
||||
<section className="boundaries">
|
||||
<h2>瀹夊叏杈圭晫</h2>
|
||||
<ul>
|
||||
<li>凭据只在 Rust 与 Windows 安全存储之间流动。</li>
|
||||
<li>两个 REST/SSE 槽位保持独立状态与事件来源。</li>
|
||||
<li>本机操作必须经过白名单、策略与用户授权。</li>
|
||||
<li>文件事务默认保留源文件,且不会静默覆盖。</li>
|
||||
</ul>
|
||||
</section>
|
||||
<div className="chat-actions">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
void invoke("open_quick_chat_window", { slot: quickTarget })
|
||||
}
|
||||
>
|
||||
打开快速聊天
|
||||
</button>
|
||||
</div>
|
||||
<section className="desktop-behavior-settings" aria-label="??????">
|
||||
<label>
|
||||
<span>????????</span>
|
||||
<select
|
||||
value={quickTarget}
|
||||
onChange={(event) => {
|
||||
const value =
|
||||
event.target.value === "operations"
|
||||
? "operations"
|
||||
: "companion";
|
||||
setQuickTarget(value);
|
||||
localStorage.setItem("astrbot.quickTarget", value);
|
||||
}}
|
||||
>
|
||||
<option value="companion">Companion / ??</option>
|
||||
<option value="operations">Operations / ??</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span>??????</span>
|
||||
<select
|
||||
value={bubbleTarget}
|
||||
onChange={(event) => {
|
||||
const value = event.target.value === "quick" ? "quick" : "main";
|
||||
<section className="app-content">
|
||||
<PageHeader page={page} />
|
||||
{error ? <p className="error-banner">IPC 暂不可用:{error}</p> : null}
|
||||
{page === "chat" ? (
|
||||
<ChatPage
|
||||
chatLayout={chatLayout}
|
||||
quickTarget={quickTarget}
|
||||
onLayoutChange={setChatLayout}
|
||||
onOpenQuickChat={() =>
|
||||
void invoke("open_quick_chat_window", { slot: quickTarget })
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{page === "connections" ? <ProfileManager /> : null}
|
||||
{page === "desktop" ? (
|
||||
<DesktopBehaviorPage
|
||||
bubbleTarget={bubbleTarget}
|
||||
quickTarget={quickTarget}
|
||||
onBubbleTargetChange={(value) => {
|
||||
setBubbleTarget(value);
|
||||
localStorage.setItem("astrbot.bubbleTarget", value);
|
||||
}}
|
||||
>
|
||||
<option value="main">?????</option>
|
||||
<option value="quick">??????</option>
|
||||
</select>
|
||||
</label>
|
||||
onQuickTargetChange={(value) => {
|
||||
setQuickTarget(value);
|
||||
localStorage.setItem("astrbot.quickTarget", value);
|
||||
}}
|
||||
onOpenQuickChat={() =>
|
||||
void invoke("open_quick_chat_window", { slot: quickTarget })
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
{page === "pet" ? <PetPage /> : null}
|
||||
{page === "diagnostics" ? (
|
||||
<DiagnosticsPage
|
||||
status={status}
|
||||
onRefresh={() => void refreshStatus()}
|
||||
/>
|
||||
) : null}
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
<section className="chat-workspace" aria-label="???????">
|
||||
<div className="chat-workspace-toolbar">
|
||||
<strong>????</strong>
|
||||
<button
|
||||
className={
|
||||
chatLayout === "single"
|
||||
? "button-secondary active"
|
||||
: "button-secondary"
|
||||
}
|
||||
type="button"
|
||||
onClick={() => setChatLayout("single")}
|
||||
>
|
||||
???
|
||||
</button>
|
||||
<button
|
||||
className={
|
||||
chatLayout === "focus-companion"
|
||||
? "button-secondary active"
|
||||
: "button-secondary"
|
||||
}
|
||||
type="button"
|
||||
onClick={() => setChatLayout("focus-companion")}
|
||||
>
|
||||
????
|
||||
</button>
|
||||
<button
|
||||
className={
|
||||
chatLayout === "focus-operations"
|
||||
? "button-secondary active"
|
||||
: "button-secondary"
|
||||
}
|
||||
type="button"
|
||||
onClick={() => setChatLayout("focus-operations")}
|
||||
>
|
||||
????
|
||||
</button>
|
||||
function navIcon(page: PageKey) {
|
||||
return {
|
||||
chat: "⌁",
|
||||
connections: "◎",
|
||||
desktop: "◈",
|
||||
pet: "✦",
|
||||
diagnostics: "⚙",
|
||||
}[page];
|
||||
}
|
||||
|
||||
function PageHeader({ page }: { page: PageKey }) {
|
||||
const current = navigation.find((item) => item.key === page) ?? navigation[0];
|
||||
return (
|
||||
<header className="page-header">
|
||||
<div>
|
||||
<p className="eyebrow">AstrBot Desktop</p>
|
||||
<h1>{current.label}</h1>
|
||||
<p className="subtitle">
|
||||
{current.description},所有本机能力都经过客户端权限边界。
|
||||
</p>
|
||||
</div>
|
||||
<div className="header-status-pill">
|
||||
<span className="connection-dot" />
|
||||
双槽位架构
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
function ChatPage({
|
||||
chatLayout,
|
||||
quickTarget,
|
||||
onLayoutChange,
|
||||
onOpenQuickChat,
|
||||
}: {
|
||||
chatLayout: ChatLayout;
|
||||
quickTarget: ChatSlot;
|
||||
onLayoutChange: (layout: ChatLayout) => void;
|
||||
onOpenQuickChat: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="page-stack">
|
||||
<section className="welcome-card">
|
||||
<div>
|
||||
<span className="section-kicker">Conversation hub</span>
|
||||
<h2>今天想和哪个实例聊天?</h2>
|
||||
<p>陪伴实例适合日常交流,运维实例用于经过确认的本机诊断提案。</p>
|
||||
</div>
|
||||
<button type="button" onClick={onOpenQuickChat}>
|
||||
打开快速聊天
|
||||
</button>
|
||||
</section>
|
||||
<section className="chat-workspace" aria-label="聊天工作区">
|
||||
<div className="workspace-toolbar">
|
||||
<div>
|
||||
<span className="section-kicker">Workspace view</span>
|
||||
<strong>对话布局</strong>
|
||||
</div>
|
||||
<div className="segmented-control">
|
||||
<LayoutButton
|
||||
active={chatLayout === "single"}
|
||||
onClick={() => onLayoutChange("single")}
|
||||
>
|
||||
单面板
|
||||
</LayoutButton>
|
||||
<LayoutButton
|
||||
active={chatLayout === "focus-companion"}
|
||||
onClick={() => onLayoutChange("focus-companion")}
|
||||
>
|
||||
聚焦陪伴
|
||||
</LayoutButton>
|
||||
<LayoutButton
|
||||
active={chatLayout === "focus-operations"}
|
||||
onClick={() => onLayoutChange("focus-operations")}
|
||||
>
|
||||
聚焦运维
|
||||
</LayoutButton>
|
||||
</div>
|
||||
<span className="toolbar-note">
|
||||
快速聊天目标:{slotLabel(quickTarget)}
|
||||
</span>
|
||||
</div>
|
||||
<ChatPanel
|
||||
fixedSlot={
|
||||
|
|
@ -189,21 +249,200 @@ export function App() {
|
|||
}
|
||||
/>
|
||||
</section>
|
||||
<ProfileManager />
|
||||
<PetPackImporter />
|
||||
|
||||
<button type="button" onClick={() => void refreshStatus()}>
|
||||
閲嶆柊妫€鏌?IPC
|
||||
</button>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LayoutButton({
|
||||
active,
|
||||
children,
|
||||
onClick,
|
||||
}: {
|
||||
active: boolean;
|
||||
children: React.ReactNode;
|
||||
onClick: () => void;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={active ? "segment active" : "segment"}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function DesktopBehaviorPage({
|
||||
bubbleTarget,
|
||||
quickTarget,
|
||||
onBubbleTargetChange,
|
||||
onQuickTargetChange,
|
||||
onOpenQuickChat,
|
||||
}: {
|
||||
bubbleTarget: "main" | "quick";
|
||||
quickTarget: ChatSlot;
|
||||
onBubbleTargetChange: (value: "main" | "quick") => void;
|
||||
onQuickTargetChange: (value: ChatSlot) => void;
|
||||
onOpenQuickChat: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="page-stack">
|
||||
<section className="settings-grid">
|
||||
<SettingCard
|
||||
title="快速聊天"
|
||||
description="设置气泡或快捷入口打开哪个实例。"
|
||||
>
|
||||
<label>
|
||||
<span>默认目标槽位</span>
|
||||
<select
|
||||
value={quickTarget}
|
||||
onChange={(event) =>
|
||||
onQuickTargetChange(event.target.value as ChatSlot)
|
||||
}
|
||||
>
|
||||
<option value="companion">陪伴实例</option>
|
||||
<option value="operations">运维实例</option>
|
||||
</select>
|
||||
</label>
|
||||
<button type="button" onClick={onOpenQuickChat}>
|
||||
立即打开快速聊天
|
||||
</button>
|
||||
</SettingCard>
|
||||
<SettingCard
|
||||
title="状态气泡"
|
||||
description="气泡显示连接状态,并根据这里的设置响应点击。"
|
||||
>
|
||||
<label>
|
||||
<span>点击气泡时</span>
|
||||
<select
|
||||
value={bubbleTarget}
|
||||
onChange={(event) =>
|
||||
onBubbleTargetChange(event.target.value as "main" | "quick")
|
||||
}
|
||||
>
|
||||
<option value="main">打开主界面</option>
|
||||
<option value="quick">打开快速聊天</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="status-preview">
|
||||
<span className="connection-dot" />
|
||||
气泡状态显示已预留
|
||||
</div>
|
||||
</SettingCard>
|
||||
</section>
|
||||
<section className="info-card">
|
||||
<span className="section-kicker">Desktop companion</span>
|
||||
<h2>后续桌面能力</h2>
|
||||
<div className="feature-list">
|
||||
<span>托盘与单实例</span>
|
||||
<span>窗口置顶开关</span>
|
||||
<span>多显示器策略</span>
|
||||
<span>游戏模式靠边活动</span>
|
||||
</div>
|
||||
<p>
|
||||
这些能力先保留为独立设置区,后续接入 Rust
|
||||
本机能力层,不会与聊天状态混在一起。
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PetPage() {
|
||||
return (
|
||||
<div className="page-stack">
|
||||
<PetPackImporter />
|
||||
<section className="settings-grid">
|
||||
<SettingCard
|
||||
title="显示范围"
|
||||
description="决定桌宠只在应用内显示,还是允许在整个桌面活动。"
|
||||
>
|
||||
<select defaultValue="app">
|
||||
<option value="app">仅应用 UI 内</option>
|
||||
<option value="desktop">整个桌面</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
<SettingCard
|
||||
title="活动策略"
|
||||
description="为后续游戏模式和双屏行为预留配置入口。"
|
||||
>
|
||||
<select defaultValue="smart">
|
||||
<option value="smart">智能选择显示器</option>
|
||||
<option value="primary">固定主屏</option>
|
||||
<option value="secondary">优先副屏</option>
|
||||
</select>
|
||||
</SettingCard>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DiagnosticsPage({
|
||||
status,
|
||||
onRefresh,
|
||||
}: {
|
||||
status: BootstrapStatus;
|
||||
onRefresh: () => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="page-stack">
|
||||
<section className="status-grid" aria-label="bootstrap status">
|
||||
<StatusCard label="Rust Core" value={status.rustCore} />
|
||||
<StatusCard label="Platform" value={status.platform} />
|
||||
<StatusCard label="App Version" value={status.appVersion} />
|
||||
<StatusCard label="Protocol" value={status.protocolVersion} />
|
||||
<StatusCard
|
||||
label="Database Schema"
|
||||
value={String(status.databaseSchemaVersion)}
|
||||
/>
|
||||
</section>
|
||||
<section className="boundaries">
|
||||
<span className="section-kicker">Security boundary</span>
|
||||
<h2>本机能力保持可审计</h2>
|
||||
<ul>
|
||||
<li>凭据只在 Rust 与 Windows 安全存储之间流动。</li>
|
||||
<li>两个 REST/SSE 槽位保持独立状态、会话、消息与未读数。</li>
|
||||
<li>本机操作必须经过白名单、角色、路径和用户授权。</li>
|
||||
<li>文件事务默认保留源文件,不静默覆盖目标。</li>
|
||||
</ul>
|
||||
</section>
|
||||
<button type="button" onClick={onRefresh}>
|
||||
刷新 IPC 状态
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SettingCard({
|
||||
title,
|
||||
description,
|
||||
children,
|
||||
}: {
|
||||
title: string;
|
||||
description: string;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="setting-card">
|
||||
<div>
|
||||
<span className="section-kicker">Settings</span>
|
||||
<h2>{title}</h2>
|
||||
<p>{description}</p>
|
||||
</div>
|
||||
<div className="setting-card-controls">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function slotLabel(slot: ChatSlot) {
|
||||
return slot === "companion" ? "陪伴实例" : "运维实例";
|
||||
}
|
||||
|
||||
interface StatusCardProps {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
function StatusCard({ label, value }: StatusCardProps) {
|
||||
return (
|
||||
<article className="status-card">
|
||||
|
|
|
|||
384
src/styles.css
384
src/styles.css
|
|
@ -717,3 +717,387 @@ select:focus {
|
|||
color: #c8f7dc;
|
||||
background: rgb(20 83 57 / 45%);
|
||||
}
|
||||
|
||||
|
||||
/* Main shell information architecture */
|
||||
.app-shell {
|
||||
display: grid;
|
||||
grid-template-columns: 248px minmax(0, 1fr);
|
||||
width: min(1440px, calc(100% - 2rem));
|
||||
min-height: calc(100vh - 2rem);
|
||||
margin: 1rem auto;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgb(137 175 232 / 22%);
|
||||
border-radius: 1.4rem;
|
||||
background: rgb(8 17 31 / 72%);
|
||||
box-shadow: 0 2rem 5rem rgb(0 0 0 / 25%);
|
||||
}
|
||||
|
||||
.app-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2rem;
|
||||
padding: 1.5rem 1rem;
|
||||
border-right: 1px solid rgb(137 175 232 / 18%);
|
||||
background: rgb(7 18 34 / 70%);
|
||||
}
|
||||
|
||||
.brand-lockup {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
.brand-lockup > div:last-child {
|
||||
display: grid;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.brand-lockup strong {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.brand-lockup span {
|
||||
color: #8fa4c5;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
.brand-mark {
|
||||
display: grid;
|
||||
width: 2.35rem;
|
||||
height: 2.35rem;
|
||||
place-items: center;
|
||||
border: 1px solid #79aaff;
|
||||
border-radius: 0.75rem;
|
||||
color: #08111f;
|
||||
background: linear-gradient(145deg, #b9d5ff, #6aa3ff);
|
||||
font-weight: 800;
|
||||
}
|
||||
.primary-nav {
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
.nav-item {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 0.75rem 0.7rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 0.8rem;
|
||||
text-align: left;
|
||||
background: transparent;
|
||||
}
|
||||
.nav-item:hover {
|
||||
border-color: rgb(137 175 232 / 25%);
|
||||
background: rgb(36 80 140 / 28%);
|
||||
}
|
||||
.nav-item.active {
|
||||
border-color: rgb(125 176 255 / 55%);
|
||||
background: rgb(36 80 140 / 55%);
|
||||
}
|
||||
.nav-item > span:last-child {
|
||||
display: grid;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
.nav-item strong {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.nav-item small {
|
||||
color: #91a7c9;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
.nav-item-icon {
|
||||
display: grid;
|
||||
width: 1.8rem;
|
||||
height: 1.8rem;
|
||||
place-items: center;
|
||||
border-radius: 0.55rem;
|
||||
color: #aaccff;
|
||||
background: rgb(106 163 255 / 15%);
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.sidebar-footer {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding: 0.75rem 0.5rem 0;
|
||||
border-top: 1px solid rgb(137 175 232 / 16%);
|
||||
color: #91a7c9;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.connection-dot {
|
||||
display: inline-block;
|
||||
width: 0.55rem;
|
||||
height: 0.55rem;
|
||||
flex: 0 0 auto;
|
||||
border-radius: 50%;
|
||||
background: #60d399;
|
||||
box-shadow: 0 0 0.8rem rgb(96 211 153 / 75%);
|
||||
}
|
||||
.app-content {
|
||||
min-width: 0;
|
||||
padding: 2.25rem clamp(1.25rem, 4vw, 3.5rem) 3rem;
|
||||
overflow: auto;
|
||||
}
|
||||
.page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
align-items: start;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.page-header h1 {
|
||||
margin: 0.35rem 0 0.55rem;
|
||||
font-size: clamp(2rem, 5vw, 3.4rem);
|
||||
}
|
||||
.page-header .subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.98rem;
|
||||
}
|
||||
.header-status-pill {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
padding: 0.6rem 0.8rem;
|
||||
border: 1px solid rgb(96 211 153 / 35%);
|
||||
border-radius: 999px;
|
||||
color: #c8f7dc;
|
||||
background: rgb(20 83 57 / 28%);
|
||||
font-size: 0.78rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.page-stack {
|
||||
display: grid;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
.welcome-card,
|
||||
.info-card,
|
||||
.setting-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
padding: 1.35rem 1.5rem;
|
||||
border: 1px solid rgb(137 175 232 / 24%);
|
||||
border-radius: 1rem;
|
||||
background: linear-gradient(135deg, rgb(25 55 96 / 75%), rgb(13 29 52 / 82%));
|
||||
}
|
||||
.welcome-card h2,
|
||||
.info-card h2,
|
||||
.setting-card h2 {
|
||||
margin: 0.35rem 0 0.45rem;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
.welcome-card p,
|
||||
.info-card p,
|
||||
.setting-card p {
|
||||
margin: 0;
|
||||
color: #aebfda;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.section-kicker {
|
||||
display: block;
|
||||
color: #8db9ff;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.chat-workspace {
|
||||
margin: 0;
|
||||
}
|
||||
.workspace-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
margin-bottom: 0.85rem;
|
||||
padding: 0.8rem 1rem;
|
||||
border: 1px solid rgb(137 175 232 / 20%);
|
||||
border-radius: 0.8rem;
|
||||
background: rgb(7 18 34 / 62%);
|
||||
}
|
||||
.workspace-toolbar > div:first-child {
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
margin-right: auto;
|
||||
}
|
||||
.toolbar-note {
|
||||
color: #91a7c9;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.segmented-control {
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
padding: 0.25rem;
|
||||
border: 1px solid rgb(137 175 232 / 24%);
|
||||
border-radius: 0.7rem;
|
||||
background: rgb(7 18 34 / 65%);
|
||||
}
|
||||
.segment {
|
||||
padding: 0.5rem 0.7rem;
|
||||
border: 0;
|
||||
border-radius: 0.45rem;
|
||||
color: #aebfda;
|
||||
background: transparent;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.segment:hover,
|
||||
.segment.active {
|
||||
color: #f7faff;
|
||||
background: #24508c;
|
||||
}
|
||||
.settings-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
.setting-card {
|
||||
display: grid;
|
||||
align-items: start;
|
||||
}
|
||||
.setting-card-controls {
|
||||
display: grid;
|
||||
min-width: min(280px, 100%);
|
||||
gap: 0.8rem;
|
||||
}
|
||||
.setting-card-controls label {
|
||||
display: grid;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.setting-card-controls label span {
|
||||
color: #c7d4e9;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
.status-preview {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
padding: 0.7rem 0.8rem;
|
||||
border: 1px solid rgb(96 211 153 / 28%);
|
||||
border-radius: 0.65rem;
|
||||
color: #c8f7dc;
|
||||
background: rgb(20 83 57 / 25%);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.feature-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.feature-list span {
|
||||
padding: 0.45rem 0.65rem;
|
||||
border: 1px solid rgb(137 175 232 / 22%);
|
||||
border-radius: 999px;
|
||||
color: #c7d4e9;
|
||||
background: rgb(7 18 34 / 45%);
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.info-card {
|
||||
display: block;
|
||||
}
|
||||
.app-content > .profile-manager,
|
||||
.app-content .pet-pack-importer {
|
||||
margin: 0;
|
||||
}
|
||||
.app-content .status-grid {
|
||||
margin: 0;
|
||||
}
|
||||
.app-content .boundaries {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.app-shell {
|
||||
grid-template-columns: 76px minmax(0, 1fr);
|
||||
}
|
||||
.app-sidebar {
|
||||
padding: 1.25rem 0.65rem;
|
||||
}
|
||||
.brand-lockup {
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
.brand-lockup > div:last-child,
|
||||
.nav-item > span:last-child,
|
||||
.sidebar-footer > span:last-child {
|
||||
display: none;
|
||||
}
|
||||
.nav-item {
|
||||
justify-content: center;
|
||||
padding: 0.7rem;
|
||||
}
|
||||
.nav-item-icon {
|
||||
width: 2.1rem;
|
||||
height: 2.1rem;
|
||||
}
|
||||
.sidebar-footer {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.app-shell {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.app-sidebar {
|
||||
display: block;
|
||||
padding: 0.75rem;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid rgb(137 175 232 / 18%);
|
||||
}
|
||||
.brand-lockup {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.brand-lockup > div:last-child {
|
||||
display: grid;
|
||||
}
|
||||
.primary-nav {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
margin-top: 0.75rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.nav-item {
|
||||
min-width: 8.2rem;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.nav-item > span:last-child {
|
||||
display: grid;
|
||||
}
|
||||
.sidebar-footer {
|
||||
display: none;
|
||||
}
|
||||
.app-content {
|
||||
padding: 1.5rem 1rem 2rem;
|
||||
}
|
||||
.page-header,
|
||||
.welcome-card,
|
||||
.setting-card {
|
||||
display: grid;
|
||||
}
|
||||
.header-status-pill {
|
||||
justify-self: start;
|
||||
}
|
||||
.settings-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.setting-card-controls {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.segmented-control {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.segment {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
正在加载…
添加表格
在新工单中引用