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';
|
2020-01-18 02:07:52 +05:30
|
|
|
import { Account } from 'app/components/accounts/reducer';
|
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 {
|
2020-05-24 04:38:24 +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} />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.accountSwitcherContainer}>
|
|
|
|
<AccountSwitcher
|
|
|
|
allowAdd={false}
|
|
|
|
allowLogout={false}
|
|
|
|
highlightActiveAccount={false}
|
|
|
|
onSwitch={this.onSwitch}
|
|
|
|
/>
|
|
|
|
</div>
|
2016-11-06 01:53:56 +05:30
|
|
|
</div>
|
2020-05-24 04:38:24 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
onSwitch = (account: Account): void => {
|
|
|
|
this.context.resolve(account);
|
|
|
|
};
|
2016-11-06 01:53:56 +05:30
|
|
|
}
|