mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
titlebar switching
This commit is contained in:
parent
f0f2f54e5a
commit
33972c2a83
4 changed files with 37 additions and 2 deletions
|
|
@ -7,8 +7,11 @@ import {
|
|||
import { THEME_DATA } from '/@/renderer/hooks';
|
||||
import { useGeneralSettings, useSettingsStoreActions } from '/@/renderer/store/settings.store';
|
||||
import { AppTheme } from '/@/renderer/themes/types';
|
||||
import isElectron from 'is-electron';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||
|
||||
export const ThemeSettings = () => {
|
||||
const { t } = useTranslation();
|
||||
const settings = useGeneralSettings();
|
||||
|
|
@ -26,6 +29,15 @@ export const ThemeSettings = () => {
|
|||
followSystemTheme: e.currentTarget.checked,
|
||||
},
|
||||
});
|
||||
if (localSettings) {
|
||||
localSettings.themeSet(
|
||||
e.currentTarget.checked
|
||||
? 'system'
|
||||
: settings.theme === AppTheme.DEFAULT_DARK
|
||||
? 'dark'
|
||||
: 'light',
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
),
|
||||
|
|
@ -42,12 +54,19 @@ export const ThemeSettings = () => {
|
|||
data={THEME_DATA}
|
||||
defaultValue={settings.theme}
|
||||
onChange={(e) => {
|
||||
const theme = e as AppTheme;
|
||||
setSettings({
|
||||
general: {
|
||||
...settings,
|
||||
theme: e as AppTheme,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (localSettings) {
|
||||
console.log(theme);
|
||||
localSettings.themeSet(
|
||||
theme === AppTheme.DEFAULT_DARK ? 'dark' : 'light',
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue