refactor(web): 工作区布局 - 侧栏改 260px 可折叠导航、顶栏移入主区并统一账户按钮

- 侧栏由 64px 图标 rail 改为 260px 可折叠导航:分组、设置分区子项、钱包余额徽章、⌘K 命令面板入口、激活分支自动展开
- 顶栏移入主内容区(侧栏右侧):面包屑、主题切换、公告中心、账户菜单;移除冗余搜索按钮(保留侧栏搜索与 ⌘K)
- 账户按钮与其余图标按钮视觉对齐:24px 圆角头像、占位图标复用统一图标合同、移除触发按钮角标
- 新增命令面板与登出 hook;浮层背景不透明化并收敛到唯一源规则
This commit is contained in:
sikongyue
2026-08-19 23:25:32 +08:00
parent 85aa4b3ee1
commit 54d1e6b693
8 changed files with 802 additions and 521 deletions

View File

@@ -0,0 +1,33 @@
import { App } from "antd";
import { useState } from "react";
import { useNavigate } from "react-router";
import { applyUserSession } from "@/lib/user-session";
import { logout } from "@/services/api/auth";
/**
* 工作区退出登录:供侧栏底部与顶部账户菜单共用。
* 写路径强校验:失败必须明确提示,不得静默吞错。
*/
export function useWorkspaceLogout() {
const navigate = useNavigate();
const { message } = App.useApp();
const [loggingOut, setLoggingOut] = useState(false);
const handleLogout = async () => {
if (loggingOut) return;
setLoggingOut(true);
try {
await logout();
await applyUserSession({ user: null, systemChannels: [] });
message.success("已退出登录");
navigate("/login", { replace: true });
} catch (error) {
message.error(error instanceof Error ? error.message : "退出失败");
} finally {
setLoggingOut(false);
}
};
return { handleLogout, loggingOut };
}