diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/DisplaySettingsPanel.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/DisplaySettingsPanel.tsx deleted file mode 100644 index 03ed13a417..0000000000 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/DisplaySettingsPanel.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Trans } from '@lingui/macro'; -import { Button, Container, Group, Table, Title } from '@mantine/core'; - -import { ColorToggle } from '../../../../components/items/ColorToggle'; -import { LanguageSelect } from '../../../../components/items/LanguageSelect'; -import { IS_DEV } from '../../../../main'; -import { useLocalState } from '../../../../states/LocalState'; - -export function DisplaySettingsPanel({ height }: { height: number }) { - function enablePseudoLang(): void { - useLocalState.setState({ language: 'pseudo-LOCALE' }); - } - - return ( - - - <Trans>Display Settings</Trans> - - - - - - - - - - - - -
- Color Mode - - - - -
- Language - - {' '} - - - {IS_DEV && ( - - )} - -
-
- ); -} diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/UserPanel.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/UserPanel.tsx index a35e998f47..d080eb913b 100644 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/UserPanel.tsx +++ b/src/frontend/src/pages/Index/Settings/AccountSettings/UserPanel.tsx @@ -1,7 +1,6 @@ import { Container, Grid, SimpleGrid } from '@mantine/core'; import { AccountDetailPanel } from './AccountDetailPanel'; -import { DisplaySettingsPanel } from './DisplaySettingsPanel'; import { UserTheme } from './UserThemePanel'; export function AccountContent() { @@ -18,9 +17,6 @@ export function AccountContent() { - - - diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/UserThemePanel.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/UserThemePanel.tsx index fa3bb9cf70..111cefb39e 100644 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/UserThemePanel.tsx +++ b/src/frontend/src/pages/Index/Settings/AccountSettings/UserThemePanel.tsx @@ -1,21 +1,21 @@ import { Trans, t } from '@lingui/macro'; import { - ColorInput, + Button, ColorPicker, Container, DEFAULT_THEME, Group, Loader, Select, - Slider, Table, - Title + Title, + useMantineTheme } from '@mantine/core'; -import { useState } from 'react'; -import { SizeMarks } from '../../../../defaults/defaults'; +import { ColorToggle } from '../../../../components/items/ColorToggle'; +import { LanguageSelect } from '../../../../components/items/LanguageSelect'; +import { IS_DEV } from '../../../../main'; import { useLocalState } from '../../../../states/LocalState'; -import { theme } from '../../../../theme'; function getLkp(color: string) { return { [DEFAULT_THEME.colors[color][6]]: color }; @@ -26,50 +26,29 @@ const LOOKUP = Object.assign( ); export function UserTheme({ height }: { height: number }) { - // primary color - function changePrimary(color: string) { - useLocalState.setState({ primaryColor: LOOKUP[color] }); - } - // white color - const [whiteColor, setWhiteColor] = useState(theme.white); - function changeWhite(color: string) { - useLocalState.setState({ whiteColor: color }); - setWhiteColor(color); - } - // black color - const [blackColor, setBlackColor] = useState(theme.black); - function changeBlack(color: string) { - useLocalState.setState({ blackColor: color }); - setBlackColor(color); - } - // radius - function getMark(value: number) { - const obj = SizeMarks.find((mark) => mark.value === value); - if (obj) return obj; - return SizeMarks[0]; - } - function getDefaultRadius() { - const obj = SizeMarks.find( - (mark) => mark.label === useLocalState.getState().radius - ); - if (obj) return obj.value; - return 50; - } - const [radius, setRadius] = useState(getDefaultRadius()); - function changeRadius(value: number) { - setRadius(value); - useLocalState.setState({ radius: getMark(value).label }); - } - // loader - const loaderDate = [ - { value: 'bars', label: t`bars` }, - { value: 'oval', label: t`oval` }, - { value: 'dots', label: t`dots` } - ]; const [themeLoader, setThemeLoader] = useLocalState((state) => [ state.loader, state.setLoader ]); + + const theme = useMantineTheme(); + + // Set theme primary color + function changePrimary(color: string) { + useLocalState.setState({ primaryColor: LOOKUP[color] }); + } + + function enablePseudoLang(): void { + useLocalState.setState({ language: 'pseudo-LOCALE' }); + } + + // Custom loading indicator + const loaderDate = [ + { value: 'bars', label: t`Bars` }, + { value: 'oval', label: t`Oval` }, + { value: 'dots', label: t`Dots` } + ]; + function changeLoader(value: string | null) { if (value === null) return; setThemeLoader(value); @@ -78,13 +57,58 @@ export function UserTheme({ height }: { height: number }) { return ( - <Trans>Theme</Trans> + <Trans>Display Settings</Trans> - Primary color + Language + + + + + + {IS_DEV && ( + + )} + + + + + Color Mode + + + + + + + + + + + Loader + + + + - - +