mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
add release channel setting and implementation
This commit is contained in:
parent
f14d1f3c5c
commit
4d12a4d6cb
7 changed files with 104 additions and 56 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
SettingsSection,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { useSettingsStoreActions, useWindowSettings } from '/@/renderer/store';
|
||||
import { Select } from '/@/shared/components/select/select';
|
||||
import { Switch } from '/@/shared/components/switch/switch';
|
||||
|
||||
const localSettings = isElectron() ? window.api.localSettings : null;
|
||||
|
|
@ -17,6 +18,46 @@ export const UpdateSettings = () => {
|
|||
const { setSettings } = useSettingsStoreActions();
|
||||
|
||||
const updateOptions: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Select
|
||||
data={[
|
||||
{
|
||||
label: t('setting.releaseChannel', {
|
||||
context: 'optionLatest',
|
||||
postProcess: 'titleCase',
|
||||
}),
|
||||
value: 'latest',
|
||||
},
|
||||
{
|
||||
label: t('setting.releaseChannel', {
|
||||
context: 'optionBeta',
|
||||
postProcess: 'titleCase',
|
||||
}),
|
||||
value: 'beta',
|
||||
},
|
||||
]}
|
||||
defaultValue={'latest'}
|
||||
onChange={(value) => {
|
||||
if (!value) return;
|
||||
localSettings?.set('release_channel', value);
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
releaseChannel: value as 'beta' | 'latest',
|
||||
},
|
||||
});
|
||||
}}
|
||||
value={settings.releaseChannel}
|
||||
/>
|
||||
),
|
||||
description: t('setting.releaseChannel', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: !isElectron(),
|
||||
title: t('setting.releaseChannel', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ export interface SettingsState {
|
|||
exitToTray: boolean;
|
||||
minimizeToTray: boolean;
|
||||
preventSleepOnPlayback: boolean;
|
||||
releaseChannel: 'beta' | 'latest';
|
||||
startMinimized: boolean;
|
||||
tray: boolean;
|
||||
windowBarStyle: Platform;
|
||||
|
|
@ -682,6 +683,7 @@ const initialState: SettingsState = {
|
|||
exitToTray: false,
|
||||
minimizeToTray: false,
|
||||
preventSleepOnPlayback: false,
|
||||
releaseChannel: 'latest',
|
||||
startMinimized: false,
|
||||
tray: true,
|
||||
windowBarStyle: platformDefaultWindowBarStyle,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue