import { useDispatch, useSelector } from "react-redux"; import { useTranslation } from "react-i18next"; import Box from "@mui/material/Box"; import Checkbox from "@mui/material/Checkbox"; import FormControlLabel from "@mui/material/FormControlLabel"; import useMediaQuery from "@mui/material/useMediaQuery"; import { setSize, setWeight, setAlpha, setJustify, setCalt, setTnum, } from "./labSlice"; import { RootState } from "./reducers"; import { LabState } from "./labSlice"; export function SettingsPanel() { const { t } = useTranslation(undefined, {keyPrefix: 'lab'}); const dispatch = useDispatch(); const labState: LabState = useSelector( (state: RootState) => state.labReducer, (prev, next) => prev.isVariable === next.isVariable && prev.justify === next.justify && prev.tnum === next.tnum && prev.calt === next.calt && prev.alpha === next.alpha && prev.size === next.size && prev.weight === next.weight, ); const { isVariable, justify, calt, tnum, size, weight, alpha } = labState; const isSmallScreen = useMediaQuery("(max-width:600px)"); return ( {t("size")} dispatch(setSize(e.target.value as number))} style={{ width: "130px" }} /> {size} {t("weight")} dispatch(setWeight(e.target.value as number))} style={{ width: "100px" }} /> {weight} {t("alpha")} dispatch(setAlpha(e.target.value as number))} style={{ width: "80px" }} /> {" "} dispatch(setJustify(!justify))} /> } label={String(t("justify"))} /> dispatch(setCalt(!calt))} /> } label={String(t("calt"))} /> dispatch(setTnum(!tnum))} color="secondary" /> } label={String(t("tnum"))} /> ); }