accounts-frontend/packages/app/components/profile/multiFactorAuth/instructions/OsInstruction.tsx

93 lines
3.2 KiB
TypeScript
Raw Normal View History

2017-07-22 21:27:38 +05:30
import React from 'react';
import { FormattedMessage as Message } from 'react-intl';
import messages from '../instructions.intl';
2017-07-22 21:27:38 +05:30
import styles from './instructions.scss';
type OS = 'android' | 'ios' | 'windows';
2017-07-22 21:27:38 +05:30
const linksByOs: {
2020-05-24 04:38:24 +05:30
[K in OS]: {
searchLink: string;
featured: Array<{ link: string; label: string }>;
};
} = {
2020-05-24 04:38:24 +05:30
android: {
searchLink: 'https://play.google.com/store/search?q=totp%20authenticator',
featured: [
{
link: 'https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2',
label: 'Google Authenticator',
},
{
link: 'https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp',
label: 'FreeOTP Authenticator',
},
{
link: 'https://play.google.com/store/apps/details?id=com.authenticator.authservice',
label: 'TOTP Authenticator',
},
],
},
ios: {
searchLink: 'https://linkmaker.itunes.apple.com/en-us?mediaType=ios_apps&term=authenticator',
featured: [
{
link: 'https://itunes.apple.com/ru/app/google-authenticator/id388497605',
label: 'Google Authenticator',
},
{
link: 'https://itunes.apple.com/us/app/otp-auth-two-factor-authentication-for-pros/id659877384',
label: 'OTP Auth',
},
{
link: 'https://itunes.apple.com/us/app/2stp-authenticator/id954311670',
label: '2STP Authenticator',
},
],
},
windows: {
searchLink: 'https://www.microsoft.com/be-by/store/search/apps?devicetype=mobile&q=authenticator',
featured: [
{
link: 'https://www.microsoft.com/en-us/store/p/microsoft-authenticator/9nblgggzmcj6',
label: 'Microsoft Authenticator',
},
{
link: 'https://www.microsoft.com/en-us/store/p/authenticator/9nblggh08h54',
label: 'Authenticator+',
},
{
link: 'https://www.microsoft.com/en-us/store/p/authenticator-for-windows/9nblggh4n8mx',
label: 'Authenticator for Windows',
},
],
},
2017-07-22 21:27:38 +05:30
};
export default function OsInstruction({ os }: { os: OS }) {
2020-05-24 04:38:24 +05:30
return (
<div className={styles.osInstruction} data-testid="os-instruction" data-os={os}>
<h3 className={styles.instructionTitle}>
<Message {...messages.installOnOfTheApps} />
</h3>
2017-07-22 21:27:38 +05:30
2020-05-24 04:38:24 +05:30
<ul className={styles.appList}>
{linksByOs[os].featured.map((item) => (
<li key={item.label}>
<a href={item.link} target="_blank">
{item.label}
</a>
</li>
))}
</ul>
2017-07-22 21:27:38 +05:30
2020-05-24 04:38:24 +05:30
<div className={styles.otherApps}>
<a href={linksByOs[os].searchLink} target="_blank">
<Message {...messages.findAlternativeApps} />
</a>
</div>
</div>
);
2017-07-22 21:27:38 +05:30
}