sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization
- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等, semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi - 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复 - 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志 - 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求 - 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新 - 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useEffect, useId, useState } from 'react';
|
||||
import { Link, 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 {
|
||||
PARTNER_NAVIGATION,
|
||||
partnerView,
|
||||
} from '../CommissionV2/partnerNavigation';
|
||||
|
||||
export default function OrgCommissionNavigation({
|
||||
collapsed,
|
||||
expandSidebar,
|
||||
query,
|
||||
renderText,
|
||||
onNavigate,
|
||||
}) {
|
||||
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();
|
||||
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),
|
||||
);
|
||||
|
||||
// 样式与控制台二级菜单一致(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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user