/*
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 .
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useContext, useMemo } from 'react';
import {
Routes,
Route,
Navigate,
useLocation,
useNavigate,
} from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import {
Activity,
BarChart2,
CreditCard,
FileText,
Gift,
Receipt,
Settings,
} from 'lucide-react';
import { StatusContext } from '../../context/Status';
import PageBackground from '../../components/common/PageBackground';
import UserCenterSidebar from './UserCenterSidebar';
import UserDashboard from './UserDashboard';
import UsageRecord from './UsageRecord';
import Invite from './Invite';
import Invoice from './Invoice';
import TopUp from '../TopUp';
import PersonalSetting from '../../components/settings/PersonalSetting';
import ServiceDashboard from '../ServiceDashboard';
import WeyAiDownload from '../WeyAiDownload';
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
// 移动端底部导航组件
const MobileBottomNav = ({ sidebarConfig }) => {
const { t } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
const navItems = [
{
key: 'dashboard',
icon: BarChart2,
label: t('概览'),
path: '/user-center/dashboard',
},
{
key: 'usageRecord',
icon: FileText,
label: t('记录'),
path: '/user-center/usage-record',
},
{
key: 'serviceDashboard',
icon: Activity,
label: t('监控'),
path: '/user-center/service-dashboard',
},
{
key: 'invite',
icon: Gift,
label: t('邀请'),
path: '/user-center/invite',
},
{
key: 'topup',
icon: CreditCard,
label: t('充值'),
path: '/user-center/topup',
},
{
key: 'invoice',
icon: Receipt,
label: t('发票'),
path: '/user-center/invoice',
},
{
key: 'settings',
icon: Settings,
label: t('设置'),
path: '/user-center/settings',
},
];
const visibleNavItems = navItems.filter(
(item) =>
sidebarConfig?.enabled !== false && sidebarConfig?.[item.key] !== false,
);
if (visibleNavItems.length === 0) {
return null;
}
return (