diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx index bfa23d4..fc0c21e 100644 --- a/src/components/layout/MainLayout.tsx +++ b/src/components/layout/MainLayout.tsx @@ -1,5 +1,5 @@ import { useEffect, useMemo, useState } from 'react'; -import { NavLink, Outlet, useNavigate } from 'react-router-dom'; +import { NavLink, Outlet } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/Button'; import { useAuthStore, useConfigStore, useLanguageStore, useNotificationStore, useThemeStore } from '@/stores'; @@ -34,15 +34,12 @@ const compareVersions = (latest?: string | null, current?: string | null) => { export function MainLayout() { const { t, i18n } = useTranslation(); - const navigate = useNavigate(); const { showNotification } = useNotificationStore(); const apiBase = useAuthStore((state) => state.apiBase); const serverVersion = useAuthStore((state) => state.serverVersion); const serverBuildDate = useAuthStore((state) => state.serverBuildDate); const connectionStatus = useAuthStore((state) => state.connectionStatus); - const checkAuth = useAuthStore((state) => state.checkAuth); - const logout = useAuthStore((state) => state.logout); const config = useConfigStore((state) => state.config); const fetchConfig = useConfigStore((state) => state.fetchConfig); @@ -54,7 +51,7 @@ export function MainLayout() { const toggleLanguage = useLanguageStore((state) => state.toggleLanguage); const [sidebarOpen, setSidebarOpen] = useState(false); - const [checkingConnection, setCheckingConnection] = useState(false); + const [sidebarCollapsed, setSidebarCollapsed] = useState(false); const [checkingVersion, setCheckingVersion] = useState(false); const isLocal = useMemo(() => isLocalhost(window.location.hostname), []); @@ -96,22 +93,6 @@ export function MainLayout() { } }; - const handleCheckConnection = async () => { - setCheckingConnection(true); - try { - const ok = await checkAuth(); - if (ok) { - showNotification(t('common.connected_status'), 'success'); - } else { - showNotification(t('common.disconnected_status'), 'warning'); - } - } catch (error: any) { - showNotification(`${t('notification.login_failed')}: ${error?.message || ''}`, 'error'); - } finally { - setCheckingConnection(false); - } - }; - const handleVersionCheck = async () => { setCheckingVersion(true); try { @@ -141,15 +122,10 @@ export function MainLayout() { } }; - const handleLogout = () => { - logout(); - navigate('/login', { replace: true }); - }; - return (
-