import { Outlet, useLocation, useNavigate } from "react-router-dom"; import { useMe } from "../hooks/auth"; import { useServerEvents } from "../hooks/useServerEvents"; import { BottomBar } from "./BottomBar"; import { NotificationBell } from "./NotificationBell"; import { NotificationToaster } from "./NotificationToaster"; const TITLES: Record = { "/": "Forbidden Stars", "/group": "Группа", "/group/settings": "Настройки группы", "/account": "Аккаунт", "/match/new": "Новая партия", "/stats": "Общая статистика", }; export function AppShell() { const location = useLocation(); const navigate = useNavigate(); const { data: me } = useMe(); useServerEvents(!!me); // живые обновления (SSE) только при наличии сессии const title = TITLES[location.pathname] ?? (location.pathname.startsWith("/u/") ? "Профиль игрока" : "Forbidden Stars"); const isHome = location.pathname === "/"; return (
{isHome ? ( {title} ) : ( )}
{!isHome ? title : ""}
); }