diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-02-27 10:06:45 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-02-27 10:06:45 +0100 |
| commit | f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1 (patch) | |
| tree | 1be5586f97d23d154a0d245a115af708761174e1 /gui/src | |
| parent | a0d5aa28ad71e340bfa002c83285235ec74cea68 (diff) | |
| parent | c7a47757e8208ff7b3b809621680aa79abc9f4f3 (diff) | |
| download | mullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.tar.xz mullvadvpn-f49760525dbd4bfb5e19a0231d1d8b7a41f76ce1.zip | |
Merge branch 'fix-e2e-tests-failing'
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/renderer/components/ExpiredAccountAddTime.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/components/KeyboardNavigation.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/lib/history.tsx | 3 | ||||
| -rw-r--r-- | gui/src/renderer/lib/routeHelpers.ts | 24 | ||||
| -rw-r--r-- | gui/src/renderer/lib/routes.ts | 23 |
5 files changed, 30 insertions, 26 deletions
diff --git a/gui/src/renderer/components/ExpiredAccountAddTime.tsx b/gui/src/renderer/components/ExpiredAccountAddTime.tsx index 57a3856dce..2c593217b8 100644 --- a/gui/src/renderer/components/ExpiredAccountAddTime.tsx +++ b/gui/src/renderer/components/ExpiredAccountAddTime.tsx @@ -10,7 +10,8 @@ import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import useActions from '../lib/actionsHook'; import { transitions, useHistory } from '../lib/history'; -import { generateRoutePath, RoutePath } from '../lib/routes'; +import { generateRoutePath } from '../lib/routeHelpers'; +import { RoutePath } from '../lib/routes'; import account from '../redux/account/actions'; import { useSelector } from '../redux/store'; import * as AppButton from './AppButton'; diff --git a/gui/src/renderer/components/KeyboardNavigation.tsx b/gui/src/renderer/components/KeyboardNavigation.tsx index b98f57b4ce..f88b4f31e9 100644 --- a/gui/src/renderer/components/KeyboardNavigation.tsx +++ b/gui/src/renderer/components/KeyboardNavigation.tsx @@ -2,7 +2,8 @@ import React, { useCallback, useContext, useEffect, useMemo, useState } from 're import { useLocation } from 'react-router'; import { useHistory } from '../lib/history'; -import { disableDismissForRoutes, RoutePath } from '../lib/routes'; +import { disableDismissForRoutes } from '../lib/routeHelpers'; +import { RoutePath } from '../lib/routes'; interface IKeyboardNavigationProps { children: React.ReactElement | Array<React.ReactElement>; diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx index 68cbbcf482..159e597cce 100644 --- a/gui/src/renderer/lib/history.tsx +++ b/gui/src/renderer/lib/history.tsx @@ -2,7 +2,8 @@ import { Action, History as OriginalHistory, Location, LocationDescriptorObject import { useHistory as useReactRouterHistory } from 'react-router'; import { IHistoryObject, LocationState } from '../../shared/ipc-types'; -import { GeneratedRoutePath, RoutePath } from './routes'; +import { GeneratedRoutePath } from './routeHelpers'; +import { RoutePath } from './routes'; export interface ITransitionSpecification { name: string; diff --git a/gui/src/renderer/lib/routeHelpers.ts b/gui/src/renderer/lib/routeHelpers.ts new file mode 100644 index 0000000000..50c5867768 --- /dev/null +++ b/gui/src/renderer/lib/routeHelpers.ts @@ -0,0 +1,24 @@ +import { generatePath } from 'react-router'; + +import { RoutePath } from './routes'; + +export type GeneratedRoutePath = { routePath: string }; + +export const disableDismissForRoutes = [ + RoutePath.launch, + RoutePath.login, + RoutePath.tooManyDevices, + RoutePath.deviceRevoked, + RoutePath.main, + RoutePath.redeemVoucher, + RoutePath.voucherSuccess, + RoutePath.timeAdded, + RoutePath.setupFinished, +]; + +export function generateRoutePath( + routePath: RoutePath, + parameters: Parameters<typeof generatePath>[1], +): GeneratedRoutePath { + return { routePath: generatePath(routePath, parameters) }; +} diff --git a/gui/src/renderer/lib/routes.ts b/gui/src/renderer/lib/routes.ts index eaefb26c67..a0248d940e 100644 --- a/gui/src/renderer/lib/routes.ts +++ b/gui/src/renderer/lib/routes.ts @@ -1,7 +1,3 @@ -import { generatePath } from 'react-router'; - -export type GeneratedRoutePath = { routePath: string }; - export enum RoutePath { launch = '/', login = '/login', @@ -26,22 +22,3 @@ export enum RoutePath { selectLocation = '/select-location', filter = '/select-location/filter', } - -export const disableDismissForRoutes = [ - RoutePath.launch, - RoutePath.login, - RoutePath.tooManyDevices, - RoutePath.deviceRevoked, - RoutePath.main, - RoutePath.redeemVoucher, - RoutePath.voucherSuccess, - RoutePath.timeAdded, - RoutePath.setupFinished, -]; - -export function generateRoutePath( - routePath: RoutePath, - parameters: Parameters<typeof generatePath>[1], -): GeneratedRoutePath { - return { routePath: generatePath(routePath, parameters) }; -} |
