diff --git a/frontend/src/basic/Main.tsx b/frontend/src/basic/Main.tsx
index 7f8659b9..73e06843 100644
--- a/frontend/src/basic/Main.tsx
+++ b/frontend/src/basic/Main.tsx
@@ -97,6 +97,10 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
};
}, []);
+ useEffect(() => {
+ setWindowSize(getWindowSize(theme.typography.fontSize));
+ }, [theme.typography.fontSize]);
+
const onResize = function () {
setWindowSize(getWindowSize(theme.typography.fontSize));
};
diff --git a/frontend/src/components/SettingsForm/index.tsx b/frontend/src/components/SettingsForm/index.tsx
index 86e0aef3..03543b22 100644
--- a/frontend/src/components/SettingsForm/index.tsx
+++ b/frontend/src/components/SettingsForm/index.tsx
@@ -9,10 +9,12 @@ import {
List,
ListItem,
ListItemIcon,
+ Slider,
+ Typography,
} from '@mui/material';
import { Settings } from '../../models';
import SelectLanguage from './SelectLanguage';
-import { Language, Palette, LightMode, DarkMode } from '@mui/icons-material';
+import { Language, Palette, LightMode, DarkMode, FormatSize } from '@mui/icons-material';
interface SettingsFormProps {
dense?: boolean;
@@ -20,9 +22,31 @@ interface SettingsFormProps {
setSettings: (state: Settings) => void;
}
+const fontSizesBasic = [
+ { label: 'XS', value: 12 },
+ { label: 'S', value: 13 },
+ { label: 'M', value: 14 },
+ { label: 'L', value: 15 },
+ { label: 'XL', value: 16 },
+];
+const fontSizesPro = [
+ { label: 'XS', value: 10 },
+ { label: 'S', value: 11 },
+ { label: 'M', value: 12 },
+ { label: 'L', value: 13 },
+ { label: 'XL', value: 14 },
+];
+
const SettingsForm = ({ dense = false, settings, setSettings }: SettingsFormProps): JSX.Element => {
const theme = useTheme();
const { t } = useTranslation();
+ const fontSizes = [
+ { label: 'XS', value: { basic: 12, pro: 10 } },
+ { label: 'S', value: { basic: 13, pro: 11 } },
+ { label: 'M', value: { basic: 14, pro: 12 } },
+ { label: 'L', value: { basic: 15, pro: 13 } },
+ { label: 'XL', value: { basic: 16, pro: 14 } },
+ ];
return (
@@ -37,6 +61,7 @@ const SettingsForm = ({ dense = false, settings, setSettings }: SettingsFormProp
setLanguage={(language) => setSettings({ ...settings, language })}
/>
+
@@ -55,6 +80,8 @@ const SettingsForm = ({ dense = false, settings, setSettings }: SettingsFormProp
height: '1.2em',
borderRadius: '0.4em',
backgroundColor: 'white',
+ position: 'relative',
+ top: `${7 - 0.5 * theme.typography.fontSize}px`,
}}
>
@@ -69,9 +96,11 @@ const SettingsForm = ({ dense = false, settings, setSettings }: SettingsFormProp
borderRadius: '0.4em',
backgroundColor: 'white',
padding: '0.07em',
+ position: 'relative',
+ top: `${7 - 0.5 * theme.typography.fontSize}px`,
}}
>
-
+
}
onChange={(e) =>
@@ -81,6 +110,25 @@ const SettingsForm = ({ dense = false, settings, setSettings }: SettingsFormProp
}
/>
+
+
+
+
+
+ setSettings({ ...settings, fontSize: e.target.value })}
+ valueLabelDisplay='off'
+ marks={fontSizes.map(({ label, value }) => ({
+ label: {t(label)},
+ value: settings.frontend === 'basic' ? value.basic : value.pro,
+ }))}
+ track={false}
+ />
+
diff --git a/frontend/src/models/Settings.default.basic.ts b/frontend/src/models/Settings.default.basic.ts
index 235f7e4f..e640115c 100644
--- a/frontend/src/models/Settings.default.basic.ts
+++ b/frontend/src/models/Settings.default.basic.ts
@@ -2,6 +2,7 @@ import { baseSettings, Settings } from './Settings.model';
export const defaultSettings: Settings = {
...baseSettings,
+ frontend: 'basic',
};
export default defaultSettings;
diff --git a/frontend/src/models/Settings.default.pro.ts b/frontend/src/models/Settings.default.pro.ts
index 42ed07b4..d7c9829b 100644
--- a/frontend/src/models/Settings.default.pro.ts
+++ b/frontend/src/models/Settings.default.pro.ts
@@ -3,6 +3,7 @@ import { baseSettings, Settings } from './Settings.model';
export const defaultSettings: Settings = {
...baseSettings,
fontSize: 12,
+ frontend: 'pro',
};
export default defaultSettings;
diff --git a/frontend/src/models/Settings.model.ts b/frontend/src/models/Settings.model.ts
index e82a6d38..5c6c1ea9 100644
--- a/frontend/src/models/Settings.model.ts
+++ b/frontend/src/models/Settings.model.ts
@@ -3,6 +3,7 @@ import type Coordinator from './Coordinator.model';
import type Language from './Language.model';
export interface Settings {
+ frontend: 'basic' | 'pro';
mode: 'light' | 'dark';
fontSize: number;
language: Language;
@@ -12,6 +13,7 @@ export interface Settings {
}
export const baseSettings: Settings = {
+ frontend: 'basic',
mode:
window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
diff --git a/frontend/src/pro/Main.tsx b/frontend/src/pro/Main.tsx
index 065eddd3..68871f26 100644
--- a/frontend/src/pro/Main.tsx
+++ b/frontend/src/pro/Main.tsx
@@ -17,7 +17,13 @@ import {
defaultInfo,
} from '../models';
-import { PlaceholderWidget, MakerWidget, BookWidget, DepthChartWidget } from '../pro/Widgets';
+import {
+ PlaceholderWidget,
+ MakerWidget,
+ BookWidget,
+ DepthChartWidget,
+ SettingsWidget,
+} from '../pro/Widgets';
import ToolBar from '../pro/ToolBar';
import LandingDialog from '../pro/LandingDialog';
@@ -101,6 +107,10 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
setWindowSize(getWindowSize(em));
};
+ useEffect(() => {
+ setWindowSize(getWindowSize(theme.typography.fontSize));
+ }, [theme.typography.fontSize]);
+
const fetchLimits = async () => {
setLimits({ ...limits, loading: true });
const data = apiClient.get('/api/limits/').then((data) => {
@@ -188,6 +198,9 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
windowSize={windowSize}
/>
+
+
+
@@ -197,9 +210,6 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
-
diff --git a/frontend/src/pro/Widgets/Settings.tsx b/frontend/src/pro/Widgets/Settings.tsx
new file mode 100644
index 00000000..7d5bd55f
--- /dev/null
+++ b/frontend/src/pro/Widgets/Settings.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+
+import { Settings } from '../../models';
+import { Paper, useTheme } from '@mui/material';
+import SettingsForm from '../../components/SettingsForm';
+
+interface SettingsWidgetProps {
+ settings: Settings;
+ setSettings: (state: Settings) => void;
+ style?: Object;
+ className?: string;
+ onMouseDown?: () => void;
+ onMouseUp?: () => void;
+ onTouchEnd?: () => void;
+}
+
+const SettingsWidget = React.forwardRef(
+ (
+ {
+ settings,
+ setSettings,
+ style,
+ className,
+ onMouseDown,
+ onMouseUp,
+ onTouchEnd,
+ }: SettingsWidgetProps,
+ ref,
+ ) => {
+ const theme = useTheme();
+ return React.useMemo(() => {
+ return (
+
+
+
+ );
+ }, [settings]);
+ },
+);
+
+export default SettingsWidget;
diff --git a/frontend/src/pro/Widgets/index.ts b/frontend/src/pro/Widgets/index.ts
index f81883fd..604b3856 100644
--- a/frontend/src/pro/Widgets/index.ts
+++ b/frontend/src/pro/Widgets/index.ts
@@ -1,4 +1,5 @@
export { default as MakerWidget } from './Maker';
export { default as BookWidget } from './Book';
export { default as DepthChartWidget } from './Depth';
+export { default as SettingsWidget } from './Settings';
export { default as PlaceholderWidget } from './Placeholder';