accounts-frontend/src/components/auth/chooseAccount/ChooseAccountBody.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

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()}
<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>
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
}