From e33ccd05bac79393a7f08ee5136b65210531ce4d Mon Sep 17 00:00:00 2001 From: gelaechter <30231932+gelaechter@users.noreply.github.com> Date: Mon, 20 Dec 2021 23:52:16 +0100 Subject: [PATCH] add a restart whisper to the titlebar style select --- .../ConfigPanels/LookAndFeelConfig.tsx | 81 +++++++++++++------ 1 file changed, 55 insertions(+), 26 deletions(-) diff --git a/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx b/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx index be0c058..6124e9f 100644 --- a/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx +++ b/src/components/settings/ConfigPanels/LookAndFeelConfig.tsx @@ -1,8 +1,9 @@ import React, { useRef, useState } from 'react'; import _ from 'lodash'; -import { shell } from 'electron'; +import { ipcRenderer, shell } from 'electron'; import settings from 'electron-settings'; -import { Nav, Icon, RadioGroup } from 'rsuite'; +import { Nav, Icon, RadioGroup, Whisper } from 'rsuite'; +import { WhisperInstance } from 'rsuite/lib/Whisper'; import { ConfigPanel } from '../styled'; import { StyledInputPicker, @@ -14,6 +15,8 @@ import { StyledRadio, StyledIconButton, StyledToggle, + StyledButton, + StyledPopover, } from '../../shared/styled'; import ListViewConfig from './ListViewConfig'; import { Fonts } from '../Fonts'; @@ -272,6 +275,7 @@ export const ThemeConfigPanel = ({ bordered }: any) => { const themePickerContainerRef = useRef(null); const fontPickerContainerRef = useRef(null); const titleBarPickerContainerRef = useRef(null); + const titleBarRestartWhisper = React.createRef(); const [themeList, setThemeList] = useState( _.concat(settings.getSync('themes'), settings.getSync('themesDefault')) ); @@ -354,30 +358,55 @@ export const ThemeConfigPanel = ({ bordered }: any) => { description="The titlebar style (requires app restart). " option={ - titleBarPickerContainerRef.current} - data={[ - { - label: 'macOS', - value: 'mac', - }, - { - label: 'Windows', - value: 'windows', - }, - { - label: 'Native', - value: 'native', - }, - ]} - cleanable={false} - defaultValue={String(settings.getSync('titleBarStyle'))} - width={200} - onChange={(e: string) => { - settings.setSync('titleBarStyle', e); - dispatch(setMiscSetting({ setting: 'titleBar', value: e })); - }} - /> + +
Do you want to restart the application now?
+ This is highly recommended! +
+ { + ipcRenderer.send('reload'); + }} + appearance="primary" + > + Yes + +
+ + } + > + titleBarPickerContainerRef.current} + data={[ + { + label: 'macOS', + value: 'mac', + }, + { + label: 'Windows', + value: 'windows', + }, + { + label: 'Native', + value: 'native', + }, + ]} + cleanable={false} + defaultValue={String(settings.getSync('titleBarStyle'))} + width={200} + onChange={(e: string) => { + settings.setSync('titleBarStyle', e); + dispatch(setMiscSetting({ setting: 'titleBar', value: e })); + titleBarRestartWhisper.current?.open(); + }} + /> +
} />