1 import { type FC } from 'react';
2 import { useSelector } from 'react-redux';
4 import { c, msgid } from 'ttag';
6 import { Button } from '@proton/atoms';
7 import { useConnectivity } from '@proton/pass/components/Core/ConnectivityProvider';
8 import { usePassCore } from '@proton/pass/components/Core/PassCoreProvider';
9 import type { BaseSpotlightMessage } from '@proton/pass/components/Spotlight/SpotlightContent';
10 import { AliasSyncIcon } from '@proton/pass/components/Spotlight/SpotlightIcon';
11 import { selectUserData } from '@proton/pass/store/selectors';
12 import { pipe } from '@proton/pass/utils/fp/pipe';
13 import { PASS_APP_NAME, PASS_SHORT_APP_NAME } from '@proton/shared/lib/constants';
14 import noop from '@proton/utils/noop';
16 export const AliasSync: FC<BaseSpotlightMessage> = ({ onClose = noop }) => {
17 const online = useConnectivity();
18 const { openSettings } = usePassCore();
19 const { pendingAliasToSync: aliasCount } = useSelector(selectUserData);
23 <div className="flex-1">
24 <strong className="block">{c('Title').t`Sync your aliases from SimpleLogin`}</strong>
25 <span className="block text-sm">
27 msgid`You have ${aliasCount} alias that is present in SimpleLogin but missing in ${PASS_APP_NAME}. Would you like to sync it?`,
28 `You have ${aliasCount} aliases that are present in SimpleLogin but missing in ${PASS_APP_NAME}. Would you like to sync them?`,
31 <span className="block text-sm">
33 .t`Once synced, deleting aliases in ${PASS_SHORT_APP_NAME} will also delete them in SimpleLogin.`}
36 <div className="mt-2">
42 className="text-sm px-3"
43 onClick={pipe(onClose, () => openSettings?.('aliases'))}
46 {c('Action').ngettext(msgid`Sync alias`, `Sync aliases`, aliasCount)}
51 <div className="mr-2">