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 (