import { BookOpen, Code2, HeartHandshake, LifeBuoy } from 'lucide-react'; import { Link, type LinkProps } from '@tanstack/react-router'; import Icon from '@/components/elements/Icon'; import { useAdminVersion } from '@/api/admin/version/queries'; import type { AdminVersion } from '@/api/admin/version/queries'; import AdminContentBlock from '@/components/admin/AdminContentBlock'; import OverviewVersionCard from '@/components/admin/overview/OverviewVersionCard'; import Spinner from '@/components/elements/Spinner'; import { httpErrorToHuman } from '@/api/http'; import { ServerError } from '@/components/elements/ScreenBlock'; import Slot from '@/extensions/Slot'; import { interactiveSurfaceClass } from '@/components/ui/styles'; import { cn } from '@/lib/cn'; import { useTranslation, type Translation } from '@/sdk/localization'; const sections = (t: Translation['t']): { to: LinkProps['to']; label: string; description: string }[] => [ { to: '/panel/users', label: t('Users'), description: t('Create, edit, and remove user accounts.') }, { to: '/panel/locations', label: t('Locations'), description: t('Group nodes into physical locations.') }, { to: '/panel/nodes', label: t('Nodes'), description: t('Manage Wings daemons and allocations.') }, { to: '/panel/servers', label: t('Servers'), description: t('Provision and manage game servers.') }, { to: '/panel/databases', label: t('Database Hosts'), description: t('Configure MySQL hosts for server databases.'), }, { to: '/panel/mounts', label: t('Mounts'), description: t('Define host → container mount points.') }, { to: '/panel/eggs', label: t('Eggs'), description: t('Manage server templates and variables.') }, { to: '/panel/settings', label: t('Settings'), description: t('General, mail, and advanced configuration.') }, { to: '/panel/api', label: t('API Keys'), description: t('Issue application API credentials.') }, ]; const externalLinks = (version: AdminVersion, t: Translation['t']) => [ { href: version.discord, label: t('Get Help'), icon: LifeBuoy }, { href: 'https://pterodactyl.io', label: t('Documentation'), icon: BookOpen }, { href: 'https://github.com/pterodactyl/panel', label: 'GitHub', icon: Code2 }, { href: version.donations, label: t('Support Project'), icon: HeartHandshake }, ]; export default function OverviewContainer() { const { t } = useTranslation(); const { data: version, error, refetch } = useAdminVersion(); if (error && !version) { return refetch()} />; } return ( {version ? ( <>
{externalLinks(version, t).map((link) => ( {link.label} ))}
) : ( )}
{sections(t).map((s) => (

{s.label}

{s.description}

))}
); }