import { Link } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
// Icons - smaller versions for mobile
const TicketIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const CogIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const PhoneIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const WheelIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const TariffIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const ServerIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const AdminIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const ChartIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const BanSystemIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const BroadcastIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const PromocodeIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const CampaignIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const UsersIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const PaymentsIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const PromoOffersIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const RemnawaveIcon = ({ className = "w-8 h-8" }: { className?: string }) => (
)
const ChevronRightIcon = () => (
)
interface AdminSection {
to: string
icon: React.ReactNode
mobileIcon: React.ReactNode
title: string
description: string
color: string
bgColor: string
textColor: string
}
// Mobile compact card
function MobileAdminCard({ to, mobileIcon, title, bgColor, textColor }: AdminSection) {
return (
{title}
)
}
// Desktop card
function DesktopAdminCard({ to, icon, title, description, bgColor, textColor }: AdminSection) {
return (
)
}
// Section group definition
interface SectionGroup {
title: string
emoji: string
sections: AdminSection[]
}
export default function AdminPanel() {
const { t } = useTranslation()
// Grouped admin sections
const sectionGroups: SectionGroup[] = [
{
title: 'Аналитика',
emoji: '📊',
sections: [
{
to: '/admin/dashboard',
icon: ,
mobileIcon: ,
title: t('admin.nav.dashboard'),
description: t('admin.panel.dashboardDesc'),
color: 'success',
bgColor: 'bg-emerald-500/20',
textColor: 'text-emerald-400'
},
{
to: '/admin/payments',
icon: ,
mobileIcon: ,
title: t('admin.nav.payments', 'Платежи'),
description: t('admin.panel.paymentsDesc', 'Проверка платежей'),
color: 'lime',
bgColor: 'bg-lime-500/20',
textColor: 'text-lime-400'
},
]
},
{
title: 'Пользователи',
emoji: '👥',
sections: [
{
to: '/admin/users',
icon: ,
mobileIcon: ,
title: t('admin.nav.users', 'Пользователи'),
description: t('admin.panel.usersDesc', 'Управление пользователями'),
color: 'indigo',
bgColor: 'bg-indigo-500/20',
textColor: 'text-indigo-400'
},
{
to: '/admin/tickets',
icon: ,
mobileIcon: ,
title: t('admin.nav.tickets'),
description: t('admin.panel.ticketsDesc'),
color: 'warning',
bgColor: 'bg-amber-500/20',
textColor: 'text-amber-400'
},
{
to: '/admin/ban-system',
icon: ,
mobileIcon: ,
title: t('admin.nav.banSystem'),
description: t('admin.panel.banSystemDesc'),
color: 'error',
bgColor: 'bg-red-500/20',
textColor: 'text-red-400'
},
]
},
{
title: 'Тарифы и продажи',
emoji: '💰',
sections: [
{
to: '/admin/tariffs',
icon: ,
mobileIcon: ,
title: t('admin.nav.tariffs'),
description: t('admin.panel.tariffsDesc'),
color: 'info',
bgColor: 'bg-cyan-500/20',
textColor: 'text-cyan-400'
},
{
to: '/admin/promocodes',
icon: ,
mobileIcon: ,
title: t('admin.nav.promocodes', 'Промокоды'),
description: t('admin.panel.promocodesDesc', 'Управление промокодами'),
color: 'violet',
bgColor: 'bg-violet-500/20',
textColor: 'text-violet-400'
},
{
to: '/admin/promo-offers',
icon: ,
mobileIcon: ,
title: t('admin.nav.promoOffers', 'Промопредложения'),
description: t('admin.panel.promoOffersDesc', 'Персональные скидки и предложения'),
color: 'orange',
bgColor: 'bg-orange-500/20',
textColor: 'text-orange-400'
},
]
},
{
title: 'Маркетинг',
emoji: '📣',
sections: [
{
to: '/admin/campaigns',
icon: ,
mobileIcon: ,
title: t('admin.nav.campaigns', 'Кампании'),
description: t('admin.panel.campaignsDesc', 'Рекламные кампании'),
color: 'orange',
bgColor: 'bg-orange-500/20',
textColor: 'text-orange-400'
},
{
to: '/admin/broadcasts',
icon: ,
mobileIcon: ,
title: t('admin.nav.broadcasts'),
description: t('admin.panel.broadcastsDesc'),
color: 'orange',
bgColor: 'bg-orange-500/20',
textColor: 'text-orange-400'
},
{
to: '/admin/wheel',
icon: ,
mobileIcon: ,
title: t('admin.nav.wheel'),
description: t('admin.panel.wheelDesc'),
color: 'error',
bgColor: 'bg-rose-500/20',
textColor: 'text-rose-400'
},
]
},
{
title: 'Система',
emoji: '⚙️',
sections: [
{
to: '/admin/settings',
icon: ,
mobileIcon: ,
title: t('admin.nav.settings'),
description: t('admin.panel.settingsDesc'),
color: 'accent',
bgColor: 'bg-blue-500/20',
textColor: 'text-blue-400'
},
{
to: '/admin/apps',
icon: ,
mobileIcon: ,
title: t('admin.nav.apps'),
description: t('admin.panel.appsDesc'),
color: 'success',
bgColor: 'bg-teal-500/20',
textColor: 'text-teal-400'
},
{
to: '/admin/servers',
icon: ,
mobileIcon: ,
title: t('admin.nav.servers'),
description: t('admin.panel.serversDesc'),
color: 'purple',
bgColor: 'bg-purple-500/20',
textColor: 'text-purple-400'
},
{
to: '/admin/remnawave',
icon: ,
mobileIcon: ,
title: t('admin.nav.remnawave', 'RemnaWave'),
description: t('admin.panel.remnawaveDesc', 'Управление панелью и статистика'),
color: 'purple',
bgColor: 'bg-purple-500/20',
textColor: 'text-purple-400'
},
]
},
]
// Flatten all sections for mobile view
const allSections = sectionGroups.flatMap(group => group.sections)
return (
{/* Header - compact on mobile */}
{t('admin.panel.title')}
{t('admin.panel.subtitle')}
{/* Mobile: Compact grid (all sections) */}
{allSections.map((section) => (
))}
{/* Tablet/Desktop: Grouped sections */}
{sectionGroups.map((group) => (
{/* Group header */}
{group.emoji}
{group.title}
{/* Group cards */}
{group.sections.map((section) => (
))}
))}
)
}