2016-11-06 01:53:56 +05:30
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
|
|
|
|
|
|
|
import BaseAuthBody from 'components/auth/BaseAuthBody';
|
|
|
|
import { AccountSwitcher } from 'components/accounts';
|
|
|
|
|
|
|
|
import styles from './chooseAccount.scss';
|
|
|
|
import messages from './ChooseAccount.intl.json';
|
|
|
|
|
|
|
|
export default class ChooseAccountBody extends BaseAuthBody {
|
|
|
|
static displayName = 'ChooseAccountBody';
|
|
|
|
static panelId = 'chooseAccount';
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {client} = this.context.auth;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{this.renderErrors()}
|
|
|
|
|
2018-03-14 17:43:16 +05:30
|
|
|
<div className={styles.description}>
|
|
|
|
{client ? (
|
|
|
|
<Message {...messages.pleaseChooseAccountForApp} values={{
|
|
|
|
appName: <span className={styles.appName}>{client.name}</span>,
|
2018-02-18 01:29:35 +05:30
|
|
|
}} />
|
2018-03-14 17:43:16 +05:30
|
|
|
) : (
|
|
|
|
<div className={styles.description}>
|
|
|
|
<Message {...messages.pleaseChooseAccount} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2016-11-06 01:53:56 +05:30
|
|
|
|
|
|
|
<div className={styles.accountSwitcherContainer}>
|
2016-11-13 20:17:56 +05:30
|
|
|
<AccountSwitcher
|
|
|
|
allowAdd={false}
|
|
|
|
allowLogout={false}
|
|
|
|
highlightActiveAccount={false}
|
|
|
|
onSwitch={this.onSwitch}
|
|
|
|
/>
|
2016-11-06 01:53:56 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-11-13 20:17:56 +05:30
|
|
|
|
|
|
|
onSwitch = (account) => {
|
|
|
|
this.context.resolve(account);
|
|
|
|
};
|
2016-11-06 01:53:56 +05:30
|
|
|
}
|