Files
monkey-ai-web/src/pages/MonitorCenter/index.jsx
T
qiubaishen 61294dc597 merge: 合入总仓库 weiyuan(bfdfb339) web/ 新功能,保留 ui-optimization 的 UI 重构
来源:luoguang/monkey-ai weiyuan@bfdfb339 的 web/(经 sync/main-weiyuan-web-bfdfb339 同步)
同步基准:总仓库 a2ca13cb = 本仓库初始导入 d8f3aee2

冲突处理原则:保留 ui-optimization 的 UI(样式/结构/组件),嫁接 weiyuan 的功能逻辑。
- i18n:按键三方合并;ours 的「令牌→密钥」改名键上移植 theirs 的术语修订
- task-logs / OrgLogs:ours 已手工移植同一功能(6ad95e2),保留 ours
- 删除:OrgCreate(theirs 下线 /org/create)、旧 image 组件与 VideoRegenerateModal(theirs 体验中心重写)、
  OrgAvatarSection / PricingBentoPage / CommissionConsole(ours 重构中已移除)
- 测试:users-pagination 的 i18next mock 补 t();theirs 新增文件补 license header
2026-11-10 12:01:21 +08:00

93 lines
2.6 KiB
React

/*
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, { useState, useEffect } from 'react';
import { Tabs, Card } from '@/components/ui';
import { Activity, Shield } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import ChannelMonitor from './ChannelMonitor';
import AdminMonitor from './AdminMonitor';
import './monitor-center.css';
const MonitorCenter = () => {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState('channel');
const [userRole, setUserRole] = useState(0);
useEffect(() => {
const raw = localStorage.getItem('user');
if (raw) {
try {
const user = JSON.parse(raw);
setUserRole(user.role || 0);
} catch (e) {
console.error('Failed to parse user data:', e);
}
}
}, []);
const isAdmin = userRole >= 10;
return (
<div className='console-content'>
<div className='console-content'>
{/* 页面标题 */}
{/* 标签页 */}
<Card className='console-monitor-card'>
<Tabs
activeKey={activeTab}
onChange={setActiveTab}
type='line'
size='large'
>
<Tabs.TabPane
tab={
<span className='flex items-center gap-2'>
<Activity className='w-4 h-4' />
{t('渠道监控')}
</span>
}
itemKey='channel'
>
<ChannelMonitor />
</Tabs.TabPane>
{isAdmin && (
<Tabs.TabPane
tab={
<span className='flex items-center gap-2'>
<Shield className='w-4 h-4' />
{t('管理监控')}
</span>
}
itemKey='admin'
>
<AdminMonitor />
</Tabs.TabPane>
)}
</Tabs>
</Card>
</div>
</div>
);
};
export default MonitorCenter;