diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index ea72e4d..c21bbe7 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -1,5 +1,5 @@ -import { useEffect } from 'react' -import { HashRouter, Route, Routes } from 'react-router-dom' +import { useEffect, useState } from 'react' +import { HashRouter, Route, Routes, useLocation } from 'react-router-dom' import { Sidebar } from './components/Sidebar' import { Titlebar } from './components/Titlebar' import Dashboard from './pages/Dashboard' @@ -11,6 +11,7 @@ import { subscribeToBackend, useAppStore } from './store/appStore' export default function App(): JSX.Element { const hydrated = useAppStore((s) => s.hydrated) + const [mobileNavOpen, setMobileNavOpen] = useState(false) useEffect(() => { const unsub = subscribeToBackend() @@ -20,18 +21,18 @@ export default function App(): JSX.Element { return (
- + setMobileNavOpen(true)} + />
- -
+ setMobileNavOpen(false)} + /> +
{hydrated ? ( - - } /> - } /> - } /> - } /> - } /> - + setMobileNavOpen(false)} /> ) : (
Загрузка…
)} @@ -41,3 +42,21 @@ export default function App(): JSX.Element { ) } + +// Close mobile drawer whenever the route changes. +function RoutesWithCloseOnNav({ onClose }: { onClose: () => void }): JSX.Element { + const location = useLocation() + useEffect(() => { + onClose() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [location.pathname]) + return ( + + } /> + } /> + } /> + } /> + } /> + + ) +} diff --git a/src/renderer/src/ReminderApp.tsx b/src/renderer/src/ReminderApp.tsx index 24c90f0..4a314ca 100644 --- a/src/renderer/src/ReminderApp.tsx +++ b/src/renderer/src/ReminderApp.tsx @@ -123,7 +123,7 @@ function ExerciseReminder({
- Cooldown ready + Время тренировки
- Next drop через {formatInterval(exercise.intervalMinutes)} + Следующее через {formatInterval(exercise.intervalMinutes)}
@@ -280,9 +280,9 @@ function MatchSummaryView({

{won - ? 'Victory · упражнения заработаны' + ? 'Победа · тренировка заработана' : lost - ? 'Defeat · но тело — нет' + ? 'Проигрыш · но тело не сдаётся' : 'Матч завершён'}

@@ -293,7 +293,7 @@ function MatchSummaryView({ челлендж{summary.results.length === 1 ? '' : 'а'} ·{' '} {allDone ? ( - all clear + готово ) : ( @@ -316,11 +316,11 @@ function MatchSummaryView({

- Total ·{' '} + Всего ·{' '} {totalReps} {' '} - reps + повторов
+ + + + )} + + + ) +} + +function SidebarContent({ + compact, + onNav +}: { + compact: boolean + onNav?: () => void +}): JSX.Element { + return ( + <>
-
+ + {/* Brand */} +
-
+
-
+
Laude
- Play hard · Train harder + Move every day
-
+
-