summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/renderer')
-rw-r--r--gui/src/renderer/app.tsx5
-rw-r--r--gui/src/renderer/components/Changelog.tsx21
-rw-r--r--gui/src/renderer/redux/userinterface/actions.ts14
-rw-r--r--gui/src/renderer/redux/userinterface/reducers.ts8
4 files changed, 41 insertions, 7 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 84d8c631eb..78c0b58f6d 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -229,7 +229,7 @@ export default class AppRenderer {
this.setUpgradeVersion(initialState.upgradeVersion);
this.setGuiSettings(initialState.guiSettings);
this.storeAutoStart(initialState.autoStart);
- this.setChangelog(initialState.changelog);
+ this.setChangelog(initialState.changelog, initialState.forceShowChanges);
if (initialState.macOsScrollbarVisibility !== undefined) {
this.reduxActions.userInterface.setMacOsScrollbarVisibility(
@@ -950,8 +950,9 @@ export default class AppRenderer {
this.reduxActions.settings.updateAutoStart(autoStart);
}
- private setChangelog(changelog: IChangelog) {
+ private setChangelog(changelog: IChangelog, forceShowChanges: boolean) {
this.reduxActions.userInterface.setChangelog(changelog);
+ this.reduxActions.userInterface.setForceShowChanges(forceShowChanges);
}
private async updateLocation() {
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!')
diff --git a/gui/src/renderer/redux/userinterface/actions.ts b/gui/src/renderer/redux/userinterface/actions.ts
index cc8929934d..19ae7380bc 100644
--- a/gui/src/renderer/redux/userinterface/actions.ts
+++ b/gui/src/renderer/redux/userinterface/actions.ts
@@ -51,6 +51,11 @@ export interface ISetChangelog {
changelog: IChangelog;
}
+export interface ISetForceShowChanges {
+ type: 'SET_FORCE_SHOW_CHANGES';
+ forceShowChanges: boolean;
+}
+
export interface ISetIsPerformingPostUpgrade {
type: 'SET_IS_PERFORMING_POST_UPGRADE';
isPerformingPostUpgrade: boolean;
@@ -67,6 +72,7 @@ export type UserInterfaceAction =
| ISetMacOsScrollbarVisibility
| ISetConnectedToDaemon
| ISetChangelog
+ | ISetForceShowChanges
| ISetIsPerformingPostUpgrade;
function updateLocale(locale: string): IUpdateLocaleAction {
@@ -141,6 +147,13 @@ function setChangelog(changelog: IChangelog): ISetChangelog {
};
}
+function setForceShowChanges(forceShowChanges: boolean): ISetForceShowChanges {
+ return {
+ type: 'SET_FORCE_SHOW_CHANGES',
+ forceShowChanges,
+ };
+}
+
function setIsPerformingPostUpgrade(isPerformingPostUpgrade: boolean): ISetIsPerformingPostUpgrade {
return {
type: 'SET_IS_PERFORMING_POST_UPGRADE',
@@ -159,5 +172,6 @@ export default {
setMacOsScrollbarVisibility,
setConnectedToDaemon,
setChangelog,
+ setForceShowChanges,
setIsPerformingPostUpgrade,
};
diff --git a/gui/src/renderer/redux/userinterface/reducers.ts b/gui/src/renderer/redux/userinterface/reducers.ts
index 1850d553ab..2ab684b377 100644
--- a/gui/src/renderer/redux/userinterface/reducers.ts
+++ b/gui/src/renderer/redux/userinterface/reducers.ts
@@ -11,6 +11,7 @@ export interface IUserInterfaceReduxState {
macOsScrollbarVisibility?: MacOsScrollbarVisibility;
connectedToDaemon: boolean;
changelog: IChangelog;
+ forceShowChanges: boolean;
isPerformingPostUpgrade: boolean;
}
@@ -22,6 +23,7 @@ const initialState: IUserInterfaceReduxState = {
macOsScrollbarVisibility: undefined,
connectedToDaemon: false,
changelog: [],
+ forceShowChanges: false,
isPerformingPostUpgrade: false,
};
@@ -69,6 +71,12 @@ export default function (
changelog: action.changelog,
};
+ case 'SET_FORCE_SHOW_CHANGES':
+ return {
+ ...state,
+ forceShowChanges: action.forceShowChanges,
+ };
+
case 'SET_IS_PERFORMING_POST_UPGRADE':
return {
...state,