2019-12-07 16:58:52 +05:30
|
|
|
import React from 'react';
|
2017-07-22 21:27:38 +05:30
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2019-12-08 01:13:08 +05:30
|
|
|
import clsx from 'clsx';
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-12-08 00:32:00 +05:30
|
|
|
import profileForm from '../../profileForm.scss';
|
2019-12-07 16:58:52 +05:30
|
|
|
import messages from '../MultiFactorAuth.intl.json';
|
2017-07-22 21:27:38 +05:30
|
|
|
import OsInstruction from './OsInstruction';
|
|
|
|
import OsTile from './OsTile';
|
|
|
|
import styles from './instructions.scss';
|
|
|
|
import androidLogo from './images/android.svg';
|
|
|
|
import appleLogo from './images/apple.svg';
|
|
|
|
import windowsLogo from './images/windows.svg';
|
|
|
|
|
2019-12-07 16:58:52 +05:30
|
|
|
interface State {
|
|
|
|
activeOs: null | 'android' | 'ios' | 'windows';
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class Instructions extends React.Component<{}, State> {
|
|
|
|
state: State = {
|
2019-11-27 14:33:32 +05:30
|
|
|
activeOs: null,
|
|
|
|
};
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
render() {
|
|
|
|
const { activeOs } = this.state;
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
return (
|
|
|
|
<div className={profileForm.formBody}>
|
|
|
|
<div className={profileForm.formRow}>
|
|
|
|
<p className={profileForm.description}>
|
|
|
|
<Message {...messages.mfaIntroduction} />
|
|
|
|
</p>
|
|
|
|
</div>
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
<div className={profileForm.formRow}>
|
|
|
|
<div
|
2019-12-08 01:13:08 +05:30
|
|
|
className={clsx(styles.instructionContainer, {
|
2019-11-27 14:33:32 +05:30
|
|
|
[styles.instructionActive]: !!activeOs,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<div
|
2019-12-08 01:13:08 +05:30
|
|
|
className={clsx(styles.osList, {
|
2019-11-27 14:33:32 +05:30
|
|
|
[styles.androidActive]: activeOs === 'android',
|
|
|
|
[styles.appleActive]: activeOs === 'ios',
|
|
|
|
[styles.windowsActive]: activeOs === 'windows',
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<OsTile
|
|
|
|
className={styles.androidTile}
|
|
|
|
logo={androidLogo}
|
|
|
|
label="Google Play"
|
|
|
|
onClick={event => this.onChangeOs(event, 'android')}
|
|
|
|
/>
|
|
|
|
<OsTile
|
|
|
|
className={styles.appleTile}
|
|
|
|
logo={appleLogo}
|
|
|
|
label="App Store"
|
|
|
|
onClick={event => this.onChangeOs(event, 'ios')}
|
|
|
|
/>
|
|
|
|
<OsTile
|
|
|
|
className={styles.windowsTile}
|
|
|
|
logo={windowsLogo}
|
|
|
|
label="Windows Store"
|
|
|
|
onClick={event => this.onChangeOs(event, 'windows')}
|
|
|
|
/>
|
|
|
|
</div>
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
<div className={styles.osInstructionContainer}>
|
|
|
|
{activeOs ? <OsInstruction os={activeOs} /> : null}
|
2017-07-22 21:27:38 +05:30
|
|
|
</div>
|
2019-11-27 14:33:32 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-12-07 16:58:52 +05:30
|
|
|
onChangeOs(event: React.MouseEvent, osName: 'android' | 'ios' | 'windows') {
|
2019-11-27 14:33:32 +05:30
|
|
|
event.preventDefault();
|
2017-07-22 21:27:38 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
this.setState({
|
|
|
|
activeOs: this.state.activeOs === osName ? null : osName,
|
|
|
|
});
|
|
|
|
}
|
2017-07-22 21:27:38 +05:30
|
|
|
}
|