mirror of
https://github.com/jeffvli/feishin.git
synced 2024-11-20 14:37:06 +01:00
use type, remove console
This commit is contained in:
parent
b3a9e7ccba
commit
5e9ef9f23f
@ -1,5 +1,6 @@
|
|||||||
import { ipcMain, nativeTheme, safeStorage } from 'electron';
|
import { ipcMain, nativeTheme, safeStorage } from 'electron';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
import type { TitleTheme } from '/@/renderer/types';
|
||||||
|
|
||||||
export const store = new Store();
|
export const store = new Store();
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ ipcMain.handle('password-set', (_event, password: string, server: string) => {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('theme-set', (_event, theme: 'dark' | 'light' | 'system') => {
|
ipcMain.on('theme-set', (_event, theme: TitleTheme) => {
|
||||||
store.set('theme', theme);
|
store.set('theme', theme);
|
||||||
nativeTheme.themeSource = theme;
|
nativeTheme.themeSource = theme;
|
||||||
});
|
});
|
||||||
|
@ -35,6 +35,7 @@ import { store } from './features/core/settings/index';
|
|||||||
import MenuBuilder from './menu';
|
import MenuBuilder from './menu';
|
||||||
import { hotkeyToElectronAccelerator, isLinux, isMacOS, isWindows, resolveHtmlPath } from './utils';
|
import { hotkeyToElectronAccelerator, isLinux, isMacOS, isWindows, resolveHtmlPath } from './utils';
|
||||||
import './features';
|
import './features';
|
||||||
|
import type { TitleTheme } from '/@/renderer/types';
|
||||||
|
|
||||||
declare module 'node-mpv';
|
declare module 'node-mpv';
|
||||||
|
|
||||||
@ -416,7 +417,7 @@ const createWindow = async () => {
|
|||||||
new AppUpdater();
|
new AppUpdater();
|
||||||
}
|
}
|
||||||
|
|
||||||
const theme = store.get('theme') as 'dark' | 'light' | 'system' | undefined;
|
const theme = store.get('theme') as TitleTheme | undefined;
|
||||||
nativeTheme.themeSource = theme || 'dark';
|
nativeTheme.themeSource = theme || 'dark';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { IpcRendererEvent, ipcRenderer, webFrame } from 'electron';
|
import { IpcRendererEvent, ipcRenderer, webFrame } from 'electron';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
import type { TitleTheme } from '/@/renderer/types';
|
||||||
|
|
||||||
const store = new Store();
|
const store = new Store();
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ const fontError = (cb: (event: IpcRendererEvent, file: string) => void) => {
|
|||||||
ipcRenderer.on('custom-font-error', cb);
|
ipcRenderer.on('custom-font-error', cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
const themeSet = (theme: 'dark' | 'light' | 'system'): void => {
|
const themeSet = (theme: TitleTheme): void => {
|
||||||
ipcRenderer.send('theme-set', theme);
|
ipcRenderer.send('theme-set', theme);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,7 +62,6 @@ export const ThemeSettings = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (localSettings) {
|
if (localSettings) {
|
||||||
console.log(theme);
|
|
||||||
localSettings.themeSet(
|
localSettings.themeSet(
|
||||||
theme === AppTheme.DEFAULT_DARK ? 'dark' : 'light',
|
theme === AppTheme.DEFAULT_DARK ? 'dark' : 'light',
|
||||||
);
|
);
|
||||||
|
@ -209,3 +209,5 @@ export enum FontType {
|
|||||||
CUSTOM = 'custom',
|
CUSTOM = 'custom',
|
||||||
SYSTEM = 'system',
|
SYSTEM = 'system',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TitleTheme = 'dark' | 'light' | 'system';
|
||||||
|
Loading…
Reference in New Issue
Block a user