fix: 修复顶部导航和侧边栏菜单连点bug,封装公共侧边栏菜单组件并统一ui样式与交互
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
|
||||
## 2026-11-27
|
||||
|
||||
### 统一页面级侧栏并修复高频连点
|
||||
|
||||
- **范围** 体验中心、用户中心、控制台、企业中心、文档和伙伴工作台。
|
||||
- **变更** 页面链接去重与节流,统一侧栏外壳、菜单项、分组、折叠和加载占位。
|
||||
- **影响** 当前项连点不再重复写入导航历史,桌面折叠偏好跨页面同步,移动抽屉与底栏保留各自的入口。
|
||||
- **回滚** 恢复本次侧栏组件、样式和交互 hook。
|
||||
- **关联** 全站 UI 基线第 4.3 节。
|
||||
|
||||
### 优化右侧顶栏快捷操作
|
||||
|
||||
- **范围** 顶栏教程、WeyAi 下载、充值、推广、主题、语言和头像菜单。
|
||||
|
||||
@@ -65,8 +65,9 @@
|
||||
|
||||
### 4.3 侧栏
|
||||
|
||||
- 控制台侧栏显示、路由选中项变化或滚动区尺寸变化后,当前菜单超出可视范围时,仅滚动菜单区域使其完整可见;已可见时不移动,不滚动正文、不抢焦点,也不强制展开用户手动收起的分组。
|
||||
- 企业中心与用户中心共用 `src/styles/center-layout.css`:展开 216px、收起 64px;菜单行高 42px、行距 6px,图标 16px / 1.5px 线宽;折叠入口文案“收起导航”。
|
||||
- 页面级侧栏共用 `CenterSidebar` 和 `src/styles/center-layout.css`:展开 216px、收起 64px;菜单行高 42px、行距 6px,图标 16px / 1.5px 线宽;折叠入口文案“收起导航”。抽屉保留完整文字,窄屏的底部或横向导航沿用各页面的布局。
|
||||
- 当前菜单超出可视范围时,仅滚动菜单区域使其完整可见;已可见时不移动。侧栏使用当前路由去重,快速切换保留最新目标。折叠按钮和分组操作过滤同一控件的连点。
|
||||
- 体验、用户、控制台和企业中心的加载占位复用侧栏外壳,保持宽度、菜单起点及底部折叠条位置。企业身份和分组标题保留对应占位。
|
||||
- 企业信息区为无底框网格图标(24px / 1.65 线宽),内边距 28px 16px 26px,图文间距 10px;企业名与身份 12px / 20px 行高,身份上距 2px。
|
||||
- 个人侧栏只保留容器外侧分隔线,内层 Menu 不叠加 `border-inline-end`;企业侧栏不提供菜单搜索。
|
||||
- 内容外壳设 `min-width: 0`,防止宽表格挤压;桌面滚动区保留稳定槽位并补足 16px 留白,移动端不补。
|
||||
|
||||
+6
-5
@@ -515,7 +515,9 @@ function App() {
|
||||
element={
|
||||
CLOUD_BRAIN_UI_ENABLED ? (
|
||||
<PrivateRoute>
|
||||
<Suspense fallback={<Loading />} key={location.pathname}>
|
||||
<Suspense
|
||||
fallback={<CenterRouteLoading variant='experience' />}
|
||||
>
|
||||
<ExperienceCenter />
|
||||
</Suspense>
|
||||
</PrivateRoute>
|
||||
@@ -530,14 +532,13 @@ function App() {
|
||||
moduleAuthConfig.experienceCenter ? (
|
||||
<PrivateRoute>
|
||||
<Suspense
|
||||
fallback={<Loading></Loading>}
|
||||
key={location.pathname}
|
||||
fallback={<CenterRouteLoading variant='experience' />}
|
||||
>
|
||||
<ExperienceCenter />
|
||||
</Suspense>
|
||||
</PrivateRoute>
|
||||
) : (
|
||||
<Suspense fallback={<Loading></Loading>} key={location.pathname}>
|
||||
<Suspense fallback={<CenterRouteLoading variant='experience' />}>
|
||||
<ExperienceCenter />
|
||||
</Suspense>
|
||||
)
|
||||
@@ -960,7 +961,7 @@ function App() {
|
||||
element={
|
||||
<PrivateRoute>
|
||||
{isOrgCenterAvailable ? (
|
||||
<Suspense fallback={<CenterRouteLoading />}>
|
||||
<Suspense fallback={<CenterRouteLoading variant='org' />}>
|
||||
<Organization />
|
||||
</Suspense>
|
||||
) : (
|
||||
|
||||
@@ -12,6 +12,7 @@ import React, {
|
||||
} from 'react';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useSidebarToggleGuard } from '../../hooks/common/useSidebarToggleGuard';
|
||||
import { CenterSidebarLoading } from './components/CenterSidebarLoading';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../../helpers/api';
|
||||
@@ -67,6 +68,7 @@ const PageLayout = () => {
|
||||
const isMobile = useIsMobile();
|
||||
const [collapsed] = useSidebarCollapsed();
|
||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||
const canToggleSidebar = useSidebarToggleGuard();
|
||||
const { i18n } = useTranslation();
|
||||
const location = useLocation();
|
||||
|
||||
@@ -360,7 +362,9 @@ const PageLayout = () => {
|
||||
>
|
||||
<Suspense fallback={null}>
|
||||
<HeaderBar
|
||||
onMobileMenuToggle={() => setDrawerOpen((prev) => !prev)}
|
||||
onMobileMenuToggle={() => {
|
||||
if (canToggleSidebar('drawer')) setDrawerOpen((open) => !open);
|
||||
}}
|
||||
drawerOpen={drawerOpen}
|
||||
/>
|
||||
</Suspense>
|
||||
@@ -418,7 +422,10 @@ const PageLayout = () => {
|
||||
>
|
||||
<Suspense
|
||||
fallback={
|
||||
<CenterSidebarLoading forceExpanded={siderForceExpanded} />
|
||||
<CenterSidebarLoading
|
||||
variant='console'
|
||||
forceExpanded={siderForceExpanded}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<SiderBar
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import {
|
||||
ChevronDown as ActionChevronDown,
|
||||
ChevronRight as ActionChevronRight,
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { consoleMenuPaths, getConsoleMenuKeys } from '../console/consoleRoutes';
|
||||
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { revealActiveSidebarItem } from '../../helpers/sidebarScroll';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getLucideIcon } from '../../helpers/render';
|
||||
import '../../styles/center-layout.css';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useSidebarNavigation } from '../../hooks/common/useTopNavigation';
|
||||
import { useSidebarGroups } from '../../hooks/common/useSidebarGroups';
|
||||
import { useSidebar } from '../../hooks/common/useSidebar';
|
||||
import { usePartnerWorkspaceEntry } from '../../hooks/common/usePartnerWorkspaceEntry';
|
||||
import { isAdmin, isRoot, showError } from '../../helpers';
|
||||
@@ -28,6 +24,12 @@ import {
|
||||
loadPersonalConsentGranted,
|
||||
readPersonalConsentCache,
|
||||
} from '../smart-router/api';
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarGroup,
|
||||
CenterSidebarItem,
|
||||
CenterSidebarSubmenu,
|
||||
} from './components/CenterSidebar';
|
||||
import { CenterSidebarLoading } from './components/CenterSidebarLoading';
|
||||
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
|
||||
import { useAuthzView, usePerm } from '../../authz';
|
||||
@@ -57,6 +59,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
const { t } = useTranslation();
|
||||
const [persistedCollapsed, toggleCollapsed] = useSidebarCollapsed();
|
||||
const collapsed = forceExpanded ? false : persistedCollapsed;
|
||||
const followSidebarLink = useSidebarNavigation(onNavigate);
|
||||
const {
|
||||
isModuleVisible,
|
||||
hasSectionVisibleModules,
|
||||
@@ -99,7 +102,6 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
}, [platformView]);
|
||||
|
||||
const [selectedKeys, setSelectedKeys] = useState(['home']);
|
||||
const navigationRef = useRef(null);
|
||||
// 平台关闭智能路由后,仍有生效中出境同意的普通用户保留入口以便撤回(§9.5,与企业"仅授权模式"同口径)
|
||||
const [routerConsentGranted, setRouterConsentGranted] = useState(
|
||||
() => readPersonalConsentCache() === '1',
|
||||
@@ -120,8 +122,9 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
};
|
||||
}, [smartRouterEnabled]);
|
||||
const [chatItems, setChatItems] = useState([]);
|
||||
const [openedKeys, setOpenedKeys] = useState([]);
|
||||
const [foldedGroups, setFoldedGroups] = useState([]);
|
||||
const submenus = useSidebarGroups();
|
||||
const groups = useSidebarGroups();
|
||||
const { setGroup: setSubmenu } = submenus;
|
||||
const location = useLocation();
|
||||
const [routerMapState, setRouterMapState] = useState(routerMap);
|
||||
|
||||
@@ -549,9 +552,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
setSelectedKeys([
|
||||
validChildKeys.includes(childKey) ? childKey : 'commission-overview',
|
||||
]);
|
||||
setOpenedKeys((keys) =>
|
||||
keys.includes('commission') ? keys : [...keys, 'commission'],
|
||||
);
|
||||
setSubmenu('commission', true);
|
||||
return;
|
||||
}
|
||||
let matchingKeys = getConsoleMenuKeys(currentPath, routerMapState);
|
||||
@@ -570,39 +571,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
if (matchingKeys.length) {
|
||||
setSelectedKeys(matchingKeys);
|
||||
}
|
||||
}, [location.pathname, location.search, routerMapState]);
|
||||
|
||||
useEffect(() => {
|
||||
const navigation = navigationRef.current;
|
||||
if (!navigation || sidebarLoading) return;
|
||||
let frame;
|
||||
const scheduleReveal = () => {
|
||||
cancelAnimationFrame(frame);
|
||||
frame = requestAnimationFrame(() => revealActiveSidebarItem(navigation));
|
||||
};
|
||||
scheduleReveal();
|
||||
const resizeObserver = new ResizeObserver(scheduleReveal);
|
||||
resizeObserver.observe(navigation);
|
||||
const mutationObserver = new MutationObserver(scheduleReveal);
|
||||
mutationObserver.observe(navigation, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['hidden'],
|
||||
});
|
||||
return () => {
|
||||
cancelAnimationFrame(frame);
|
||||
resizeObserver.disconnect();
|
||||
mutationObserver.disconnect();
|
||||
};
|
||||
}, [
|
||||
sidebarLoading,
|
||||
selectedKeys,
|
||||
collapsed,
|
||||
forceExpanded,
|
||||
openedKeys,
|
||||
foldedGroups,
|
||||
]);
|
||||
}, [location.pathname, location.search, routerMapState, setSubmenu]);
|
||||
|
||||
const renderMenuIcon = (key) =>
|
||||
React.cloneElement(getLucideIcon(key), {
|
||||
@@ -614,186 +583,106 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
});
|
||||
|
||||
const renderGroup = (key, label, items) => (
|
||||
<div key={key} className='ui-org-nav-group'>
|
||||
{!collapsed && (
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-org-group-toggle'
|
||||
aria-expanded={!foldedGroups.includes(key)}
|
||||
onClick={() =>
|
||||
setFoldedGroups((previous) =>
|
||||
previous.includes(key)
|
||||
? previous.filter((group) => group !== key)
|
||||
: [...previous, key],
|
||||
)
|
||||
}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<ActionChevronDown
|
||||
size={13}
|
||||
className={foldedGroups.includes(key) ? 'is-folded' : ''}
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
<div
|
||||
className='ui-org-group-items'
|
||||
hidden={!collapsed && foldedGroups.includes(key)}
|
||||
>
|
||||
{items}
|
||||
</div>
|
||||
</div>
|
||||
<CenterSidebarGroup
|
||||
key={key}
|
||||
label={label}
|
||||
collapsed={collapsed}
|
||||
folded={groups.keys.includes(key)}
|
||||
onToggle={() => groups.toggle(key)}
|
||||
>
|
||||
{items}
|
||||
</CenterSidebarGroup>
|
||||
);
|
||||
|
||||
// nested:二级菜单项(无图标,靠缩进与引导线表达层级);forceActive:收起态父项代表任一子项选中
|
||||
const renderNavItem = (
|
||||
item,
|
||||
{ nested = false, forceActive = false } = {},
|
||||
) => {
|
||||
if (item.className === 'tableHiddle') return null;
|
||||
const active = forceActive || selectedKeys.includes(item.itemKey);
|
||||
const to = routerMapState[item.itemKey] || routerMap[item.itemKey] || '#';
|
||||
return (
|
||||
<Link
|
||||
<CenterSidebarItem
|
||||
key={item.itemKey}
|
||||
to={routerMapState[item.itemKey] || routerMap[item.itemKey] || '#'}
|
||||
onClick={onNavigate}
|
||||
className={`ui-center-menu-item${nested ? ' ui-console-submenu-item' : ''}`}
|
||||
data-active={active || undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
title={collapsed ? item.text : undefined}
|
||||
>
|
||||
{!nested && renderMenuIcon(item.itemKey)}
|
||||
{!collapsed && (
|
||||
<span className='ui-center-menu-label'>{item.text}</span>
|
||||
)}
|
||||
</Link>
|
||||
to={to}
|
||||
label={item.text}
|
||||
active={forceActive || selectedKeys.includes(item.itemKey)}
|
||||
collapsed={collapsed}
|
||||
nested={nested}
|
||||
icon={!nested && renderMenuIcon(item.itemKey)}
|
||||
onClick={(event) => followSidebarLink(to, event)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const renderSubItem = (item) => {
|
||||
if (!item.items?.length) return renderNavItem(item);
|
||||
const open = openedKeys.includes(item.itemKey);
|
||||
const childActive = item.items.some((child) =>
|
||||
selectedKeys.includes(child.itemKey),
|
||||
);
|
||||
// 收起态没有展开空间:父项作为入口直达模块首页,任一子项选中时父项高亮
|
||||
if (collapsed) {
|
||||
return renderNavItem(
|
||||
{ ...item, items: undefined },
|
||||
{ forceActive: childActive },
|
||||
);
|
||||
}
|
||||
const groupId = `ui-console-submenu-${item.itemKey}`;
|
||||
if (collapsed) return renderNavItem(item, { forceActive: childActive });
|
||||
|
||||
return (
|
||||
<div key={item.itemKey} className='ui-console-submenu'>
|
||||
<button
|
||||
type='button'
|
||||
className='ui-center-menu-item ui-console-submenu-toggle'
|
||||
data-child-active={childActive || undefined}
|
||||
aria-expanded={open}
|
||||
aria-controls={groupId}
|
||||
onClick={() =>
|
||||
setOpenedKeys((previous) =>
|
||||
previous.includes(item.itemKey)
|
||||
? previous.filter((key) => key !== item.itemKey)
|
||||
: [...previous, item.itemKey],
|
||||
)
|
||||
}
|
||||
>
|
||||
{renderMenuIcon(item.itemKey)}
|
||||
<span className='ui-center-menu-label'>{item.text}</span>
|
||||
<ActionChevronDown
|
||||
size={14}
|
||||
className='ui-console-submenu-arrow'
|
||||
aria-hidden
|
||||
/>
|
||||
</button>
|
||||
<div
|
||||
id={groupId}
|
||||
role='group'
|
||||
aria-label={item.text}
|
||||
className='ui-org-group-items ui-console-submenu-items'
|
||||
hidden={!open}
|
||||
>
|
||||
{item.items.map((child) => renderNavItem(child, { nested: true }))}
|
||||
</div>
|
||||
</div>
|
||||
<CenterSidebarSubmenu
|
||||
key={item.itemKey}
|
||||
label={item.text}
|
||||
icon={renderMenuIcon(item.itemKey)}
|
||||
open={submenus.keys.includes(item.itemKey)}
|
||||
childActive={childActive}
|
||||
onToggle={() => submenus.toggle(item.itemKey)}
|
||||
>
|
||||
{item.items.map((child) => renderNavItem(child, { nested: true }))}
|
||||
</CenterSidebarSubmenu>
|
||||
);
|
||||
};
|
||||
|
||||
if (sidebarLoading)
|
||||
return <CenterSidebarLoading forceExpanded={forceExpanded} />;
|
||||
return (
|
||||
<CenterSidebarLoading variant='console' forceExpanded={forceExpanded} />
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className='ui-console-sidebar ui-center-sidebar'
|
||||
data-collapsed={collapsed}
|
||||
style={{
|
||||
width: forceExpanded
|
||||
? 'var(--sidebar-width)'
|
||||
: 'var(--sidebar-current-width)',
|
||||
background: 'var(--surface-sidebar)',
|
||||
}}
|
||||
<CenterSidebar
|
||||
className='ui-console-sidebar'
|
||||
collapsed={collapsed}
|
||||
mobile={forceExpanded}
|
||||
onToggle={toggleCollapsed}
|
||||
>
|
||||
<nav ref={navigationRef} className='ui-center-sidebar-nav'>
|
||||
{/* 聊天区域 */}
|
||||
{hasSectionVisibleModules('chat') &&
|
||||
renderGroup(
|
||||
'chat-group',
|
||||
t('聊天'),
|
||||
chatMenuItems.map(renderSubItem),
|
||||
)}
|
||||
{/* 聊天区域 */}
|
||||
{hasSectionVisibleModules('chat') &&
|
||||
renderGroup('chat-group', t('聊天'), chatMenuItems.map(renderSubItem))}
|
||||
|
||||
{/* 控制台区域 */}
|
||||
{hasSectionVisibleModules('console') &&
|
||||
renderGroup(
|
||||
'console-group',
|
||||
t('控制台'),
|
||||
workspaceItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
{/* 控制台区域 */}
|
||||
{hasSectionVisibleModules('console') &&
|
||||
renderGroup(
|
||||
'console-group',
|
||||
t('控制台'),
|
||||
workspaceItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
|
||||
{/* 个人中心区域 */}
|
||||
{hasSectionVisibleModules('personal') &&
|
||||
renderGroup(
|
||||
'personal-group',
|
||||
t('个人中心'),
|
||||
financeItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
{/* 个人中心区域 */}
|
||||
{hasSectionVisibleModules('personal') &&
|
||||
renderGroup(
|
||||
'personal-group',
|
||||
t('个人中心'),
|
||||
financeItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
|
||||
{/* 管理员区域:按角色、权限下放及菜单配置过滤。分佣管理为子菜单,走 renderSubItem。 */}
|
||||
{(isAdmin() || visibleAdminItems.length > 0) &&
|
||||
renderGroup(
|
||||
'admin-group',
|
||||
t('管理员'),
|
||||
visibleAdminItems.map(renderSubItem),
|
||||
)}
|
||||
{/* 管理员区域:按角色、权限下放及菜单配置过滤。分佣管理为子菜单,走 renderSubItem。 */}
|
||||
{(isAdmin() || visibleAdminItems.length > 0) &&
|
||||
renderGroup(
|
||||
'admin-group',
|
||||
t('管理员'),
|
||||
visibleAdminItems.map(renderSubItem),
|
||||
)}
|
||||
|
||||
{/* 权限管理区域:至少有一项可见时显示 */}
|
||||
{authzItems.length > 0 &&
|
||||
renderGroup(
|
||||
'authz-group',
|
||||
t('权限管理'),
|
||||
authzItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
</nav>
|
||||
|
||||
{/* 底部折叠按钮 —— 抽屉态不提供:收起后抽屉会变成 60px 窄条,等于自废 */}
|
||||
{!forceExpanded && (
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-center-sidebar-collapse'
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
>
|
||||
{collapsed ? (
|
||||
<ActionChevronRight size={16} />
|
||||
) : (
|
||||
<ActionChevronLeft size={16} />
|
||||
)}
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{/* 权限管理区域:至少有一项可见时显示 */}
|
||||
{authzItems.length > 0 &&
|
||||
renderGroup(
|
||||
'authz-group',
|
||||
t('权限管理'),
|
||||
authzItems.map((item) => renderNavItem(item)),
|
||||
)}
|
||||
</CenterSidebar>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
import React, { useEffect, useId, useRef } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
ChevronDown,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { revealActiveSidebarItem } from '../../../helpers/sidebarScroll';
|
||||
|
||||
export function CenterSidebar({
|
||||
children,
|
||||
className = '',
|
||||
collapsed = false,
|
||||
loading = false,
|
||||
mobile = false,
|
||||
header,
|
||||
footer,
|
||||
onToggle,
|
||||
label,
|
||||
navigationClassName = '',
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const navigation = useRef(null);
|
||||
const navId = useId();
|
||||
|
||||
useEffect(() => {
|
||||
const node = navigation.current;
|
||||
if (loading || !node) return;
|
||||
let frame;
|
||||
const schedule = () => {
|
||||
cancelAnimationFrame(frame);
|
||||
frame = requestAnimationFrame(() => revealActiveSidebarItem(node));
|
||||
};
|
||||
const resize = new ResizeObserver(schedule);
|
||||
resize.observe(node);
|
||||
const mutation = new MutationObserver(schedule);
|
||||
mutation.observe(node, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['aria-current', 'hidden'],
|
||||
});
|
||||
schedule();
|
||||
return () => {
|
||||
cancelAnimationFrame(frame);
|
||||
resize.disconnect();
|
||||
mutation.disconnect();
|
||||
};
|
||||
}, [collapsed, loading]);
|
||||
|
||||
const CollapseIcon = collapsed ? ChevronRight : ChevronLeft;
|
||||
return (
|
||||
<aside
|
||||
className={`ui-center-sidebar ${className}`}
|
||||
data-collapsed={collapsed}
|
||||
data-mobile={mobile || undefined}
|
||||
aria-busy={loading || undefined}
|
||||
>
|
||||
{header}
|
||||
<nav
|
||||
id={navId}
|
||||
ref={navigation}
|
||||
className={`ui-center-sidebar-nav ${navigationClassName}`}
|
||||
aria-label={label || t('主导航')}
|
||||
>
|
||||
{children}
|
||||
</nav>
|
||||
{footer}
|
||||
{onToggle && !mobile && (
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-center-sidebar-collapse'
|
||||
onClick={onToggle}
|
||||
aria-controls={navId}
|
||||
aria-expanded={!collapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
>
|
||||
<CollapseIcon size={16} aria-hidden='true' />
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
)}
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
export function CenterSidebarItem({
|
||||
to,
|
||||
label,
|
||||
icon,
|
||||
active,
|
||||
collapsed,
|
||||
nested,
|
||||
trailing,
|
||||
className = '',
|
||||
...props
|
||||
}) {
|
||||
const Element = to ? Link : 'button';
|
||||
return (
|
||||
<Element
|
||||
{...(to ? { to } : { type: 'button' })}
|
||||
className={`ui-center-menu-item${nested ? ' ui-console-submenu-item' : ''} ${className}`}
|
||||
data-active={active || undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
aria-label={collapsed ? label : undefined}
|
||||
title={collapsed ? label : undefined}
|
||||
{...props}
|
||||
>
|
||||
{icon}
|
||||
{!collapsed && <span className='ui-center-menu-label'>{label}</span>}
|
||||
{trailing}
|
||||
</Element>
|
||||
);
|
||||
}
|
||||
|
||||
export function CenterSidebarGroup({
|
||||
children,
|
||||
label,
|
||||
collapsed,
|
||||
folded,
|
||||
onToggle,
|
||||
}) {
|
||||
const id = useId();
|
||||
return (
|
||||
<div className='ui-org-nav-group'>
|
||||
{!collapsed && (
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-org-group-toggle'
|
||||
aria-controls={id}
|
||||
aria-expanded={!folded}
|
||||
onClick={onToggle}
|
||||
>
|
||||
<span>{label}</span>
|
||||
<ChevronDown
|
||||
size={13}
|
||||
className={folded ? 'is-folded' : ''}
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
<div id={id} className='ui-org-group-items' hidden={!collapsed && folded}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CenterSidebarSubmenu({
|
||||
children,
|
||||
label,
|
||||
icon,
|
||||
collapsed,
|
||||
open,
|
||||
childActive,
|
||||
onToggle,
|
||||
className = '',
|
||||
}) {
|
||||
const id = useId();
|
||||
return (
|
||||
<div className={`ui-console-submenu ${className}`}>
|
||||
<CenterSidebarItem
|
||||
className='ui-console-submenu-toggle'
|
||||
icon={icon}
|
||||
label={label}
|
||||
collapsed={collapsed}
|
||||
data-child-active={childActive || undefined}
|
||||
aria-expanded={open}
|
||||
aria-controls={id}
|
||||
onClick={onToggle}
|
||||
trailing={
|
||||
!collapsed && (
|
||||
<ChevronDown
|
||||
size={14}
|
||||
className='ui-console-submenu-arrow'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<div
|
||||
id={id}
|
||||
role='group'
|
||||
aria-label={label}
|
||||
className='ui-org-group-items ui-console-submenu-items'
|
||||
hidden={!open}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,25 +1,56 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSidebarCollapsed } from '../../../hooks/common/useSidebarCollapsed';
|
||||
import { CenterSidebar } from './CenterSidebar';
|
||||
|
||||
const rows = [0, 1, 2, 3, 4, 5];
|
||||
|
||||
export function CenterSidebarLoading({ forceExpanded = false }) {
|
||||
const [collapsed] = useSidebarCollapsed();
|
||||
const { t } = useTranslation();
|
||||
export function CenterSidebarLoading({
|
||||
forceExpanded = false,
|
||||
variant = 'user',
|
||||
}) {
|
||||
const [persistedCollapsed] = useSidebarCollapsed();
|
||||
const collapsed = !forceExpanded && persistedCollapsed;
|
||||
const identity = variant === 'org' && !collapsed;
|
||||
const grouped = !collapsed && (variant === 'org' || variant === 'console');
|
||||
|
||||
return (
|
||||
<div
|
||||
className='ui-center-sidebar ui-center-sidebar-placeholder'
|
||||
data-collapsed={!forceExpanded && collapsed}
|
||||
data-mobile={forceExpanded || undefined}
|
||||
aria-busy='true'
|
||||
aria-label={t('主导航')}
|
||||
<CenterSidebar
|
||||
className={`ui-${variant}-sidebar ui-center-sidebar-placeholder`}
|
||||
collapsed={collapsed}
|
||||
mobile={forceExpanded}
|
||||
loading
|
||||
header={
|
||||
identity && (
|
||||
<div
|
||||
className='ui-org-identity ui-center-sidebar-placeholder-identity'
|
||||
aria-hidden='true'
|
||||
>
|
||||
<span />
|
||||
<span />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
footer={
|
||||
!forceExpanded && (
|
||||
<div
|
||||
className='ui-center-sidebar-placeholder-footer'
|
||||
aria-hidden='true'
|
||||
>
|
||||
<span />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
>
|
||||
<div
|
||||
className='ui-center-sidebar-nav ui-center-sidebar-placeholder-rows'
|
||||
className='ui-org-group-items ui-center-sidebar-placeholder-rows'
|
||||
aria-hidden='true'
|
||||
>
|
||||
{grouped && (
|
||||
<div className='ui-center-sidebar-placeholder-group'>
|
||||
<span />
|
||||
</div>
|
||||
)}
|
||||
{rows.map((row) => (
|
||||
<div key={row} className='ui-center-menu-item'>
|
||||
<span />
|
||||
@@ -27,25 +58,17 @@ export function CenterSidebarLoading({ forceExpanded = false }) {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{!forceExpanded && (
|
||||
<div
|
||||
className='ui-center-sidebar-placeholder-footer'
|
||||
aria-hidden='true'
|
||||
>
|
||||
<span />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CenterSidebar>
|
||||
);
|
||||
}
|
||||
|
||||
export function CenterRouteLoading() {
|
||||
export function CenterRouteLoading({ variant }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className='ui-center-route-loading' role='status'>
|
||||
<div className='hidden md:block'>
|
||||
<CenterSidebarLoading />
|
||||
<CenterSidebarLoading variant={variant} />
|
||||
</div>
|
||||
<div className='ui-center-route-loading-body'>{t('加载中...')}</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useCallback, useSyncExternalStore } from 'react';
|
||||
|
||||
const KEY = 'default_collapse_sidebar';
|
||||
const TOGGLE_INTERVAL = 180;
|
||||
let lastToggleAt = -Infinity;
|
||||
|
||||
/*
|
||||
* 侧栏折叠态是「一份跨组件共享的状态」,不能用 useState——
|
||||
@@ -65,6 +67,9 @@ export const useSidebarCollapsed = () => {
|
||||
);
|
||||
|
||||
const toggle = useCallback(() => {
|
||||
const now = performance.now();
|
||||
if (now - lastToggleAt < TOGGLE_INTERVAL) return;
|
||||
lastToggleAt = now;
|
||||
setCollapsedState(!collapsedState);
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
import { useSidebarToggleGuard } from './useSidebarToggleGuard';
|
||||
|
||||
function readGroups(storageKey) {
|
||||
if (!storageKey) return [];
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(storageKey));
|
||||
return Array.isArray(saved) ? saved : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export function useSidebarGroups(storageKey) {
|
||||
const [keys, setKeys] = useState(() => readGroups(storageKey));
|
||||
const current = useRef(keys);
|
||||
const canToggle = useSidebarToggleGuard();
|
||||
|
||||
const setGroup = useCallback(
|
||||
(key, included, persist = false) => {
|
||||
const previous = current.current;
|
||||
if (!key || previous.includes(key) === included) return;
|
||||
const next = included
|
||||
? [...previous, key]
|
||||
: previous.filter((item) => item !== key);
|
||||
current.current = next;
|
||||
setKeys(next);
|
||||
if (persist && storageKey) {
|
||||
try {
|
||||
localStorage.setItem(storageKey, JSON.stringify(next));
|
||||
} catch {
|
||||
// Keep the in-memory preference if storage is unavailable.
|
||||
}
|
||||
}
|
||||
},
|
||||
[storageKey],
|
||||
);
|
||||
|
||||
const toggle = (key) => {
|
||||
if (canToggle(key)) setGroup(key, !current.current.includes(key), true);
|
||||
};
|
||||
|
||||
return { keys, toggle, setGroup };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { useCallback, useRef } from 'react';
|
||||
|
||||
const TOGGLE_INTERVAL = 180;
|
||||
|
||||
export function useSidebarToggleGuard() {
|
||||
const lastToggle = useRef(new Map());
|
||||
|
||||
return useCallback((key) => {
|
||||
const now = performance.now();
|
||||
if (now - (lastToggle.current.get(key) ?? -Infinity) < TOGGLE_INTERVAL) {
|
||||
return false;
|
||||
}
|
||||
lastToggle.current.set(key, now);
|
||||
return true;
|
||||
}, []);
|
||||
}
|
||||
@@ -6,6 +6,14 @@ const NAVIGATION_INTERVAL = 180;
|
||||
const normalizePathname = (path) => path.replace(/\/+$/, '') || '/';
|
||||
|
||||
export function useTopNavigation() {
|
||||
return useThrottledNavigation();
|
||||
}
|
||||
|
||||
export function useSidebarNavigation(onNavigate) {
|
||||
return useThrottledNavigation({ exact: true, onNavigate });
|
||||
}
|
||||
|
||||
function useThrottledNavigation({ exact = false, onNavigate } = {}) {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const timer = useRef();
|
||||
@@ -18,7 +26,7 @@ export function useTopNavigation() {
|
||||
!to ||
|
||||
event?.defaultPrevented ||
|
||||
(event &&
|
||||
(event.button !== 0 ||
|
||||
((event.button != null && event.button !== 0) ||
|
||||
event.metaKey ||
|
||||
event.altKey ||
|
||||
event.ctrlKey ||
|
||||
@@ -34,9 +42,10 @@ export function useTopNavigation() {
|
||||
if (
|
||||
normalizePathname(target.pathname) ===
|
||||
normalizePathname(current.pathname) &&
|
||||
(!target.search || target.search === current.search) &&
|
||||
(!target.hash || target.hash === current.hash)
|
||||
(target.search === current.search || (!exact && !target.search)) &&
|
||||
(target.hash === current.hash || (!exact && !target.hash))
|
||||
) {
|
||||
onNavigate?.();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -46,6 +55,7 @@ export function useTopNavigation() {
|
||||
if (window.history.state?.key !== originKey) return;
|
||||
lastNavigationAt.current = performance.now();
|
||||
navigate(to);
|
||||
onNavigate?.();
|
||||
};
|
||||
const wait =
|
||||
NAVIGATION_INTERVAL - (performance.now() - lastNavigationAt.current);
|
||||
|
||||
@@ -49,6 +49,13 @@ import {
|
||||
import { BillingColumns, AdjustmentColumns } from './operations';
|
||||
import { commissionLabel } from './labels';
|
||||
import { PARTNER_NAVIGATION, partnerView } from './partnerNavigation';
|
||||
import { useSidebarToggleGuard } from '../../hooks/common/useSidebarToggleGuard';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarItem,
|
||||
} from '../../components/layout/components/CenterSidebar';
|
||||
import './partnerPortal.css';
|
||||
import OrgPageHeader from '../Organization/components/OrgPageHeader';
|
||||
import OrgModal from '../Organization/components/OrgModal';
|
||||
@@ -100,6 +107,10 @@ export default function PartnerPortal({
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [localActive, setLocalActive] = useState('overview');
|
||||
const active = embedded ? partnerView(location.search) : localActive;
|
||||
const canChangeSidebarTab = useSidebarToggleGuard();
|
||||
const mobile = useIsMobile();
|
||||
const [persistedCollapsed, toggleCollapsed] = useSidebarCollapsed();
|
||||
const sidebarCollapsed = !mobile && persistedCollapsed;
|
||||
const internalSearch = useRef(null);
|
||||
const setActive = (key) => {
|
||||
if (!embedded) {
|
||||
@@ -1307,31 +1318,54 @@ export default function PartnerPortal({
|
||||
className={`commission-v2 commission-admin-workspace partner-portal${embedded ? ' partner-portal--embedded' : ''}`}
|
||||
>
|
||||
{!embedded && (
|
||||
<aside className='commission-v2-sider'>
|
||||
<div className='commission-brand'>
|
||||
<span className='commission-brand-mark' />
|
||||
{t('合作分佣')}
|
||||
</div>
|
||||
<nav className='commission-navigation' aria-label={t('伙伴分佣导航')}>
|
||||
<CenterSidebar
|
||||
className='commission-v2-sider'
|
||||
navigationClassName='commission-navigation'
|
||||
label={t('伙伴分佣导航')}
|
||||
collapsed={sidebarCollapsed}
|
||||
onToggle={mobile ? undefined : toggleCollapsed}
|
||||
header={
|
||||
!sidebarCollapsed && (
|
||||
<div className='commission-brand'>
|
||||
<span className='commission-brand-mark' />
|
||||
{t('合作分佣')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
>
|
||||
{!sidebarCollapsed && (
|
||||
<div className='commission-nav-group'>{t('伙伴工作台')}</div>
|
||||
)}
|
||||
<div className='ui-org-group-items commission-nav-items'>
|
||||
{NAVIGATION.map(({ key, label, icon: Icon }) => (
|
||||
<button
|
||||
type='button'
|
||||
<CenterSidebarItem
|
||||
key={key}
|
||||
className={`commission-nav-item${active === key ? ' is-active' : ''}`}
|
||||
aria-current={active === key ? 'page' : undefined}
|
||||
label={t(label)}
|
||||
collapsed={sidebarCollapsed}
|
||||
className='commission-nav-item'
|
||||
active={active === key}
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
disabled={mutationLoading}
|
||||
onClick={() => navigate(key)}
|
||||
>
|
||||
<Icon size={17} />
|
||||
<span>{t(label)}</span>
|
||||
{key === 'bills' && pending.length > 0 && (
|
||||
<span className='commission-nav-badge'>{pending.length}</span>
|
||||
)}
|
||||
</button>
|
||||
onClick={() => {
|
||||
if (
|
||||
(active !== key || selected) &&
|
||||
canChangeSidebarTab(key)
|
||||
) {
|
||||
navigate(key);
|
||||
}
|
||||
}}
|
||||
trailing={
|
||||
key === 'bills' &&
|
||||
pending.length > 0 && (
|
||||
<span className='commission-nav-badge'>
|
||||
{pending.length}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</nav>
|
||||
</aside>
|
||||
</div>
|
||||
</CenterSidebar>
|
||||
)}
|
||||
<Layout>
|
||||
<header className='commission-workspace-bar' hidden={embedded}>
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
.partner-portal .commission-v2-sider {
|
||||
width: 220px;
|
||||
flex-basis: 220px;
|
||||
}
|
||||
|
||||
/* Organization owns the global header, sidebar and scroll container. */
|
||||
.partner-portal-scope--embedded {
|
||||
display: flex;
|
||||
|
||||
@@ -109,11 +109,9 @@
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.commission-v2-sider {
|
||||
flex: 0 0 220px;
|
||||
width: 220px;
|
||||
background: var(--surface-sidebar);
|
||||
border-right: 1px solid var(--border-subtle);
|
||||
.commission-v2-sider.ui-center-sidebar {
|
||||
flex: none;
|
||||
height: auto;
|
||||
}
|
||||
.commission-brand {
|
||||
display: flex;
|
||||
@@ -141,41 +139,6 @@
|
||||
color: var(--text-tertiary);
|
||||
font-size: 12px;
|
||||
}
|
||||
.commission-nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
height: 38px;
|
||||
margin: 2px 0;
|
||||
padding: 0 12px;
|
||||
border: 0;
|
||||
border-radius: var(--commission-radius);
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.commission-nav-item svg {
|
||||
flex-shrink: 0;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
.commission-nav-item:hover {
|
||||
background: var(--surface-bg-base);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.commission-nav-item.is-active {
|
||||
background: var(--commission-primary-soft);
|
||||
color: var(--commission-primary-readable);
|
||||
font-weight: 500;
|
||||
box-shadow: inset 2px 0 0 var(--commission-primary);
|
||||
}
|
||||
.commission-nav-item:focus-visible {
|
||||
outline: 2px solid var(--commission-primary);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.commission-nav-badge {
|
||||
margin-left: auto;
|
||||
padding: 0 6px;
|
||||
@@ -185,6 +148,16 @@
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.commission-v2-sider[data-collapsed='true'] .commission-nav-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.commission-v2-sider[data-collapsed='true'] .commission-nav-badge {
|
||||
position: absolute;
|
||||
inset-block-start: 2px;
|
||||
inset-inline-end: 0;
|
||||
}
|
||||
.commission-workspace-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -736,10 +709,6 @@
|
||||
padding-top: 12px;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.commission-v2-sider {
|
||||
flex-basis: 200px;
|
||||
width: 200px;
|
||||
}
|
||||
.commission-page-header {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
@@ -755,7 +724,7 @@
|
||||
.commission-admin-workspace {
|
||||
flex-direction: column;
|
||||
}
|
||||
.commission-v2-sider {
|
||||
.commission-v2-sider.ui-center-sidebar {
|
||||
flex: 0 0 auto;
|
||||
width: 100%;
|
||||
border-right: 0;
|
||||
@@ -764,7 +733,7 @@
|
||||
.commission-brand {
|
||||
display: none;
|
||||
}
|
||||
.commission-navigation {
|
||||
.commission-v2-sider .commission-navigation {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
overflow-x: auto;
|
||||
@@ -773,8 +742,12 @@
|
||||
.commission-nav-group {
|
||||
display: none;
|
||||
}
|
||||
.commission-nav-item {
|
||||
.commission-nav-items:not([hidden]) {
|
||||
flex-direction: row;
|
||||
}
|
||||
.commission-v2-sider button.commission-nav-item {
|
||||
width: auto;
|
||||
padding-inline: 12px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.commission-workspace-bar {
|
||||
|
||||
+48
-37
@@ -1,11 +1,29 @@
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
BookOpen,
|
||||
BrainCircuit,
|
||||
Code,
|
||||
Gem,
|
||||
Download,
|
||||
Lightbulb,
|
||||
Columns2,
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { copy, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarItem,
|
||||
} from '../../components/layout/components/CenterSidebar';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useIsMobile } from '../../hooks/common/useIsMobile';
|
||||
import './styles.css';
|
||||
|
||||
const Docs = () => {
|
||||
const { t } = useTranslation();
|
||||
const mobile = useIsMobile();
|
||||
const [persistedCollapsed, toggleCollapsed] = useSidebarCollapsed();
|
||||
const collapsed = !mobile && persistedCollapsed;
|
||||
const contentRef = useRef(null);
|
||||
const [activeTab, setActiveTab] = useState('overview');
|
||||
const [activeOS, setActiveOS] = useState('windows');
|
||||
@@ -13,13 +31,13 @@ const Docs = () => {
|
||||
|
||||
// 导航菜单配置
|
||||
const navItems = [
|
||||
{ id: 'overview', icon: 'fa-home', label: t('概述') },
|
||||
{ id: 'claude-code', icon: 'fa-brain', label: 'Claude Code' },
|
||||
{ id: 'codex', icon: 'fa-code', label: 'CodeX' },
|
||||
{ id: 'gemini', icon: 'fa-gem', label: 'Gemini CLI' },
|
||||
{ id: 'deployment', icon: 'fa-download', label: t('部署指南') },
|
||||
{ id: 'best-practices', icon: 'fa-lightbulb', label: t('最佳实践') },
|
||||
{ id: 'comparison', icon: 'fa-chart-bar', label: t('工具对比') },
|
||||
{ id: 'overview', icon: BookOpen, label: t('概述') },
|
||||
{ id: 'claude-code', icon: BrainCircuit, label: 'Claude Code' },
|
||||
{ id: 'codex', icon: Code, label: 'CodeX' },
|
||||
{ id: 'gemini', icon: Gem, label: 'Gemini CLI' },
|
||||
{ id: 'deployment', icon: Download, label: t('部署指南') },
|
||||
{ id: 'best-practices', icon: Lightbulb, label: t('最佳实践') },
|
||||
{ id: 'comparison', icon: Columns2, label: t('工具对比') },
|
||||
];
|
||||
|
||||
// 复制代码功能:走公共 copy,HTTP 部署下 navigator.clipboard 为 undefined,
|
||||
@@ -44,38 +62,31 @@ const Docs = () => {
|
||||
return (
|
||||
<div className='mt-[60px]'>
|
||||
<div className='docs-container'>
|
||||
{/* 左侧边栏 */}
|
||||
<aside className='docs-sidebar'>
|
||||
<nav className='docs-nav'>
|
||||
<div className='docs-nav-section'>
|
||||
{navItems.slice(0, 4).map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`docs-nav-item ${activeTab === item.id ? 'active' : ''}`}
|
||||
onClick={() => setActiveTab(item.id)}
|
||||
>
|
||||
<i className={`fas ${item.icon}`}></i>
|
||||
<span>{item.label}</span>
|
||||
</div>
|
||||
<CenterSidebar
|
||||
className='docs-sidebar'
|
||||
navigationClassName='docs-nav'
|
||||
collapsed={collapsed}
|
||||
mobile={mobile}
|
||||
onToggle={toggleCollapsed}
|
||||
>
|
||||
{[navItems.slice(0, 4), navItems.slice(4)].map((items) => (
|
||||
<div
|
||||
key={items[0].id}
|
||||
className='ui-org-group-items docs-nav-section'
|
||||
>
|
||||
{items.map(({ id, label, icon: Icon }) => (
|
||||
<CenterSidebarItem
|
||||
key={id}
|
||||
label={label}
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
collapsed={collapsed}
|
||||
active={activeTab === id}
|
||||
onClick={() => setActiveTab(id)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className='docs-nav-divider'></div>
|
||||
|
||||
<div className='docs-nav-section'>
|
||||
{navItems.slice(4).map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`docs-nav-item ${activeTab === item.id ? 'active' : ''}`}
|
||||
onClick={() => setActiveTab(item.id)}
|
||||
>
|
||||
<i className={`fas ${item.icon}`}></i>
|
||||
<span>{item.label}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</nav>
|
||||
</aside>
|
||||
))}
|
||||
</CenterSidebar>
|
||||
|
||||
{/* 右侧内容区域 */}
|
||||
<main className='docs-content' ref={contentRef}>
|
||||
|
||||
+18
-87
@@ -7,74 +7,19 @@
|
||||
background: var(--ui-color-bg-0);
|
||||
}
|
||||
|
||||
/* 侧边栏 */
|
||||
/* 文档导航在窄屏保留横向布局。 */
|
||||
.docs-sidebar {
|
||||
width: 260px;
|
||||
background: var(--ui-color-bg-2);
|
||||
border-right: 1px solid var(--ui-color-border);
|
||||
flex-shrink: 0;
|
||||
overflow-y: auto;
|
||||
position: sticky;
|
||||
top: 64px;
|
||||
height: calc(100vh - 64px);
|
||||
top: var(--app-header-height, 72px);
|
||||
height: calc(100vh - var(--app-header-height, 72px));
|
||||
}
|
||||
|
||||
.docs-nav {
|
||||
padding: 1.5rem 0;
|
||||
.docs-sidebar .docs-nav {
|
||||
padding-top: 24px;
|
||||
}
|
||||
|
||||
.docs-nav-section {
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
.docs-nav-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.875rem 1.5rem;
|
||||
color: var(--ui-color-text-2);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.docs-nav-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: var(--ui-color-primary);
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.docs-nav-item i {
|
||||
font-size: 1rem;
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.docs-nav-item:hover {
|
||||
background: var(--ui-color-fill-0);
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
|
||||
.docs-nav-item.active {
|
||||
background: var(--ui-color-primary-light-default);
|
||||
color: var(--ui-color-primary);
|
||||
}
|
||||
|
||||
.docs-nav-item.active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.docs-nav-divider {
|
||||
height: 1px;
|
||||
background: var(--ui-color-border);
|
||||
margin: 1rem 1.5rem;
|
||||
.docs-nav-section + .docs-nav-section {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
@@ -942,10 +887,6 @@
|
||||
|
||||
/* 响应式 */
|
||||
@media (max-width: 1024px) {
|
||||
.docs-sidebar {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.docs-content {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
@@ -965,33 +906,23 @@
|
||||
border-bottom: 1px solid var(--ui-color-border);
|
||||
}
|
||||
|
||||
.docs-nav {
|
||||
.docs-sidebar .docs-nav {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
padding: 0.5rem;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.docs-nav-section {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
.docs-nav-section:not([hidden]) {
|
||||
flex-direction: row;
|
||||
flex: none;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.docs-nav-item {
|
||||
padding: 0.75rem 1rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 不能隐藏文字只留图标:图标是 <i class="fas fa-*">,而 FontAwesome
|
||||
全站从未引入(index.html 无 link、package.json 无依赖),字形根本渲染不出来。
|
||||
隐藏文字后手机端侧栏会变成 7 个纯空白方块,没有任何可辨认的导航。
|
||||
.docs-nav 本身已是 flex + overflow-x:auto,保留文字即成为可横滑的 chip 条。 */
|
||||
.docs-nav-item span {
|
||||
display: inline;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.docs-nav-divider {
|
||||
display: none;
|
||||
.docs-sidebar button.ui-center-menu-item {
|
||||
width: auto;
|
||||
flex: none;
|
||||
padding-inline: 12px;
|
||||
}
|
||||
|
||||
.docs-content {
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { I18N_TECHNICAL_TEXT } from '../../../i18n/technicalText.js';
|
||||
import {
|
||||
ChevronRight as ActionChevronRight,
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BrainCircuit, Image, Video } from 'lucide-react';
|
||||
import { useSidebarCollapsed } from '../../../hooks/common/useSidebarCollapsed';
|
||||
import { useSidebarNavigation } from '../../../hooks/common/useTopNavigation';
|
||||
import { useExperienceModules } from '../useExperienceModules';
|
||||
import { badgeText } from '../../../hooks/creation/creationWatch';
|
||||
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarItem,
|
||||
} from '../../../components/layout/components/CenterSidebar';
|
||||
|
||||
/**
|
||||
* 体验中心桌面侧栏:结构、样式与收起交互对齐用户中心侧栏(UserCenterSidebar),
|
||||
* 共用 center-layout.css 的 .ui-center-sidebar / .ui-center-menu-item / .ui-center-sidebar-collapse,
|
||||
@@ -22,6 +24,7 @@ import { badgeText } from '../../../hooks/creation/creationWatch';
|
||||
const ExperienceSidebar = ({ unread }) => {
|
||||
const { t } = useTranslation();
|
||||
const [collapsed, toggleCollapsed] = useSidebarCollapsed();
|
||||
const followSidebarLink = useSidebarNavigation();
|
||||
const location = useLocation();
|
||||
const { isAvailable } = useExperienceModules();
|
||||
|
||||
@@ -67,69 +70,59 @@ const ExperienceSidebar = ({ unread }) => {
|
||||
'';
|
||||
|
||||
return (
|
||||
<aside
|
||||
className='ui-experience-sidebar ui-center-sidebar'
|
||||
data-collapsed={collapsed}
|
||||
<CenterSidebar
|
||||
className='ui-experience-sidebar'
|
||||
collapsed={collapsed}
|
||||
onToggle={toggleCollapsed}
|
||||
>
|
||||
<nav className='ui-center-sidebar-nav'>
|
||||
<div className='ui-org-group-items'>
|
||||
{navItems.map((item) => {
|
||||
const active = selectedKey === item.itemKey;
|
||||
const Icon = item.icon;
|
||||
const unreadCount =
|
||||
item.unreadKey && !active ? unread?.[item.unreadKey] || 0 : 0;
|
||||
const unreadLabel = unreadCount
|
||||
? t('{{n}} 个新作品', { n: unreadCount })
|
||||
: '';
|
||||
<div className='ui-org-group-items'>
|
||||
{navItems.map((item) => {
|
||||
const active = selectedKey === item.itemKey;
|
||||
const Icon = item.icon;
|
||||
const unreadCount =
|
||||
item.unreadKey && !active ? unread?.[item.unreadKey] || 0 : 0;
|
||||
const unreadLabel = unreadCount
|
||||
? t('{{n}} 个新作品', { n: unreadCount })
|
||||
: '';
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.itemKey}
|
||||
to={item.to}
|
||||
className='ui-center-menu-item'
|
||||
data-active={active || undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
aria-label={
|
||||
unreadLabel ? `${item.text}(${unreadLabel})` : undefined
|
||||
}
|
||||
title={collapsed ? item.text : undefined}
|
||||
>
|
||||
<Icon size={16} strokeWidth={1.5} aria-hidden='true' />
|
||||
{!collapsed && (
|
||||
<span className='ui-center-menu-label'>{item.text}</span>
|
||||
)}
|
||||
{!collapsed && item.beta && (
|
||||
<span className='ui-org-beta'>
|
||||
{I18N_TECHNICAL_TEXT.BETA}
|
||||
</span>
|
||||
)}
|
||||
{unreadCount > 0 ? (
|
||||
<span
|
||||
className='exp-unread-badge ui-experience-unread'
|
||||
aria-hidden='true'
|
||||
>
|
||||
{badgeText(unreadCount)}
|
||||
</span>
|
||||
) : null}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-center-sidebar-collapse'
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
>
|
||||
{collapsed ? (
|
||||
<ActionChevronRight size={16} />
|
||||
) : (
|
||||
<ActionChevronLeft size={16} />
|
||||
)}
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
</aside>
|
||||
return (
|
||||
<CenterSidebarItem
|
||||
key={item.itemKey}
|
||||
to={item.to}
|
||||
label={item.text}
|
||||
collapsed={collapsed}
|
||||
active={active}
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
onClick={(event) => followSidebarLink(item.to, event)}
|
||||
aria-label={
|
||||
unreadLabel
|
||||
? `${item.text}(${unreadLabel})`
|
||||
: collapsed
|
||||
? item.text
|
||||
: undefined
|
||||
}
|
||||
trailing={
|
||||
<>
|
||||
{!collapsed && item.beta && (
|
||||
<span className='ui-org-beta'>
|
||||
{I18N_TECHNICAL_TEXT.BETA}
|
||||
</span>
|
||||
)}
|
||||
{unreadCount > 0 && (
|
||||
<span
|
||||
className='exp-unread-badge ui-experience-unread'
|
||||
aria-hidden='true'
|
||||
>
|
||||
{badgeText(unreadCount)}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CenterSidebar>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import React, { useContext } from 'react';
|
||||
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Navigate, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BrainCircuit, Image, Video } from 'lucide-react';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
import { useSidebarNavigation } from '../../hooks/common/useTopNavigation';
|
||||
import PageBackground from '../../components/common/PageBackground';
|
||||
import TextModel from './components/TextModel';
|
||||
import ImageGeneration from './components/ImageGeneration';
|
||||
@@ -13,7 +14,10 @@ import KeyManagement from './components/KeyManagement';
|
||||
import ExperienceSidebar from './components/ExperienceSidebar';
|
||||
import CloudBrain from '../CloudBrain';
|
||||
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
|
||||
import Loading from '../../components/common/ui/Loading';
|
||||
import {
|
||||
CenterRouteLoading,
|
||||
CenterSidebarLoading,
|
||||
} from '../../components/layout/components/CenterSidebarLoading';
|
||||
import { DEFAULT_LOGIN_REDIRECT } from '../../helpers/data';
|
||||
import { isCreationStudioEnabled } from '../../helpers/creationStudio';
|
||||
import { badgeText } from '../../hooks/creation/creationWatch';
|
||||
@@ -27,8 +31,9 @@ import {
|
||||
} from './useExperienceModules';
|
||||
|
||||
// 移动端底部导航组件(exp-mobile-bottom-nav:新创作台展开态期间由 creation-dock.css 隐藏)
|
||||
const MobileBottomNav = ({ currentPath, navigate, isAvailable, unread }) => {
|
||||
const MobileBottomNav = ({ currentPath, isAvailable, unread }) => {
|
||||
const { t } = useTranslation();
|
||||
const followSidebarLink = useSidebarNavigation();
|
||||
|
||||
// 与桌面侧边栏共用 useExperienceModules 判定,运营关闭的子页两端一致隐藏
|
||||
const navItems = [
|
||||
@@ -71,7 +76,9 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable, unread }) => {
|
||||
return (
|
||||
<button
|
||||
key={item.key}
|
||||
onClick={() => navigate(item.path)}
|
||||
type='button'
|
||||
aria-current={isActive ? 'page' : undefined}
|
||||
onClick={(event) => followSidebarLink(item.path, event)}
|
||||
className={`relative flex flex-col items-center justify-center flex-1 h-full transition-all ${
|
||||
isActive ? 'scale-105' : 'opacity-60'
|
||||
}`}
|
||||
@@ -118,7 +125,6 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable, unread }) => {
|
||||
|
||||
const ExperienceCenter = () => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const { ready, orgOnly, isAvailable, defaultPath } = useExperienceModules();
|
||||
|
||||
@@ -141,7 +147,11 @@ const ExperienceCenter = () => {
|
||||
].includes(location.pathname);
|
||||
if (isEntryPath) {
|
||||
// 配置/登录态就绪前不判定:默认配置全开,抢跑会落到随后才知道已关闭的页
|
||||
return ready ? <Navigate to={fallbackPath} replace /> : <Loading />;
|
||||
return ready ? (
|
||||
<Navigate to={fallbackPath} replace />
|
||||
) : (
|
||||
<CenterRouteLoading variant='experience' />
|
||||
);
|
||||
}
|
||||
|
||||
// 运营关闭(或分组不可见、org_only 被后端拦截)的子页,直达链接也转去可用页,
|
||||
@@ -181,7 +191,11 @@ const ExperienceCenter = () => {
|
||||
>
|
||||
{/* Sidebar - 桌面端 */}
|
||||
<div className='hidden md:block flex-shrink-0 h-full'>
|
||||
<ExperienceSidebar unread={unread} />
|
||||
{ready ? (
|
||||
<ExperienceSidebar unread={unread} />
|
||||
) : (
|
||||
<CenterSidebarLoading variant='experience' />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
@@ -226,7 +240,6 @@ const ExperienceCenter = () => {
|
||||
{/* 移动端底部导航栏 */}
|
||||
<MobileBottomNav
|
||||
currentPath={location.pathname}
|
||||
navigate={navigate}
|
||||
isAvailable={isAvailable}
|
||||
unread={unread}
|
||||
/>
|
||||
|
||||
@@ -1,94 +1,61 @@
|
||||
import React, { useEffect, useId, useState } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Wallet } from 'lucide-react';
|
||||
import { ChevronDown as ActionChevronDown } from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
CenterSidebarItem,
|
||||
CenterSidebarSubmenu,
|
||||
} from '../../components/layout/components/CenterSidebar';
|
||||
import { useSidebarGroups } from '../../hooks/common/useSidebarGroups';
|
||||
import {
|
||||
PARTNER_NAVIGATION,
|
||||
partnerView,
|
||||
} from '../CommissionV2/partnerNavigation';
|
||||
|
||||
const GROUP = 'commission';
|
||||
|
||||
export default function OrgCommissionNavigation({
|
||||
collapsed,
|
||||
expandSidebar,
|
||||
query,
|
||||
renderText,
|
||||
onNavigate,
|
||||
followSidebarLink,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const active = location.pathname === '/org/commission';
|
||||
const view = partnerView(location.search);
|
||||
const [open, setOpen] = useState(active);
|
||||
const submenuId = useId();
|
||||
const { keys, setGroup, toggle } = useSidebarGroups();
|
||||
useEffect(() => {
|
||||
if (active) setOpen(true);
|
||||
}, [active, location.key]);
|
||||
const expanded = !collapsed && (open || !!query);
|
||||
const parentMatches = t('企业分佣').toLowerCase().includes(query);
|
||||
const children = PARTNER_NAVIGATION.filter(
|
||||
(item) =>
|
||||
!query || parentMatches || t(item.label).toLowerCase().includes(query),
|
||||
);
|
||||
if (active) setGroup(GROUP, true);
|
||||
}, [active, location.key, setGroup]);
|
||||
|
||||
// 样式与控制台二级菜单一致(center-layout.css 的 .ui-console-submenu-*):父项 16px 图标 + 展开箭头,
|
||||
// 子项无图标、与父项文字左对齐并带层级引导线;收起态点击先展开侧栏。
|
||||
return (
|
||||
<div className='ui-console-submenu org-commission-navigation'>
|
||||
<button
|
||||
type='button'
|
||||
className='ui-center-menu-item ui-console-submenu-toggle'
|
||||
data-child-active={active || undefined}
|
||||
aria-label={t('企业分佣')}
|
||||
title={collapsed ? t('企业分佣') : undefined}
|
||||
aria-expanded={expanded}
|
||||
aria-controls={submenuId}
|
||||
onClick={() => {
|
||||
if (collapsed) {
|
||||
expandSidebar();
|
||||
setOpen(true);
|
||||
} else setOpen((value) => !value);
|
||||
}}
|
||||
>
|
||||
<Wallet size={16} strokeWidth={1.5} aria-hidden='true' />
|
||||
{!collapsed && (
|
||||
<>
|
||||
<span className='ui-center-menu-label'>
|
||||
{renderText(t('企业分佣'))}
|
||||
</span>
|
||||
<ActionChevronDown
|
||||
size={14}
|
||||
className='ui-console-submenu-arrow'
|
||||
aria-hidden
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
<div
|
||||
id={submenuId}
|
||||
role='group'
|
||||
aria-label={t('企业分佣')}
|
||||
className='ui-org-group-items ui-console-submenu-items'
|
||||
hidden={!expanded}
|
||||
>
|
||||
{children.map((item) => {
|
||||
const selected = active && view === item.key;
|
||||
return (
|
||||
<Link
|
||||
key={item.key}
|
||||
to={`/org/commission?view=${item.key}`}
|
||||
onClick={() => onNavigate?.()}
|
||||
aria-current={selected ? 'page' : undefined}
|
||||
data-active={selected || undefined}
|
||||
className='ui-center-menu-item ui-console-submenu-item'
|
||||
>
|
||||
<span className='ui-center-menu-label'>
|
||||
{renderText(t(item.label))}
|
||||
</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<CenterSidebarSubmenu
|
||||
className='org-commission-navigation'
|
||||
label={t('企业分佣')}
|
||||
icon={<Wallet size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
collapsed={collapsed}
|
||||
open={!collapsed && keys.includes(GROUP)}
|
||||
childActive={active}
|
||||
onToggle={() => {
|
||||
if (collapsed) {
|
||||
expandSidebar();
|
||||
setGroup(GROUP, true);
|
||||
} else toggle(GROUP);
|
||||
}}
|
||||
>
|
||||
{PARTNER_NAVIGATION.map((item) => {
|
||||
const to = `/org/commission?view=${item.key}`;
|
||||
return (
|
||||
<CenterSidebarItem
|
||||
key={item.key}
|
||||
to={to}
|
||||
label={t(item.label)}
|
||||
active={active && view === item.key}
|
||||
nested
|
||||
onClick={(event) => followSidebarLink(to, event)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CenterSidebarSubmenu>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ const OrgResolver = ({
|
||||
}, [runCheck]);
|
||||
|
||||
if (mode === 'checking') {
|
||||
return <CenterRouteLoading />;
|
||||
return <CenterRouteLoading variant='org' />;
|
||||
}
|
||||
|
||||
if (mode === 'proxy_required') {
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { I18N_TECHNICAL_TEXT } from '../../i18n/technicalText.js';
|
||||
import {
|
||||
ChevronDown as ActionChevronDown,
|
||||
ChevronRight as ActionChevronRight,
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import React, { useContext, useEffect, useMemo } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
BarChart3,
|
||||
@@ -34,6 +29,13 @@ import {
|
||||
UserCog,
|
||||
} from 'lucide-react';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useSidebarNavigation } from '../../hooks/common/useTopNavigation';
|
||||
import { useSidebarGroups } from '../../hooks/common/useSidebarGroups';
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarGroup,
|
||||
CenterSidebarItem,
|
||||
} from '../../components/layout/components/CenterSidebar';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
|
||||
import { canAccessOrgSettings } from './orgFeatureFlags';
|
||||
@@ -111,6 +113,7 @@ const OrgSidebar = ({
|
||||
const [collapsedState, toggleCollapsed] = useSidebarCollapsed();
|
||||
// 移动端抽屉里始终展开,不允许折叠
|
||||
const collapsed = mobile ? false : collapsedState;
|
||||
const followSidebarLink = useSidebarNavigation(onNavigate);
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const orgConfig = useMemo(
|
||||
() =>
|
||||
@@ -534,31 +537,11 @@ const OrgSidebar = ({
|
||||
[groups, items],
|
||||
);
|
||||
|
||||
const navRef = useRef(null);
|
||||
|
||||
// 二级分组折叠:仅记录用户手动收起的组,跨会话记忆
|
||||
const FOLDED_GROUPS_KEY = 'org_sidebar_folded_groups';
|
||||
const [foldedGroups, setFoldedGroups] = useState(() => {
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(FOLDED_GROUPS_KEY) || '[]');
|
||||
return Array.isArray(saved) ? saved : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
const toggleGroup = (key) => {
|
||||
setFoldedGroups((prev) => {
|
||||
const next = prev.includes(key)
|
||||
? prev.filter((k) => k !== key)
|
||||
: [...prev, key];
|
||||
try {
|
||||
localStorage.setItem(FOLDED_GROUPS_KEY, JSON.stringify(next));
|
||||
} catch {
|
||||
/* 隐私模式等场景下写入失败可忽略,仅丢失记忆 */
|
||||
}
|
||||
return next;
|
||||
});
|
||||
};
|
||||
const {
|
||||
keys: foldedGroups,
|
||||
toggle: toggleGroup,
|
||||
setGroup,
|
||||
} = useSidebarGroups('org_sidebar_folded_groups');
|
||||
|
||||
const getSelectedKey = () => {
|
||||
if (location.pathname === '/org/member-accounts') {
|
||||
@@ -580,141 +563,91 @@ const OrgSidebar = ({
|
||||
const activeGroup = groupedItems.find((g) =>
|
||||
g.items.some((it) => it.itemKey === selectedKey),
|
||||
)?.key;
|
||||
if (!activeGroup) return;
|
||||
setFoldedGroups((prev) =>
|
||||
prev.includes(activeGroup) ? prev.filter((k) => k !== activeGroup) : prev,
|
||||
);
|
||||
}, [selectedKey, groupedItems, location.key]);
|
||||
|
||||
// 选中项滚入可视区(分组较多时避免高亮项被折叠区/滚动区遮住)
|
||||
useEffect(() => {
|
||||
const el = navRef.current?.querySelector('[data-active="true"]');
|
||||
el?.scrollIntoView({ block: 'nearest' });
|
||||
}, [selectedKey, location.search]);
|
||||
setGroup(activeGroup, false);
|
||||
}, [selectedKey, groupedItems, location.key, setGroup]);
|
||||
|
||||
return (
|
||||
<aside
|
||||
className='ui-center-sidebar ui-org-sidebar'
|
||||
data-collapsed={collapsed}
|
||||
data-mobile={mobile || undefined}
|
||||
>
|
||||
{!collapsed && (
|
||||
<div className='ui-org-identity'>
|
||||
<LayoutGrid size={24} strokeWidth={1.65} aria-hidden='true' />
|
||||
<div className='ui-org-identity-copy'>
|
||||
<span className='ui-org-name' title={orgName || t('企业中心')}>
|
||||
{orgName || t('企业中心')}
|
||||
</span>
|
||||
{orgRole && <span className='ui-org-role'>{roleLabel}</span>}
|
||||
</div>
|
||||
{organizations.length > 1 && (
|
||||
<select
|
||||
aria-label={t('切换企业')}
|
||||
className='mt-3 w-full rounded-md border border-[var(--border-subtle)] bg-[var(--surface-card)] px-2 py-1 text-sm'
|
||||
value={currentOrgId}
|
||||
onChange={(event) =>
|
||||
onOrganizationChange?.(Number(event.target.value))
|
||||
}
|
||||
>
|
||||
{!organizations.some((org) => org.id === currentOrgId) && (
|
||||
<option value={currentOrgId}>{orgName}</option>
|
||||
)}
|
||||
{organizations.map((org) => (
|
||||
<option key={org.id} value={org.id}>
|
||||
{org.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<nav ref={navRef} className='ui-center-sidebar-nav'>
|
||||
{groupedItems.map((group) => {
|
||||
const folded = foldedGroups.includes(group.key);
|
||||
return (
|
||||
<div key={group.key} className='ui-org-nav-group'>
|
||||
{!collapsed && (
|
||||
<button
|
||||
type='button'
|
||||
onClick={() => toggleGroup(group.key)}
|
||||
aria-expanded={!folded}
|
||||
className='app-action-button ui-org-group-toggle'
|
||||
>
|
||||
<span>{group.label}</span>
|
||||
<ActionChevronDown
|
||||
size={13}
|
||||
className={folded ? 'is-folded' : ''}
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
<div className='ui-org-group-items' hidden={folded && !collapsed}>
|
||||
{group.items.map((item) => {
|
||||
// 企业分佣二级导航(weiyuan eb3936cf0);企业侧栏无菜单搜索,query 恒为空
|
||||
if (item.commissionAccess)
|
||||
return (
|
||||
<OrgCommissionNavigation
|
||||
key={item.itemKey}
|
||||
collapsed={collapsed}
|
||||
expandSidebar={toggleCollapsed}
|
||||
query=''
|
||||
renderText={(text) => text}
|
||||
onNavigate={onNavigate}
|
||||
/>
|
||||
);
|
||||
const isSelected = selectedKey === item.itemKey;
|
||||
const IconComponent = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
onClick={() => onNavigate?.()}
|
||||
data-active={isSelected || undefined}
|
||||
aria-current={isSelected ? 'page' : undefined}
|
||||
title={collapsed ? item.text : undefined}
|
||||
className='ui-center-menu-item'
|
||||
>
|
||||
<IconComponent
|
||||
size={16}
|
||||
strokeWidth={1.5}
|
||||
aria-hidden='true'
|
||||
/>
|
||||
{!collapsed && (
|
||||
<>
|
||||
<span className='ui-center-menu-label'>
|
||||
{item.text}
|
||||
</span>
|
||||
{item.beta && (
|
||||
<span className='ui-org-beta'>
|
||||
{I18N_TECHNICAL_TEXT.BETA}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<CenterSidebar
|
||||
className='ui-org-sidebar'
|
||||
collapsed={collapsed}
|
||||
mobile={mobile}
|
||||
onToggle={toggleCollapsed}
|
||||
header={
|
||||
!collapsed && (
|
||||
<div className='ui-org-identity'>
|
||||
<LayoutGrid size={24} strokeWidth={1.65} aria-hidden='true' />
|
||||
<div className='ui-org-identity-copy'>
|
||||
<span className='ui-org-name' title={orgName || t('企业中心')}>
|
||||
{orgName || t('企业中心')}
|
||||
</span>
|
||||
{orgRole && <span className='ui-org-role'>{roleLabel}</span>}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
{!mobile && (
|
||||
<button
|
||||
type='button'
|
||||
onClick={toggleCollapsed}
|
||||
className='app-action-button ui-center-sidebar-collapse'
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
{organizations.length > 1 && (
|
||||
<select
|
||||
aria-label={t('切换企业')}
|
||||
className='mt-3 w-full rounded-md border border-[var(--border-subtle)] bg-[var(--surface-card)] px-2 py-1 text-sm'
|
||||
value={currentOrgId}
|
||||
onChange={(event) =>
|
||||
onOrganizationChange?.(Number(event.target.value))
|
||||
}
|
||||
>
|
||||
{!organizations.some((org) => org.id === currentOrgId) && (
|
||||
<option value={currentOrgId}>{orgName}</option>
|
||||
)}
|
||||
{organizations.map((org) => (
|
||||
<option key={org.id} value={org.id}>
|
||||
{org.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
>
|
||||
{groupedItems.map((group) => (
|
||||
<CenterSidebarGroup
|
||||
key={group.key}
|
||||
label={group.label}
|
||||
folded={foldedGroups.includes(group.key)}
|
||||
collapsed={collapsed}
|
||||
onToggle={() => toggleGroup(group.key)}
|
||||
>
|
||||
{collapsed ? (
|
||||
<ActionChevronRight size={16} />
|
||||
) : (
|
||||
<ActionChevronLeft size={16} />
|
||||
)}
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
)}
|
||||
</aside>
|
||||
{group.items.map((item) => {
|
||||
if (item.commissionAccess) {
|
||||
return (
|
||||
<OrgCommissionNavigation
|
||||
key={item.itemKey}
|
||||
collapsed={collapsed}
|
||||
expandSidebar={toggleCollapsed}
|
||||
followSidebarLink={followSidebarLink}
|
||||
/>
|
||||
);
|
||||
}
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<CenterSidebarItem
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
label={item.text}
|
||||
collapsed={collapsed}
|
||||
active={selectedKey === item.itemKey}
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
onClick={(event) => followSidebarLink(item.itemKey, event)}
|
||||
trailing={
|
||||
!collapsed &&
|
||||
item.beta && (
|
||||
<span className='ui-org-beta'>
|
||||
{I18N_TECHNICAL_TEXT.BETA}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CenterSidebarGroup>
|
||||
))}
|
||||
</CenterSidebar>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -777,7 +777,7 @@ const Organization = () => {
|
||||
(orgInfo &&
|
||||
(loadedOrgScope?.orgId !== orgId || loadedOrgScope?.user !== user))
|
||||
) {
|
||||
return <CenterRouteLoading />;
|
||||
return <CenterRouteLoading variant='org' />;
|
||||
}
|
||||
|
||||
// 待激活占位页:不展示任何企业功能,仅引导联系客服/管理员
|
||||
@@ -817,7 +817,8 @@ const Organization = () => {
|
||||
}
|
||||
|
||||
if (!firstOrgRoute) {
|
||||
if (commissionAccess === 'loading') return <CenterRouteLoading />;
|
||||
if (commissionAccess === 'loading')
|
||||
return <CenterRouteLoading variant='org' />;
|
||||
// 企业会话(org_only 员工、企业入口登录)、超管代理、或企业已有模块切到新体系:
|
||||
// 显示明确空态,不默认开放、不静默跳走(AC121)。其余(未切换的个人会话)保持原行为回个人中心
|
||||
if (
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
ChevronRight as ActionChevronRight,
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useMemo, useContext } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import {
|
||||
isMiniProgramPaymentPath,
|
||||
isMiniProgramWebView,
|
||||
@@ -25,8 +21,14 @@ import { UserContext } from '../../context/User';
|
||||
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
|
||||
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { useSidebarNavigation } from '../../hooks/common/useTopNavigation';
|
||||
import { useWeyAiDownloadEntry } from '../../hooks/common/useWeyAiWebEntry';
|
||||
|
||||
import {
|
||||
CenterSidebar,
|
||||
CenterSidebarItem,
|
||||
} from '../../components/layout/components/CenterSidebar';
|
||||
|
||||
const UserCenterSidebar = () => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
@@ -34,6 +36,7 @@ const UserCenterSidebar = () => {
|
||||
const [userState] = useContext(UserContext);
|
||||
const userGroup = userState?.user?.group || 'default';
|
||||
const [collapsed, toggleCollapsed] = useSidebarCollapsed();
|
||||
const followSidebarLink = useSidebarNavigation();
|
||||
// WeyAi 桌面端下载入口:与顶栏「下载 WeyAi」按钮共用同一套判定
|
||||
//(下载页开关 + 网页端已配置时沿用其开放范围),两处入口口径一致
|
||||
const { visible: weyaiDownloadEnabled } = useWeyAiDownloadEntry();
|
||||
@@ -143,47 +146,28 @@ const UserCenterSidebar = () => {
|
||||
const selectedKey = getSelectedKey();
|
||||
|
||||
return (
|
||||
<aside
|
||||
className='ui-user-sidebar ui-center-sidebar'
|
||||
data-collapsed={collapsed}
|
||||
<CenterSidebar
|
||||
className='ui-user-sidebar'
|
||||
collapsed={collapsed}
|
||||
onToggle={toggleCollapsed}
|
||||
>
|
||||
<nav className='ui-center-sidebar-nav'>
|
||||
<div className='ui-org-group-items'>
|
||||
{items.map((item) => {
|
||||
const active = selectedKey === item.itemKey;
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
className='ui-center-menu-item'
|
||||
data-active={active || undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
title={collapsed ? item.text : undefined}
|
||||
>
|
||||
<Icon size={16} strokeWidth={1.5} aria-hidden='true' />
|
||||
{!collapsed && (
|
||||
<span className='ui-center-menu-label'>{item.text}</span>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</nav>
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button ui-center-sidebar-collapse'
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
>
|
||||
{collapsed ? (
|
||||
<ActionChevronRight size={16} />
|
||||
) : (
|
||||
<ActionChevronLeft size={16} />
|
||||
)}
|
||||
{!collapsed && <span>{t('收起导航')}</span>}
|
||||
</button>
|
||||
</aside>
|
||||
<div className='ui-org-group-items'>
|
||||
{items.map((item) => {
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<CenterSidebarItem
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
label={item.text}
|
||||
collapsed={collapsed}
|
||||
active={selectedKey === item.itemKey}
|
||||
icon={<Icon size={16} strokeWidth={1.5} aria-hidden='true' />}
|
||||
onClick={(event) => followSidebarLink(item.itemKey, event)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</CenterSidebar>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import React, { useContext } from 'react';
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
Navigate,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from 'react-router-dom';
|
||||
import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
KeyRound,
|
||||
@@ -20,6 +14,7 @@ import {
|
||||
import { UserContext } from '../../context/User';
|
||||
import { isSidebarModuleVisible } from '../../helpers/navigationVisibility';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
import { useSidebarNavigation } from '../../hooks/common/useTopNavigation';
|
||||
import PageBackground from '../../components/common/PageBackground';
|
||||
import UserCenterSidebar from './UserCenterSidebar';
|
||||
import UserDashboard from './UserDashboard';
|
||||
@@ -42,7 +37,7 @@ import { useUserCenterRoutes } from './useUserCenterRoutes';
|
||||
const MobileBottomNav = ({ sidebarConfig }) => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const followSidebarLink = useSidebarNavigation();
|
||||
const [userState] = useContext(UserContext);
|
||||
const userGroup = userState?.user?.group;
|
||||
|
||||
@@ -123,7 +118,7 @@ const MobileBottomNav = ({ sidebarConfig }) => {
|
||||
type='button'
|
||||
data-active={isActive}
|
||||
aria-current={isActive ? 'page' : undefined}
|
||||
onClick={() => navigate(item.path)}
|
||||
onClick={(event) => followSidebarLink(item.path, event)}
|
||||
className='uc-mobile-nav-item flex flex-col items-center justify-center flex-1 h-full'
|
||||
>
|
||||
<IconComponent size={20} />
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
.ui-center-route-loading {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
padding-top: var(--console-header-offset, 72px);
|
||||
padding-top: var(--console-header-offset, var(--app-header-height, 72px));
|
||||
background: var(--surface-bg-base);
|
||||
}
|
||||
|
||||
@@ -36,12 +36,15 @@
|
||||
animation: ui-center-sidebar-placeholder-reveal 100ms ease-out 140ms both;
|
||||
}
|
||||
|
||||
.ui-center-sidebar .ui-center-sidebar-placeholder-rows {
|
||||
.ui-center-sidebar-placeholder-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding-top: 24px;
|
||||
overflow: hidden;
|
||||
align-items: center;
|
||||
height: 30px;
|
||||
padding-inline: 16px;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder-identity {
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder-rows .ui-center-menu-item {
|
||||
@@ -57,7 +60,12 @@
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder
|
||||
:is(.ui-center-menu-item, .ui-center-sidebar-placeholder-footer)
|
||||
:is(
|
||||
.ui-center-menu-item,
|
||||
.ui-center-sidebar-placeholder-footer,
|
||||
.ui-center-sidebar-placeholder-group,
|
||||
.ui-center-sidebar-placeholder-identity
|
||||
)
|
||||
> span {
|
||||
display: block;
|
||||
width: 16px;
|
||||
@@ -68,6 +76,21 @@
|
||||
animation: ui-center-sidebar-placeholder-reveal 100ms ease-out 140ms both;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder-group > span {
|
||||
width: 48px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder-identity > span:first-child {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder-identity > span + span {
|
||||
width: 84px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.ui-center-sidebar-placeholder .ui-center-menu-item > span + span {
|
||||
width: 60%;
|
||||
height: 12px;
|
||||
@@ -110,9 +133,7 @@
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ui-center-route-loading-body,
|
||||
.ui-center-sidebar-placeholder
|
||||
:is(.ui-center-menu-item, .ui-center-sidebar-placeholder-footer)
|
||||
> span {
|
||||
.ui-center-sidebar-placeholder span {
|
||||
animation-duration: 0ms;
|
||||
}
|
||||
}
|
||||
@@ -163,6 +184,11 @@
|
||||
overflow: hidden auto;
|
||||
}
|
||||
|
||||
.ui-center-sidebar:not([data-collapsed='true']):not([data-mobile='true'])
|
||||
.ui-center-sidebar-nav {
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.ui-org-nav-group + .ui-org-nav-group {
|
||||
margin-top: 18px;
|
||||
}
|
||||
@@ -214,6 +240,17 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ui-center-sidebar button.ui-center-menu-item {
|
||||
width: 100%;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
.ui-center-sidebar button.ui-center-menu-item:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui-center-menu-item > svg {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,13 @@ const mocks = {
|
||||
'../../hooks/common/useSidebarCollapsed': {
|
||||
useSidebarCollapsed: () => [false, () => {}],
|
||||
},
|
||||
'../../hooks/common/useTopNavigation': {
|
||||
useSidebarNavigation: () => () => {},
|
||||
},
|
||||
'../../components/layout/components/CenterSidebar': {
|
||||
CenterSidebar: 'aside',
|
||||
CenterSidebarItem: 'link',
|
||||
},
|
||||
'../../hooks/common/useWeyAiWebEntry': {
|
||||
useWeyAiDownloadEntry: () => ({ visible: false }),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user