diff --git a/src/Home.tsx b/src/Home.tsx index c102865..109c9ca 100644 --- a/src/Home.tsx +++ b/src/Home.tsx @@ -18,6 +18,10 @@ import { GameMove } from "./models/GameMove"; import PitAnimator from "./animation/PitAnimator"; import BoardViewModel from "./viewmodel/BoardViewModel"; import { v4 } from "uuid"; +import { Menu, MenuButton, MenuItem } from "@szhsin/react-menu"; +import "@szhsin/react-menu/dist/index.css"; +import "@szhsin/react-menu/dist/transitions/slide.css"; +import { getColorByLuminance } from "./util/ColorUtil"; type ConnectionState = "connecting" | "error" | "connected" | "reconnecting"; @@ -116,6 +120,12 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => { }; }, []); + React.useEffect(() => { + context.themeManager.onThemeChange = () => { + updateBoardViewModel(pitAnimator.getBoardViewModelFromGame(game)); + }; + }, [boardViewModel]); + const resetGameState = () => { setGame(undefined); setCrashMessage(undefined); @@ -185,7 +195,11 @@ const Home: FunctionComponent<{ initial?: number }> = ({ initial = 0 }) => { } return <>>; }; - + const menuTextColor = getColorByLuminance( + context.themeManager.theme.appBarBgColor, + context.themeManager.theme.primary, + context.themeManager.theme.primaryLight + ); return (