diff --git a/src/components/Generic/Layout.tsx b/src/components/Generic/Layout.tsx index d0e5729..d79acea 100644 --- a/src/components/Generic/Layout.tsx +++ b/src/components/Generic/Layout.tsx @@ -6,7 +6,7 @@ export const Layout = () => { return ( { + return ( + + ); +}; diff --git a/src/components/HeaderBar/Settings/Settings.tsx b/src/components/HeaderBar/Settings/Settings.tsx index fcd021a..0cd92a8 100644 --- a/src/components/HeaderBar/Settings/Settings.tsx +++ b/src/components/HeaderBar/Settings/Settings.tsx @@ -22,7 +22,7 @@ export const Settings = () => { // states const [settingsOpenState, setSettingsOpenState] = useState(false); const [settingsMaximisedState, setSettingsMaximisedState] = useState(false); - const [subTabValue, setSubTabValue] = useState("display"); + const [subTabValue, setSubTabValue] = useState("style"); const [applyLoading, setApplyLoading] = useState(false); const [saveLoading, setSaveLoading] = useState(false); diff --git a/src/components/HeaderBar/Settings/SettingsItem.tsx b/src/components/HeaderBar/Settings/SettingsItem.tsx index b04cfd4..eb0eeac 100644 --- a/src/components/HeaderBar/Settings/SettingsItem.tsx +++ b/src/components/HeaderBar/Settings/SettingsItem.tsx @@ -1,19 +1,15 @@ -import { Box } from "@mui/material"; +import { Box, Typography } from "@mui/material"; import { FC, ReactNode } from "react"; interface SettingsItemProps { - settingsDescription: ReactNode; - settingsInput?: ReactNode; - settingsInputBottom?: ReactNode; - settingsInputLong?: ReactNode; + defaultText?: string; + description: ReactNode; + input?: ReactNode; + inputBottom?: ReactNode; + inputLong?: ReactNode; } -export const SettingsItem: FC = ({ - settingsDescription, - settingsInput, - settingsInputBottom, - settingsInputLong, -}) => { +export const SettingsItem: FC = ({ defaultText, description, input, inputBottom, inputLong }) => { return ( = ({ width: "100%", }} > - {settingsDescription} - {settingsInput && ( + + {description} + {defaultText && ( + + Default: {defaultText} + + )} + + {input && ( = ({ width: "30%", }} > - {settingsInput} + {input} )} - {settingsInputLong && ( + {inputLong && ( - {settingsInputLong} + {inputLong} )} - {settingsInputBottom && ( + {inputBottom && ( = ({ px: 2, }} > - {settingsInputBottom} + {inputBottom} )} diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabBackground.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabBackground.tsx deleted file mode 100644 index e9c1552..0000000 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabBackground.tsx +++ /dev/null @@ -1,340 +0,0 @@ -import { Box, Chip, InputAdornment, MenuItem, Slider, Switch, TextField, Typography } from "@mui/material"; -import { useAtom } from "jotai"; -import { FC } from "react"; -import { stagedSettingsAtom } from "../../../../lib/store/jotai/settings"; -import { BetaChip } from "../BetaChip"; -import { CategoryTitle } from "../CategoryTitle"; -import { SettingsItem } from "../SettingsItem"; - -interface SettingsTabBackgroundProps { - sx?: any; -} - -export const SettingsTabBackground: FC = ({ sx }) => { - // atoms - const [stagedSettings, setStagedSettings] = useAtom(stagedSettingsAtom); - - const handleSettingsBackgroundValueChange = ( - settingKey: string, - settingValue: boolean | number | string | number[], - ) => { - const newSettings = { - ...stagedSettings, - background: { - ...stagedSettings.background, - [settingKey]: settingValue, - }, - }; - setStagedSettings(newSettings); - }; - - return ( - - - - - Dark mode - - } - settingsInput={ - { - handleSettingsBackgroundValueChange(e.target.name, e.target.checked); - }} - /> - } - /> - - Accent color - - Default: #8ab4f8 - - - } - settingsInput={ - { - handleSettingsBackgroundValueChange(e.target.name, e.target.value); - }} - sx={{ - width: "100%", - }} - size="small" - type="color" - value={stagedSettings.style.accent_color} - variant="standard" - /> - } - /> - - Font family - - Default: Monospace - - - } - settingsInputLong={ - { - handleSettingsBackgroundValueChange(e.target.name, e.target.value); - }} - select - size="small" - sx={{ - maxWidth: "100%", - }} - value={stagedSettings.style.font_family || "monospace"} - variant="outlined" - > - Monospace - Sans Serif - Comic Sans - System font - - } - /> - - Font scaling - - Default: 100% - - - } - settingsInputBottom={ - { - handleSettingsBackgroundValueChange("font_scaling", value); - }} - step={10} - value={stagedSettings.style.font_scaling} - valueLabelDisplay="auto" - /> - } - /> - - - - - Transition duration - - - Default: 200ms - - - } - settingsInput={ - ms, - inputProps: { min: 0, max: 100, step: 1 }, - }} - name="transition_duration" - onChange={(e) => { - handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); - }} - sx={{ - width: "100%", - }} - size="small" - type="number" - value={stagedSettings.style.transition_duration} - variant="standard" - /> - } - /> - - - - Radius - - - Default: 8px - - - } - settingsInput={ - px, - inputProps: { min: 0, max: 100, step: 1 }, - }} - name="radius" - onChange={(e) => { - handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); - }} - sx={{ - width: "100%", - }} - size="small" - type="number" - value={stagedSettings.style.radius} - variant="standard" - /> - } - /> - - - - Window height - - - Default: 60% - - - } - settingsInput={ - %, - inputProps: { min: 0, max: 100, step: 1 }, - }} - name="window_height" - onChange={(e) => { - handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); - }} - sx={{ - width: "100%", - }} - size="small" - type="number" - value={stagedSettings.style.window_height} - variant="standard" - /> - } - /> - - - - Window width - - - Default: 400px - - - } - settingsInput={ - px, - inputProps: { min: 0, max: 10000, step: 1 }, - }} - name="window_width" - onChange={(e) => { - handleSettingsBackgroundValueChange(e.target.name, parseFloat(e.target.value)); - }} - sx={{ - width: "100%", - }} - size="small" - type="number" - value={stagedSettings.style.window_width} - variant="standard" - /> - } - /> - - ); -}; diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx index f50ed36..513d4b9 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabStyle.tsx @@ -5,6 +5,7 @@ import { stagedSettingsAtom } from "../../../../lib/store/jotai/settings"; import { BetaChip } from "../BetaChip"; import { CategoryTitle } from "../CategoryTitle"; import { SettingsItem } from "../SettingsItem"; +import { DevChip } from "../DevChip"; interface SettingsTabStyleProps { sx?: any; @@ -14,7 +15,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { // atoms const [stagedSettings, setStagedSettings] = useAtom(stagedSettingsAtom); - const handleSettingsDisplayValueChange = (settingKey: string, settingValue: boolean | number | string | number[]) => { + const handleSettingsStyleValueChange = (settingKey: string, settingValue: boolean | number | string | number[]) => { const newSettings = { ...stagedSettings, display: { @@ -29,43 +30,37 @@ export const SettingsTabStyle: FC = ({ sx }) => { - - Dark mode - + defaultText="On" + description={ + <> + + + Dark mode + + } - settingsInput={ + input={ { - handleSettingsDisplayValueChange(e.target.name, e.target.checked); + handleSettingsStyleValueChange(e.target.name, e.target.checked); }} /> } /> Accent color - - Default: #8ab4f8 - } - settingsInput={ + input={ { - handleSettingsDisplayValueChange(e.target.name, e.target.value); + handleSettingsStyleValueChange(e.target.name, e.target.value); }} sx={{ width: "100%", @@ -78,23 +73,18 @@ export const SettingsTabStyle: FC = ({ sx }) => { } /> Font family - - Default: Monospace - } - settingsInputLong={ + inputLong={ { - handleSettingsDisplayValueChange(e.target.name, e.target.value); + handleSettingsStyleValueChange(e.target.name, e.target.value); }} select size="small" @@ -112,18 +102,13 @@ export const SettingsTabStyle: FC = ({ sx }) => { } /> Font scaling - - Default: 100% - } - settingsInputBottom={ + inputBottom={ = ({ sx }) => { max={120} name="font_scaling" onChangeCommitted={(e, value) => { - handleSettingsDisplayValueChange("font_scaling", value); + handleSettingsStyleValueChange("font_scaling", value); }} step={10} value={stagedSettings.style.font_scaling} @@ -161,29 +146,16 @@ export const SettingsTabStyle: FC = ({ sx }) => { /> - + Transition duration - - Default: 200ms - } - settingsInput={ + input={ ms, @@ -191,7 +163,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { }} name="transition_duration" onChange={(e) => { - handleSettingsDisplayValueChange(e.target.name, parseFloat(e.target.value)); + handleSettingsStyleValueChange(e.target.name, parseFloat(e.target.value)); }} sx={{ width: "100%", @@ -204,7 +176,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { } /> = ({ sx }) => { } - settingsInput={ + input={ px, @@ -234,7 +206,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { }} name="radius" onChange={(e) => { - handleSettingsDisplayValueChange(e.target.name, parseFloat(e.target.value)); + handleSettingsStyleValueChange(e.target.name, parseFloat(e.target.value)); }} sx={{ width: "100%", @@ -247,7 +219,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { } /> = ({ sx }) => { } - settingsInput={ + input={ %, @@ -277,7 +249,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { }} name="window_height" onChange={(e) => { - handleSettingsDisplayValueChange(e.target.name, parseFloat(e.target.value)); + handleSettingsStyleValueChange(e.target.name, parseFloat(e.target.value)); }} sx={{ width: "100%", @@ -290,7 +262,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { } /> = ({ sx }) => { } - settingsInput={ + input={ px, @@ -320,7 +292,7 @@ export const SettingsTabStyle: FC = ({ sx }) => { }} name="window_width" onChange={(e) => { - handleSettingsDisplayValueChange(e.target.name, parseFloat(e.target.value)); + handleSettingsStyleValueChange(e.target.name, parseFloat(e.target.value)); }} sx={{ width: "100%", diff --git a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx index a68e0c7..ac6b893 100644 --- a/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx +++ b/src/components/HeaderBar/Settings/SettingsTabs/SettingsTabWindow.tsx @@ -28,12 +28,18 @@ export const SettingsTabWindow: FC = ({ sx }) => { Fullscreen on startup + + Default: On + } - settingsInput={ + input={ = ({ sx }) => { /> Minimize button + + Default: On + } - settingsInput={ + input={ = ({ sx }) => { } /> Maximize button } - settingsInput={ + input={