diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-05-16 15:28:30 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-05-19 10:44:56 +0200 |
| commit | c7ef0929dc76fe858a33be7945c87e27af8e5e1e (patch) | |
| tree | 29a0e02ae60a0d0f40c7a3670128e20c2dd39e0c /gui/src/renderer/components | |
| parent | aa7a8d44c32bc5fb88898b3682b7b49dd3e91fe2 (diff) | |
| download | mullvadvpn-c7ef0929dc76fe858a33be7945c87e27af8e5e1e.tar.xz mullvadvpn-c7ef0929dc76fe858a33be7945c87e27af8e5e1e.zip | |
Add command line switch for force display of changes dialog
Diffstat (limited to 'gui/src/renderer/components')
| -rw-r--r-- | gui/src/renderer/components/Changelog.tsx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gui/src/renderer/components/Changelog.tsx b/gui/src/renderer/components/Changelog.tsx index 9bd55ba411..716daba75d 100644 --- a/gui/src/renderer/components/Changelog.tsx +++ b/gui/src/renderer/components/Changelog.tsx @@ -1,7 +1,9 @@ +import { useCallback } from 'react'; import styled from 'styled-components'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; +import { useBoolean } from '../lib/utilityHooks'; import { useSelector } from '../redux/store'; import * as AppButton from './AppButton'; import { hugeText, smallText } from './common-styles'; @@ -33,20 +35,29 @@ export function Changelog() { (state) => state.settings.guiSettings.changelogDisplayedForVersion, ); const changelog = useSelector((state) => state.userInterface.changelog); + const initialForceShowChanges = useSelector((state) => state.userInterface.forceShowChanges); const { setDisplayedChangelog } = useAppContext(); + const [forceShowChanges, , stopForceShowChanges] = useBoolean(initialForceShowChanges); + + const close = useCallback(() => { + setDisplayedChangelog(); + stopForceShowChanges(); + }, []); + const visible = - changelogDisplayedForVersion !== currentVersion && - changelog.length > 0 && - !window.env.development && - !/-dev-[0-9a-f]{6}$/.test(currentVersion); + forceShowChanges || + (changelogDisplayedForVersion !== currentVersion && + changelog.length > 0 && + !window.env.development && + !/-dev-[0-9a-f]{6}$/.test(currentVersion)); return ( <ModalAlert isOpen={visible} buttons={[ - <AppButton.BlueButton key="close" onClick={setDisplayedChangelog}> + <AppButton.BlueButton key="close" onClick={close}> { // TRANSLATORS: This is a button which closes a dialog. messages.gettext('Got it!') |
