mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
move function expressions to exported functions
This commit is contained in:
@@ -85,6 +85,35 @@ const outSlideUp = [
|
|||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export function tabsToCiphers(fromState: string, toState: string) {
|
||||||
|
if (fromState == null || toState === null || toState.indexOf('ciphers_') === -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (fromState.indexOf('ciphers_') === 0 && fromState.indexOf('ciphers_direction=b') === -1) ||
|
||||||
|
fromState === 'tabs';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ciphersToTabs(fromState: string, toState: string) {
|
||||||
|
if (fromState == null || toState === null || fromState.indexOf('ciphers_') === -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return toState.indexOf('ciphers_direction=b') === 0 || toState === 'tabs';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ciphersToView(fromState: string, toState: string) {
|
||||||
|
if (fromState == null || toState === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return fromState.indexOf('ciphers_') === 0 && (toState === 'view-cipher' || toState === 'add-cipher');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function viewToCiphers(fromState: string, toState: string) {
|
||||||
|
if (fromState == null || toState === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (fromState === 'view-cipher' || fromState === 'add-cipher') && toState.indexOf('ciphers_') === 0;
|
||||||
|
}
|
||||||
|
|
||||||
export const routerTransition = trigger('routerTransition', [
|
export const routerTransition = trigger('routerTransition', [
|
||||||
transition('void => home', inSlideLeft),
|
transition('void => home', inSlideLeft),
|
||||||
transition('void => tabs', inSlideLeft),
|
transition('void => tabs', inSlideLeft),
|
||||||
@@ -102,32 +131,11 @@ export const routerTransition = trigger('routerTransition', [
|
|||||||
transition('2fa-options => 2fa', outSlideDown),
|
transition('2fa-options => 2fa', outSlideDown),
|
||||||
transition('2fa => tabs', inSlideLeft),
|
transition('2fa => tabs', inSlideLeft),
|
||||||
|
|
||||||
transition((fromState, toState) => {
|
transition(tabsToCiphers, inSlideLeft),
|
||||||
if (fromState == null || toState === null || toState.indexOf('ciphers_') === -1) {
|
transition(ciphersToTabs, outSlideRight),
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (fromState.indexOf('ciphers_') === 0 && fromState.indexOf('ciphers_direction=b') === -1) ||
|
|
||||||
fromState === 'tabs';
|
|
||||||
}, inSlideLeft),
|
|
||||||
transition((fromState, toState) => {
|
|
||||||
if (fromState == null || toState === null || fromState.indexOf('ciphers_') === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return toState.indexOf('ciphers_direction=b') === 0 || toState === 'tabs';
|
|
||||||
}, outSlideRight),
|
|
||||||
|
|
||||||
transition((fromState, toState) => {
|
transition(ciphersToView, inSlideUp),
|
||||||
if (fromState == null || toState === null) {
|
transition(viewToCiphers, outSlideDown),
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fromState.indexOf('ciphers_') === 0 && (toState === 'view-cipher' || toState === 'add-cipher');
|
|
||||||
}, inSlideUp),
|
|
||||||
transition((fromState, toState) => {
|
|
||||||
if (fromState == null || toState === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (fromState === 'view-cipher' || fromState === 'add-cipher') && toState.indexOf('ciphers_') === 0;
|
|
||||||
}, outSlideDown),
|
|
||||||
|
|
||||||
transition('tabs => view-cipher', inSlideUp),
|
transition('tabs => view-cipher', inSlideUp),
|
||||||
transition('view-cipher => tabs', outSlideDown),
|
transition('view-cipher => tabs', outSlideDown),
|
||||||
|
|||||||
Reference in New Issue
Block a user