import React, { useRef } from 'react'; import { Link, Outlet, useLocation } from '@tanstack/react-router'; import { cn } from '@/lib/utils'; import { StatusBar } from '@/components/StatusBar'; import { LayoutDashboard, Settings, Network, RefreshCw, BarChart3 } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/button'; import { ErrorBoundary } from 'react-error-boundary'; import { useToast } from '@/components/ui/use-toast'; import { getLocalizedErrorMessage } from '@/utils/errorMessages'; import iconPng from '@/assets/icon.png'; export const MainLayout: React.FC = () => { const location = useLocation(); const { t } = useTranslation(); const { toast } = useToast(); const hasShownRouteErrorToastRef = useRef(false); const navItems = [ { to: '/', icon: LayoutDashboard, label: t('nav.accounts'), }, { to: '/usage', icon: BarChart3, label: t('nav.usage'), }, { to: '/proxy', icon: Network, label: t('nav.proxy'), }, { to: '/settings', icon: Settings, label: t('nav.settings'), }, ]; return (
Gemini Nexus Logo

Gemini Nexus

{ hasShownRouteErrorToastRef.current = false; }} onError={(error) => { if (hasShownRouteErrorToastRef.current) { return; } toast({ title: t('error.generic'), description: getLocalizedErrorMessage(error, t), variant: 'destructive', }); hasShownRouteErrorToastRef.current = true; }} fallbackRender={({ resetErrorBoundary }) => (
{t('error.generic')}
{t('action.retry')}
)} >
); };