diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-06-29 14:51:21 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-01 11:37:48 +0200 |
| commit | 7b8697683a00a2a1dff9ad68e1b4d500f1d02a80 (patch) | |
| tree | 05a0389c876185b6caa5c062e4f4f30a47a2c72e /gui | |
| parent | d39d40b4edab918eb4be46e6154c4864f70aee5d (diff) | |
| download | mullvadvpn-7b8697683a00a2a1dff9ad68e1b4d500f1d02a80.tar.xz mullvadvpn-7b8697683a00a2a1dff9ad68e1b4d500f1d02a80.zip | |
Update app.tsx to changes in history and add transitions between base views
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/src/renderer/app.tsx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 9e1555e4ec..36e49c7c77 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -23,7 +23,7 @@ import log, { ConsoleOutput } from '../shared/logging'; import { IRelayListPair, LaunchApplicationResult } from '../shared/ipc-schema'; import consumePromise from '../shared/promise'; import { Scheduler } from '../shared/scheduler'; -import History from './lib/history'; +import History, { transitions } from './lib/history'; import { loadTranslations } from './lib/load-translations'; import { @@ -621,14 +621,27 @@ export default class AppRenderer { } private resetNavigation() { + const pathname = this.history.location.pathname; + if (this.connectedToDaemon) { if (this.settings.accountToken) { - this.history.resetWithIfDifferent('/main'); + const transition = + pathname === '/login' || pathname === '/' ? transitions.push : transitions.dismiss; + this.history.reset('/main', transition); } else { - this.history.resetWithIfDifferent('/login'); + const transition = + pathname === '/main' + ? transitions.pop + : pathname === '/' + ? transitions.push + : transitions.none; + + this.history.reset('/login', transition); } } else { - this.history.resetWithIfDifferent('/'); + const transition = + pathname === '/login' || pathname === '/main' ? transitions.pop : transitions.dismiss; + this.history.reset('/', transition); } } |
