feat: možnost vypnout motýlky v nastavení
CI / Generate TypeScript types (push) Successful in 10s
CI / Server unit tests (push) Successful in 26s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 42s
CI / Playwright E2E tests (push) Successful in 1m53s
CI / Build and push Docker image (push) Successful in 46s
CI / Notify (push) Successful in 2s

This commit is contained in:
batmanisko committed 2026-10-12 13:14:53 +02:00
1 parent f91193c7de
commit abeee19259
4 files changed
+53 -2

No files matched your search

+11 -2
View File
@@ -1,5 +1,5 @@
import { Routes, Route } from "react-router-dom";
import { ProvideSettings } from "./context/settings";
import { ProvideSettings, useSettings } from "./context/settings";
import FlyingButterflies, { BUTTERFLY_PRESETS } from "./FlyingButterflies";
import "./FlyingButterflies.scss";
import { ToastContainer } from "react-toastify";
@@ -13,6 +13,15 @@ export const STATS_URL = '/stats';
export const OBJEDNANI_URL = '/objednani';
export const NAVRHY_URL = '/navrhy';
/** Motýlci se vykreslují jen pokud je uživatel nevypnul v nastavení. */
function Butterflies() {
const settings = useSettings();
if (settings?.showButterflies === false) {
return null;
}
return <FlyingButterflies numButterflies={BUTTERFLY_PRESETS.NORMAL} />;
}
export default function AppRoutes() {
return (
<Routes>
@@ -34,7 +43,7 @@ export default function AppRoutes() {
<ProvideSettings>
<SocketContext.Provider value={socket}>
<>
<FlyingButterflies numButterflies={BUTTERFLY_PRESETS.NORMAL} />
<Butterflies />
<App />
</>
<ToastContainer />