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