Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): remove the old switcher overlay, steps and rows

Hampus23bdd2ae7e66
diff --git a/fluxer_app/src/features/auth/components/accounts/AccountRow.tsx b/fluxer_app/src/features/auth/components/accounts/AccountRow.tsx
deleted file mode 100644
index 7d06a3b6d..000000000
--- a/fluxer_app/src/features/auth/components/accounts/AccountRow.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {useAccountAvatarURL} from '@app/features/auth/AccountAvatarUtils';
-import {
- AccountIdentityText,
- useAccountDisplayIdentityView,
-} from '@app/features/auth/components/accounts/AccountIdentity';
-import styles from '@app/features/auth/components/accounts/AccountRow.module.css';
-import type {Account} from '@app/features/platform/state/AuthSession';
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import {MockAvatar} from '@app/features/ui/components/MockAvatar';
-import {msg} from '@lingui/core/macro';
-import {Trans, useLingui} from '@lingui/react/macro';
-import {CaretRightIcon} from '@phosphor-icons/react';
-import clsx from 'clsx';
-import {observer} from 'mobx-react-lite';
-
-const EXPIRED_DESCRIPTOR = msg({
- message: 'Expired',
- comment: 'Short label in the authentication account row. Keep the tone plain and specific.',
-});
-
-interface AccountRowProps {
- account: Account;
- isCurrent?: boolean;
- isExpired?: boolean;
- onClick?: () => void;
- disabled?: boolean;
- showCaretIndicator?: boolean;
-}
-
-export const AccountRow = observer(
- ({
- account,
- isCurrent = false,
- isExpired = false,
- onClick,
- disabled = false,
- showCaretIndicator = false,
- }: AccountRowProps) => {
- const {i18n} = useLingui();
- const avatarUrl = useAccountAvatarURL(account);
- const identityView = useAccountDisplayIdentityView(account);
- const displayName = identityView.displayLabel;
- const isClickable = typeof onClick === 'function';
- const MainButtonComponent = isClickable ? 'button' : 'div';
- return (
- <div className={clsx(styles.row, styles.manage)} data-flx="auth.accounts.account-row.row">
- <MainButtonComponent
- type={isClickable ? 'button' : undefined}
- className={clsx(styles.mainButton, isClickable && !disabled && styles.clickable, disabled && styles.disabled)}
- onClick={isClickable && !disabled ? onClick : undefined}
- disabled={isClickable ? disabled : undefined}
- data-flx="auth.accounts.account-row.main-button.click"
- >
- <div className={styles.avatarWrap} data-flx="auth.accounts.account-row.avatar-wrap">
- <MockAvatar
- size={40}
- avatarUrl={avatarUrl}
- userTag={displayName}
- data-flx="auth.accounts.account-row.mock-avatar"
- />
- </div>
- <div className={styles.body} data-flx="auth.accounts.account-row.body">
- <div className={styles.titleRow} data-flx="auth.accounts.account-row.title-row">
- <span
- className={clsx('user-text', 'truncate', styles.primaryLine, isCurrent && styles.currentName)}
- data-flx="auth.accounts.account-row.user-text--2"
- >
- <AccountIdentityText
- identityView={identityView}
- discriminatorClassName={styles.discriminator}
- data-flx="auth.accounts.account-row.account-identity-text"
- />
- </span>
- </div>
- {isCurrent ? (
- <span className={styles.currentFlag} data-flx="auth.accounts.account-row.current-flag">
- <Trans>Active account</Trans>
- </span>
- ) : null}
- {isExpired && (
- <span className={styles.expired} data-flx="auth.accounts.account-row.expired">
- {i18n._(EXPIRED_DESCRIPTOR)}
- </span>
- )}
- </div>
- {showCaretIndicator ? (
- <div className={styles.caretIndicator} data-flx="auth.accounts.account-row.caret-indicator">
- <CaretRightIcon
- size={remFromPx(18)}
- weight="bold"
- data-flx="auth.accounts.account-row.caret-right-icon"
- />
- </div>
- ) : null}
- </MainButtonComponent>
- </div>
- );
- },
-);
diff --git a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherAuthBackButton.tsx b/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherAuthBackButton.tsx
deleted file mode 100644
index 94bfa53d6..000000000
--- a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherAuthBackButton.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {AuthFloatingBackButton} from '@app/features/auth/flow/AuthFloatingBackButton';
-import {GO_BACK_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import type React from 'react';
-
-const BACK_TO_ACCOUNTS_DESCRIPTOR = msg({
- message: 'Back to accounts',
- comment:
- 'Accessible label for the account switcher back button when it leaves the sign-in form for the account list.',
-});
-
-interface AccountSwitcherAuthBackButtonProps {
- readonly returnsToAccountList: boolean;
- readonly onBack: () => void;
-}
-
-export function AccountSwitcherAuthBackButton({
- returnsToAccountList,
- onBack,
-}: AccountSwitcherAuthBackButtonProps): React.ReactElement {
- const {i18n} = useLingui();
- let label = i18n._(GO_BACK_DESCRIPTOR);
- if (returnsToAccountList) {
- label = i18n._(BACK_TO_ACCOUNTS_DESCRIPTOR);
- }
- return (
- <AuthFloatingBackButton
- ariaLabel={label}
- onBack={onBack}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-auth-back-button.auth-floating-back-button"
- />
- );
-}
diff --git a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherModalTypes.ts b/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherModalTypes.ts
deleted file mode 100644
index bb1eaaa8b..000000000
--- a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherModalTypes.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import type {AccountSwitcherAuthPurpose} from '@app/features/auth/components/accounts/account_switcher_modal/AccountSwitcherAuthTypes';
-import type {Account} from '@app/features/platform/state/AuthSession';
-
-export const AccountSwitcherView = Object.freeze({
- ACCOUNTS: 'accounts',
- AUTH: 'auth',
- CONFIRM: 'confirm',
-} as const);
-
-export type AccountSwitcherView = (typeof AccountSwitcherView)[keyof typeof AccountSwitcherView];
-
-export type AccountSwitcherContentView = Exclude<AccountSwitcherView, typeof AccountSwitcherView.CONFIRM>;
-
-export const AccountSwitcherActionType = Object.freeze({
- CURRENT: 'current',
- SAVED: 'saved',
-} as const);
-
-export type AccountSwitcherActionType = (typeof AccountSwitcherActionType)[keyof typeof AccountSwitcherActionType];
-
-export interface ConfirmAction {
- readonly type: AccountSwitcherActionType;
- readonly account: Account;
-}
-
-export type AccountSwitcherViewState =
- | {readonly view: typeof AccountSwitcherView.ACCOUNTS}
- | {readonly view: typeof AccountSwitcherView.AUTH; readonly purpose: AccountSwitcherAuthPurpose}
- | {readonly view: typeof AccountSwitcherView.CONFIRM; readonly action: ConfirmAction};
diff --git a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherOverlay.tsx b/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherOverlay.tsx
deleted file mode 100644
index 220a0c110..000000000
--- a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherOverlay.tsx
+++ /dev/null
@@ -1,283 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import Accessibility from '@app/features/accessibility/state/Accessibility';
-import {AccountProfilePicker} from '@app/features/auth/components/accounts/account_switcher_modal/AccountProfilePicker';
-import {
- type AccountSwitcherContentView,
- AccountSwitcherView,
-} from '@app/features/auth/components/accounts/account_switcher_modal/AccountSwitcherModalTypes';
-import styles from '@app/features/auth/components/accounts/account_switcher_modal/AccountSwitcherOverlay.module.css';
-import {AccountSwitcherViewTransition} from '@app/features/auth/components/accounts/account_switcher_modal/AccountSwitcherViewTransition';
-import Keybind, {type KeybindCommand} from '@app/features/input/state/InputKeybind';
-import type {Account} from '@app/features/platform/state/AuthSession';
-import FocusRingScope from '@app/features/ui/focus_ring/FocusRingScope';
-import {usePrefersReducedMotion} from '@app/features/ui/hooks/usePrefersReducedMotion';
-import {KeybindHint} from '@app/features/ui/keybind_hint/KeybindHint';
-import {AnimeButton, type AnimeTarget, createAnimeFlxElement} from '@app/features/ui/motion/AnimeElement';
-import LayerManager, {LayerType} from '@app/features/ui/state/LayerManager';
-import {getZIndexForStack} from '@app/features/ui/state/Modal';
-import {ModalStackContext} from '@app/features/ui/utils/ModalStackContext';
-import {isDesktop} from '@app/features/ui/utils/NativeUtils';
-import {flxElementClassName} from '@app/lib/react';
-import {msg} from '@lingui/core/macro';
-import {Trans, useLingui} from '@lingui/react/macro';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useContext, useEffect, useId, useRef} from 'react';
-
-const AccountSwitcherAnimatedRoot = createAnimeFlxElement('flx-auth-account-switcher-overlay');
-const AccountSwitcherAnimatedShell = createAnimeFlxElement('flx-auth-account-switcher-overlay-shell');
-
-const SYSTEM_OPEN_ACCOUNT_SWITCHER_ACTION: KeybindCommand = 'system_open_account_switcher';
-
-const CLOSE_ACCOUNT_SWITCHER_DESCRIPTOR = msg({
- message: 'Close account switcher',
- comment: 'Accessible label for closing the account switcher overlay.',
-});
-const BACK_TO_ACCOUNT_SWITCHER_DESCRIPTOR = msg({
- message: 'Back to account switcher',
- comment: 'Accessible label for returning from the account switcher authentication form to the account list.',
-});
-
-function isAccountShortcutKey(key: string): boolean {
- return key.length === 1 && key >= '1' && key <= '9';
-}
-
-interface AccountSwitcherStageProps {
- readonly accounts: Array<Account>;
- readonly authContent: React.ReactNode;
- readonly currentAccountKey: string | null;
- readonly onAccountClick: (account: Account) => void;
- readonly onAccountRemove: (account: Account) => void;
- readonly onAddAccount: () => void;
- readonly pickerDisabled: boolean;
- readonly view: AccountSwitcherContentView;
-}
-
-const AccountSwitcherShortcutHint = observer(function AccountSwitcherShortcutHint(): React.ReactElement | null {
- const {combo} = Keybind.getByAction(SYSTEM_OPEN_ACCOUNT_SWITCHER_ACTION);
- if (Accessibility.hideKeyboardHints || (!combo.key && !combo.code)) {
- return null;
- }
- return (
- <div
- className={styles.shortcutTitle}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-shortcut-hint.shortcut-title"
- >
- <KeybindHint
- combo={combo}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-shortcut-hint.keybind-hint"
- />
- </div>
- );
-});
-
-function AccountSwitcherStage({
- accounts,
- authContent,
- currentAccountKey,
- onAccountClick,
- onAccountRemove,
- onAddAccount,
- pickerDisabled,
- view,
-}: AccountSwitcherStageProps): React.ReactElement {
- if (view === AccountSwitcherView.AUTH) {
- return (
- <flx-auth-account-switcher-overlay-auth-stage
- className={flxElementClassName(styles.authStage)}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage.auth-stage"
- >
- {authContent}
- </flx-auth-account-switcher-overlay-auth-stage>
- );
- }
- return (
- <flx-auth-account-switcher-overlay-accounts-stage
- className={flxElementClassName(styles.accountsStage)}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage.accounts-stage"
- >
- <AccountSwitcherShortcutHint data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage.account-switcher-shortcut-hint" />
- {accounts.length === 0 ? (
- <flx-auth-account-switcher-overlay-empty
- className={flxElementClassName(styles.noAccounts)}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage.no-accounts"
- >
- <Trans>No accounts</Trans>
- </flx-auth-account-switcher-overlay-empty>
- ) : null}
- <AccountProfilePicker
- accounts={accounts}
- currentAccountKey={currentAccountKey}
- disabled={pickerDisabled}
- showInstance={isDesktop()}
- primaryActionDisabled={false}
- onPrimaryAction={onAccountClick}
- secondaryActionDisabled={pickerDisabled}
- onSecondaryAction={onAccountRemove}
- onAddAccount={onAddAccount}
- className={styles.accountPicker}
- scrollerClassName={styles.accountScroller}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage.account-picker"
- />
- </flx-auth-account-switcher-overlay-accounts-stage>
- );
-}
-
-interface AccountSwitcherOverlayProps {
- readonly ariaLabel: string;
- readonly view: AccountSwitcherContentView;
- readonly accounts: Array<Account>;
- readonly currentAccountKey: string | null;
- readonly isBusy: boolean;
- readonly authContent: React.ReactNode;
- readonly onAccountClick: (account: Account) => void;
- readonly onAccountRemove: (account: Account) => void;
- readonly onAddAccount: () => void;
- readonly onBackdropClick: () => void;
-}
-
-export function AccountSwitcherOverlay({
- ariaLabel,
- view,
- accounts,
- currentAccountKey,
- isBusy,
- authContent,
- onAccountClick,
- onAccountRemove,
- onAddAccount,
- onBackdropClick,
-}: AccountSwitcherOverlayProps): React.ReactElement {
- const {i18n} = useLingui();
- const prefersReducedMotion = usePrefersReducedMotion();
- const shellRef = useRef<HTMLElement | null>(null);
- const layerKey = useId();
- const {stackIndex, isVisible, isTopmost} = useContext(ModalStackContext);
- const closeLabel = i18n._(CLOSE_ACCOUNT_SWITCHER_DESCRIPTOR);
- let backdropLabel = closeLabel;
- if (view === AccountSwitcherView.AUTH) {
- backdropLabel = i18n._(BACK_TO_ACCOUNT_SWITCHER_DESCRIPTOR);
- }
- const handleShellKeyDown = useCallback(
- (event: React.KeyboardEvent<HTMLElement>) => {
- if (view !== AccountSwitcherView.ACCOUNTS || isBusy) {
- return;
- }
- if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
- return;
- }
- if (!isAccountShortcutKey(event.key)) {
- return;
- }
- const account = accounts[Number(event.key) - 1];
- if (account == null) {
- return;
- }
- event.preventDefault();
- event.stopPropagation();
- onAccountClick(account);
- },
- [accounts, isBusy, onAccountClick, view],
- );
-
- useEffect(() => {
- LayerManager.addLayer(LayerType.MODAL, layerKey, onBackdropClick);
- return () => LayerManager.removeLayer(LayerType.MODAL, layerKey);
- }, [layerKey, onBackdropClick]);
-
- useEffect(() => {
- if (!isTopmost) {
- return;
- }
- shellRef.current?.focus({preventScroll: true});
- }, [isTopmost, view]);
-
- let pointerEvents: React.CSSProperties['pointerEvents'] = 'none';
- let visibility: React.CSSProperties['visibility'] = 'hidden';
- let opacity = 0;
- if (isVisible) {
- pointerEvents = 'auto';
- visibility = 'visible';
- opacity = 1;
- }
- let rootTweenDuration = 0;
- let backdropTweenDuration = 0;
- let shellTweenDuration = 0;
- let fadeFrom: AnimeTarget | false = false;
- let fadeLeave: AnimeTarget | false = false;
- let shellFrom: AnimeTarget | false = false;
- let shellLeave: AnimeTarget | false = false;
- if (!prefersReducedMotion) {
- rootTweenDuration = 0.16;
- backdropTweenDuration = 0.18;
- shellTweenDuration = 0.24;
- fadeFrom = {opacity: 0};
- fadeLeave = {opacity: 0};
- shellFrom = {opacity: 0, translateY: 16, scale: 0.985};
- shellLeave = {opacity: 0, translateY: 8, scale: 0.99};
- }
-
- return (
- <AccountSwitcherAnimatedRoot
- className={styles.root}
- style={{pointerEvents, visibility, zIndex: getZIndexForStack(stackIndex)}}
- from={fadeFrom}
- to={{opacity}}
- leave={fadeLeave}
- tween={{duration: rootTweenDuration, ease: 'out(3)'}}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.root"
- >
- <AnimeButton
- type="button"
- className={styles.backdrop}
- aria-label={backdropLabel}
- tabIndex={-1}
- onClick={onBackdropClick}
- from={fadeFrom}
- to={{opacity: 1}}
- leave={fadeLeave}
- tween={{duration: backdropTweenDuration, ease: 'out(3)'}}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.backdrop.button"
- />
- <AccountSwitcherAnimatedShell
- ref={shellRef}
- className={styles.shell}
- role="dialog"
- aria-modal="true"
- aria-label={ariaLabel}
- aria-busy={isBusy}
- tabIndex={-1}
- onKeyDown={handleShellKeyDown}
- from={shellFrom}
- to={{opacity: 1, translateY: 0, scale: 1}}
- leave={shellLeave}
- tween={{duration: shellTweenDuration, ease: 'out(4)'}}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.shell"
- >
- <FocusRingScope
- containerRef={shellRef}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.focus-ring-scope"
- >
- <AccountSwitcherViewTransition
- transitionKey={view}
- className={styles.viewHost}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.view-host"
- >
- <AccountSwitcherStage
- accounts={accounts}
- authContent={authContent}
- currentAccountKey={currentAccountKey}
- onAccountClick={onAccountClick}
- onAccountRemove={onAccountRemove}
- onAddAccount={onAddAccount}
- pickerDisabled={isBusy}
- view={view}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-overlay.account-switcher-stage"
- />
- </AccountSwitcherViewTransition>
- </FocusRingScope>
- </AccountSwitcherAnimatedShell>
- </AccountSwitcherAnimatedRoot>
- );
-}
diff --git a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherViewTransition.tsx b/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherViewTransition.tsx
deleted file mode 100644
index 36a0f9c60..000000000
--- a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/AccountSwitcherViewTransition.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {usePrefersReducedMotion} from '@app/features/ui/hooks/usePrefersReducedMotion';
-import {AnimePresence, createAnimeFlxElement} from '@app/features/ui/motion/AnimeElement';
-import {flxElementClassName} from '@app/lib/react';
-import type React from 'react';
-import {useEffect, useRef, useState} from 'react';
-
-const AccountSwitcherAnimatedView = createAnimeFlxElement('flx-auth-account-switcher-overlay-view');
-
-const VIEW_TRANSITION_DURATION_SECONDS = 0.18;
-const VIEW_TRANSITION_OFFSET_PX = 12;
-const VIEW_TRANSITION_DURATION_MS = VIEW_TRANSITION_DURATION_SECONDS * 1000;
-
-interface AccountSwitcherViewTransitionProps {
- readonly transitionKey: string;
- readonly className: string;
- readonly children: React.ReactNode;
-}
-
-interface DisplayedView {
- readonly key: string;
- readonly children: React.ReactNode;
-}
-
-function useSequencedView(transitionKey: string, children: React.ReactNode): DisplayedView | null {
- const [displayed, setDisplayed] = useState<DisplayedView>({key: transitionKey, children});
- const [isExiting, setIsExiting] = useState(false);
- const pendingRef = useRef<DisplayedView>({key: transitionKey, children});
- pendingRef.current = {key: transitionKey, children};
-
- useEffect(() => {
- if (transitionKey === displayed.key) {
- setDisplayed({key: transitionKey, children});
- setIsExiting(false);
- return;
- }
- setIsExiting(true);
- const timer = setTimeout(() => {
- setDisplayed(pendingRef.current);
- setIsExiting(false);
- }, VIEW_TRANSITION_DURATION_MS);
- return () => clearTimeout(timer);
- }, [transitionKey, children, displayed.key]);
-
- return isExiting ? null : displayed;
-}
-
-function renderAnimatedView(displayed: DisplayedView | null): React.ReactElement {
- return (
- <AnimePresence
- enterOnMount={false}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-view-transition.anime-presence"
- >
- {displayed == null ? null : (
- <AccountSwitcherAnimatedView
- key={displayed.key}
- from={{opacity: 0, translateY: VIEW_TRANSITION_OFFSET_PX}}
- to={{opacity: 1, translateY: 0}}
- leave={{opacity: 0, translateY: -VIEW_TRANSITION_OFFSET_PX}}
- tween={{duration: VIEW_TRANSITION_DURATION_SECONDS, ease: 'out(3)'}}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-view-transition.animated-view"
- >
- {displayed.children}
- </AccountSwitcherAnimatedView>
- )}
- </AnimePresence>
- );
-}
-
-function renderStaticView(children: React.ReactNode): React.ReactElement {
- return (
- <flx-auth-account-switcher-overlay-view
- className={flxElementClassName()}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-view-transition.static-view"
- >
- {children}
- </flx-auth-account-switcher-overlay-view>
- );
-}
-
-export function AccountSwitcherViewTransition({
- transitionKey,
- className,
- children,
-}: AccountSwitcherViewTransitionProps): React.ReactElement {
- const prefersReducedMotion = usePrefersReducedMotion();
- const displayed = useSequencedView(transitionKey, children);
- return (
- <flx-auth-account-switcher-overlay-view-host
- className={flxElementClassName(className)}
- data-flx="auth.accounts.account-switcher-modal.account-switcher-view-transition.view-host"
- >
- {prefersReducedMotion ? renderStaticView(children) : renderAnimatedView(displayed)}
- </flx-auth-account-switcher-overlay-view-host>
- );
-}
diff --git a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/ConfirmAccountActionStep.tsx b/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/ConfirmAccountActionStep.tsx
deleted file mode 100644
index 48f876d3e..000000000
--- a/fluxer_app/src/features/auth/components/accounts/account_switcher_modal/ConfirmAccountActionStep.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {AccountRow} from '@app/features/auth/components/accounts/AccountRow';
-import styles from '@app/features/auth/components/accounts/AccountSwitcherModal.module.css';
-import {
- AccountSwitcherActionType,
- type ConfirmAction,
-} from '@app/features/auth/components/accounts/account_switcher_modal/AccountSwitcherModalTypes';
-import {flxElementClassName} from '@app/lib/react';
-import {Trans} from '@lingui/react/macro';
-import type React from 'react';
-
-interface ConfirmAccountActionStepProps {
- readonly action: ConfirmAction;
- readonly hasMultipleAccounts: boolean;
-}
-
-function renderConfirmDescription(action: ConfirmAction, hasMultipleAccounts: boolean): React.ReactNode {
- if (action.type !== AccountSwitcherActionType.CURRENT) {
- return <Trans>Signing out will remove this account from the device.</Trans>;
- }
- if (hasMultipleAccounts) {
- return <Trans>Signing out will bring you to the sign-in screen so you can pick another account.</Trans>;
- }
- return <Trans>Signing out will bring you to the sign-in screen.</Trans>;
-}
-
-export function ConfirmAccountActionStep({
- action,
- hasMultipleAccounts,
-}: ConfirmAccountActionStepProps): React.ReactElement {
- return (
- <flx-auth-confirm-account-action-step
- className={flxElementClassName(styles.confirmPanel)}
- data-flx="auth.accounts.account-switcher-modal.confirm-account-action-step.panel"
- >
- <AccountRow
- account={action.account}
- isCurrent={action.type === AccountSwitcherActionType.CURRENT}
- isExpired={action.account.isValid === false}
- data-flx="auth.accounts.account-switcher-modal.confirm-account-action-step.account-row"
- />
- <p
- className={styles.confirmText}
- data-flx="auth.accounts.account-switcher-modal.confirm-account-action-step.confirm-text"
- >
- {renderConfirmDescription(action, hasMultipleAccounts)}
- </p>
- </flx-auth-confirm-account-action-step>
- );
-}