summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-06-16 11:33:06 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-06-28 09:00:49 +0200
commitc006e28144eff8f328c820992b8e4dd82d0ae0cb (patch)
tree803c3a52580a52df99ea9ffb1f73e1e4e44d3d4f /gui/src/renderer/lib
parentbaf7ccb26f31164c463ced344c5bc398ececdf89 (diff)
downloadmullvadvpn-c006e28144eff8f328c820992b8e4dd82d0ae0cb.tar.xz
mullvadvpn-c006e28144eff8f328c820992b8e4dd82d0ae0cb.zip
Improve navigation and transitions for out of time view
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/transition-rule.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/gui/src/renderer/lib/transition-rule.ts b/gui/src/renderer/lib/transition-rule.ts
index ae0e2ad5b7..91d5cd6d4c 100644
--- a/gui/src/renderer/lib/transition-rule.ts
+++ b/gui/src/renderer/lib/transition-rule.ts
@@ -1,3 +1,5 @@
+import { Action } from 'history';
+
export interface ITransitionDescriptor {
name: string;
duration: number;
@@ -16,15 +18,19 @@ export interface ITransitionMatch {
export default class TransitionRule {
constructor(private from: string | null, private to: string, private fork: ITransitionFork) {}
- public match(fromRoute: string | null, toRoute: string): ITransitionMatch | null {
- if ((!this.from || this.from === fromRoute) && this.to === toRoute) {
+ public match(
+ fromRoute: string | null,
+ toRoute: string,
+ action?: Action,
+ ): ITransitionMatch | null {
+ if (action !== 'POP' && (!this.from || this.from === fromRoute) && this.to === toRoute) {
return {
direction: 'forward',
descriptor: this.fork.forward,
};
}
- if ((!this.from || this.from === toRoute) && this.to === fromRoute) {
+ if (action !== 'PUSH' && (!this.from || this.from === toRoute) && this.to === fromRoute) {
return {
direction: 'backward',
descriptor: this.fork.backward,