mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Refactor settings store and components
This commit is contained in:
parent
373441e4c6
commit
eecbcddea3
30 changed files with 894 additions and 832 deletions
|
|
@ -0,0 +1,45 @@
|
|||
import isElectron from 'is-electron';
|
||||
import { Platform } from '/@/renderer/types';
|
||||
import { useWindowSettings, useSettingsStoreActions } from '../../../../store/settings.store';
|
||||
import {
|
||||
SettingsSection,
|
||||
SettingOption,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { Select } from '/@/renderer/components';
|
||||
|
||||
const WINDOW_BAR_OPTIONS = [
|
||||
{ label: 'Web (hidden)', value: Platform.WEB },
|
||||
{ label: 'Windows', value: Platform.WINDOWS },
|
||||
{ label: 'macOS', value: Platform.MACOS },
|
||||
];
|
||||
|
||||
export const WindowSettings = () => {
|
||||
const settings = useWindowSettings();
|
||||
const { setSettings } = useSettingsStoreActions();
|
||||
|
||||
const windowOptions: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Select
|
||||
data={WINDOW_BAR_OPTIONS}
|
||||
disabled={!isElectron()}
|
||||
value={settings.windowBarStyle}
|
||||
onChange={(e) => {
|
||||
if (!e) return;
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
windowBarStyle: e as Platform,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: 'Adjust the style of the application window bar',
|
||||
isHidden: !isElectron(),
|
||||
title: 'Window bar style',
|
||||
},
|
||||
];
|
||||
|
||||
return <SettingsSection options={windowOptions} />;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue