桌面应用图标替换为 B-brackets 设计(深藏青 + 白/蓝花括号)
- icon.svg 取自 opsx-icon-options/api/B-brackets.svg,全套光栅重生成: icon.icns(iconutil)、icon.ico(PNG-in-ICO 6 尺寸)、16-1024 PNG、Windows Square*/StoreLogo - 替换 Tauri 脚手架默认五角星图标;GUI 重启实测 Dock 图标已生效 - 服务全量重启:server 8787(官网/文档 200)+ web 5173 + 桌面 GUI
This commit is contained in:
1 parent
71a6d986a4
commit
39f4d5addc
161 files changed
+3289
-515
No files matched your search
@@ -1,17 +1,15 @@
|
||||
/**
|
||||
* 最左活动栏(借鉴 Apifox):空间切换(本地/个人/团队)+ 主导航 + 底部账号与工具。
|
||||
* 顶栏因此只保留与当前编辑相关的操作。
|
||||
* 最左活动栏:主导航 + 底部账号。
|
||||
* 本地/团队工作区只在底部登录/头像菜单切换(设计师线框 B);不再显示顶部「本」字标。
|
||||
*/
|
||||
import { useState } from "react";
|
||||
import { useWorkspace } from "../workspaceStore";
|
||||
import { ContextMenu, cx, type MenuItem } from "./common";
|
||||
import { EnvBadge } from "./EnvBadge";
|
||||
import { Icon, type IconName } from "./icons";
|
||||
|
||||
export function ActivityRail() {
|
||||
const view = useWorkspace((s) => s.view);
|
||||
const setView = useWorkspace((s) => s.setView);
|
||||
const sidebarSide = useWorkspace((s) => s.sidebarSide);
|
||||
const setSidebarSide = useWorkspace((s) => s.setSidebarSide);
|
||||
const account = useWorkspace((s) => s.account);
|
||||
const switchSpace = useWorkspace((s) => s.switchSpace);
|
||||
@@ -19,46 +17,13 @@ export function ActivityRail() {
|
||||
const syncNow = useWorkspace((s) => s.syncNow);
|
||||
const setDialog = useWorkspace((s) => s.setDialog);
|
||||
|
||||
const [spaceMenu, setSpaceMenu] = useState<{ x: number; y: number } | null>(null);
|
||||
const [accountMenu, setAccountMenu] = useState<{ x: number; y: number } | null>(null);
|
||||
|
||||
const activeSpace = account.spaces.find((sp) => sp.id === account.activeSpaceId) ?? null;
|
||||
const spaceName = activeSpace ? `${activeSpace.teamId !== null ? "团队 · " : ""}${activeSpace.name}` : "本地空间";
|
||||
|
||||
const spaceItems: MenuItem[] = [
|
||||
{
|
||||
label: (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<Icon name="shield-check" size={13} className="ops-faint" />
|
||||
<span className="truncate">本地空间</span>
|
||||
{account.activeSpaceId === null && <span className="ml-auto pl-3 text-[10px] ops-success">● 当前</span>}
|
||||
</span>
|
||||
),
|
||||
onClick: () => void switchSpace(null),
|
||||
},
|
||||
...account.spaces.map((sp) => ({
|
||||
label: (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<Icon name={sp.teamId !== null ? "library" : "shield-check"} size={13} className="ops-faint" />
|
||||
<span className="truncate">{sp.teamId !== null ? `团队 · ${sp.name}` : sp.name}</span>
|
||||
{sp.id === account.activeSpaceId ? (
|
||||
<span className="ml-auto pl-3 text-[10px] ops-success">● 当前</span>
|
||||
) : (
|
||||
<span className="ops-faint ml-auto pl-3 text-[10px]">
|
||||
{new Date(sp.updatedAt * 1000).toLocaleDateString("zh-CN")}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
onClick: () => void switchSpace(sp.id),
|
||||
})),
|
||||
{ type: "sep" as const },
|
||||
{
|
||||
label: "团队管理…",
|
||||
icon: <Icon name="library" size={14} />,
|
||||
onClick: () => setDialog({ type: "team" }),
|
||||
},
|
||||
];
|
||||
const isTeam = activeSpace?.teamId != null;
|
||||
const spaceName = activeSpace
|
||||
? `${isTeam ? "团队 · " : ""}${activeSpace.name}`
|
||||
: "本地工作区";
|
||||
|
||||
const siteItem: MenuItem = {
|
||||
label: (
|
||||
@@ -71,8 +36,54 @@ export function ActivityRail() {
|
||||
onClick: () => window.open("/home", "_blank", "noopener,noreferrer"),
|
||||
};
|
||||
|
||||
const workspaceItems: MenuItem[] = [
|
||||
{
|
||||
label: (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<span className="rail-ws-dot local" aria-hidden />
|
||||
<span className="truncate">本地工作区</span>
|
||||
{account.activeSpaceId === null && (
|
||||
<span className="ml-auto pl-3 text-[11px] ops-success">● 当前</span>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
onClick: () => void switchSpace(null),
|
||||
},
|
||||
...account.spaces.map((sp) => {
|
||||
const team = sp.teamId != null;
|
||||
return {
|
||||
label: (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<span className={cx("rail-ws-dot", team ? "team" : "local")} aria-hidden />
|
||||
<span className="truncate">{team ? `团队 · ${sp.name}` : sp.name}</span>
|
||||
{sp.id === account.activeSpaceId ? (
|
||||
<span className="ml-auto pl-3 text-[11px] ops-success">● 当前</span>
|
||||
) : (
|
||||
<span className="ops-faint ml-auto pl-3 text-[11px]">
|
||||
{new Date(sp.updatedAt * 1000).toLocaleDateString("zh-CN")}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
onClick: () => void switchSpace(sp.id),
|
||||
};
|
||||
}),
|
||||
];
|
||||
|
||||
const accountItems: MenuItem[] = account.user
|
||||
? [
|
||||
...workspaceItems,
|
||||
{ type: "sep" as const },
|
||||
{
|
||||
label: "环境变量",
|
||||
icon: <Icon name="settings" size={14} />,
|
||||
onClick: () => setDialog({ type: "environments" }),
|
||||
},
|
||||
{
|
||||
label: "账号设置",
|
||||
icon: <Icon name="settings" size={14} />,
|
||||
onClick: () => setDialog({ type: "settings" }),
|
||||
},
|
||||
...(account.activeSpaceId !== null
|
||||
? [
|
||||
{
|
||||
@@ -94,7 +105,7 @@ export function ActivityRail() {
|
||||
{ type: "sep" as const },
|
||||
siteItem,
|
||||
{
|
||||
label: "退出登录",
|
||||
label: "退出",
|
||||
icon: <Icon name="circle-x" size={14} />,
|
||||
onClick: () => void authLogout(),
|
||||
},
|
||||
@@ -106,42 +117,44 @@ export function ActivityRail() {
|
||||
onClick: () => setDialog({ type: "auth" }),
|
||||
},
|
||||
{ type: "sep" as const },
|
||||
{
|
||||
label: "本地工作区",
|
||||
icon: <Icon name="shield-check" size={14} />,
|
||||
onClick: () => void switchSpace(null),
|
||||
},
|
||||
{
|
||||
label: "环境变量",
|
||||
icon: <Icon name="settings" size={14} />,
|
||||
onClick: () => setDialog({ type: "environments" }),
|
||||
},
|
||||
{ type: "sep" as const },
|
||||
siteItem,
|
||||
];
|
||||
|
||||
const navs: { id: string; icon: IconName; label: string; active: boolean; onClick: () => void }[] = [
|
||||
const navs: { id: string; icon: IconName; label: string; active: boolean; onClick: () => void; soon?: boolean }[] = [
|
||||
{
|
||||
id: "api",
|
||||
icon: "globe",
|
||||
label: "接口",
|
||||
active: view === "api" && sidebarSide === "api",
|
||||
active: view === "api",
|
||||
onClick: () => {
|
||||
setView("api");
|
||||
setSidebarSide("api");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "history",
|
||||
icon: "clock",
|
||||
label: "历史",
|
||||
active: view === "api" && sidebarSide === "history",
|
||||
onClick: () => {
|
||||
setView("api");
|
||||
setSidebarSide("history");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "testing",
|
||||
icon: "list-checks",
|
||||
label: "测试",
|
||||
active: view === "testing",
|
||||
onClick: () => setView("testing"),
|
||||
soon: true,
|
||||
},
|
||||
];
|
||||
|
||||
const syncTitle = !account.user
|
||||
? "登录 / 注册,开启云端个人与团队空间"
|
||||
: `${account.user.name}(${account.user.email})\n当前空间:${spaceName}${
|
||||
? "登录后可切换团队工作区;未登录也可继续用本地"
|
||||
: `${account.user.name}(${account.user.email})\n当前:${spaceName}${
|
||||
account.syncing
|
||||
? "\n同步中…"
|
||||
: account.syncError
|
||||
@@ -156,62 +169,43 @@ export function ActivityRail() {
|
||||
className="ops-panel flex w-14 shrink-0 flex-col items-center gap-1 py-2"
|
||||
style={{ borderRight: "1px solid var(--border)" }}
|
||||
>
|
||||
{/* 空间切换(本地 / 个人 / 团队组织);徽标统一用彩色首字标,与顶栏品牌 Logo 区分 */}
|
||||
<button
|
||||
className="rail-space"
|
||||
title={`当前空间:${spaceName}\n点击切换本地 / 个人 / 团队`}
|
||||
onClick={(e) => {
|
||||
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
||||
setSpaceMenu((m) => (m ? null : { x: rect.right + 4, y: rect.top }));
|
||||
}}
|
||||
>
|
||||
<EnvBadge
|
||||
envId={activeSpace ? String(activeSpace.id) : "local"}
|
||||
name={spaceName}
|
||||
size={26}
|
||||
/>
|
||||
<Icon name="chevron-down" size={10} className="ops-faint" />
|
||||
</button>
|
||||
|
||||
<div className="my-1 h-px w-8" style={{ background: "var(--border)" }} />
|
||||
|
||||
{/* 主导航 */}
|
||||
{/* 主导航:不再放顶部「本」字标 / 空间切换 */}
|
||||
{navs.map((n) => (
|
||||
<button key={n.id} className={cx("rail-item", n.active && "active")} title={n.label} onClick={n.onClick}>
|
||||
<button
|
||||
key={n.id}
|
||||
className={cx("rail-item", n.active && "active", n.soon && "opacity-35 grayscale")}
|
||||
title={n.soon ? `${n.label} · 即将推出` : n.label}
|
||||
onClick={n.onClick}
|
||||
>
|
||||
<Icon name={n.icon} size={17} />
|
||||
<span className="text-[10px]">{n.label}</span>
|
||||
<span className="text-[11px]">{n.label}</span>
|
||||
</button>
|
||||
))}
|
||||
<button
|
||||
className="rail-item"
|
||||
title="Mock 数据:@表达式 + 智能匹配规则"
|
||||
className="rail-item opacity-35 grayscale"
|
||||
title="Mock · 即将推出"
|
||||
onClick={() => setDialog({ type: "settings", tab: "mock" })}
|
||||
>
|
||||
<Icon name="flask-conical" size={17} />
|
||||
<span className="text-[10px]">Mock</span>
|
||||
<span className="text-[11px]">Mock</span>
|
||||
</button>
|
||||
|
||||
<div className="flex-1" />
|
||||
|
||||
{/* 底部:文档 / 设置 / 账号(主题切换在 设置 → 外观,低频操作不占栏位) */}
|
||||
<a className="rail-item" href="/docs" target="_blank" rel="noopener noreferrer" title="用户文档">
|
||||
<a className="rail-item opacity-35 grayscale" href="/docs" target="_blank" rel="noopener noreferrer" title="文档 · 即将推出">
|
||||
<Icon name="book-open" size={16} />
|
||||
<span className="text-[10px]">文档</span>
|
||||
<span className="text-[11px]">文档</span>
|
||||
</a>
|
||||
<button className="rail-item" title="设置" onClick={() => setDialog({ type: "settings" })}>
|
||||
<Icon name="settings" size={16} />
|
||||
<span className="text-[10px]">设置</span>
|
||||
<span className="text-[11px]">设置</span>
|
||||
</button>
|
||||
<button
|
||||
className={cx("rail-item", !account.user && "rail-login")}
|
||||
title={syncTitle}
|
||||
onClick={(e) => {
|
||||
if (!account.user) {
|
||||
setDialog({ type: "auth" });
|
||||
return;
|
||||
}
|
||||
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
||||
setAccountMenu((m) => (m ? null : { x: rect.right + 4, y: rect.bottom + 4 }));
|
||||
setAccountMenu((m) => (m ? null : { x: rect.right + 4, y: Math.max(8, rect.bottom - 240) }));
|
||||
}}
|
||||
>
|
||||
<span className="relative">
|
||||
@@ -222,6 +216,15 @@ export function ActivityRail() {
|
||||
) : (
|
||||
<Icon name="shield-check" size={17} />
|
||||
)}
|
||||
{account.user ? (
|
||||
<span
|
||||
className={cx(
|
||||
"rail-ws-badge",
|
||||
account.activeSpaceId === null ? "local" : isTeam ? "team" : "cloud",
|
||||
)}
|
||||
title={spaceName}
|
||||
/>
|
||||
) : null}
|
||||
{account.user && account.activeSpaceId !== null && (
|
||||
<span
|
||||
className={cx(
|
||||
@@ -231,13 +234,9 @@ export function ActivityRail() {
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
<span className="max-w-11 truncate text-[10px]">{account.user ? account.user.name : "登录"}</span>
|
||||
<span className="max-w-11 truncate text-[11px]">{account.user ? account.user.name : "登录"}</span>
|
||||
</button>
|
||||
|
||||
<ContextMenu
|
||||
menu={spaceMenu ? { x: spaceMenu.x, y: spaceMenu.y, items: spaceItems } : null}
|
||||
onClose={() => setSpaceMenu(null)}
|
||||
/>
|
||||
<ContextMenu
|
||||
menu={accountMenu ? { x: accountMenu.x, y: accountMenu.y, items: accountItems } : null}
|
||||
onClose={() => setAccountMenu(null)}
|
||||
|
||||
Reference in new issue
Block a user