2016-02-13 20:58:47 +05:30
|
|
|
import React, { PropTypes } from 'react';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2016-01-16 18:05:12 +05:30
|
|
|
import Helmet from 'react-helmet';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
|
|
|
import icons from 'components/ui/icons.scss';
|
2016-02-13 20:58:47 +05:30
|
|
|
import { PanelBodyHeader } from 'components/ui/Panel';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
import BaseAuthBody from './BaseAuthBody';
|
2016-01-19 11:47:21 +05:30
|
|
|
import styles from './permissions.scss';
|
|
|
|
import messages from './Permissions.messages';
|
2016-01-16 17:36:22 +05:30
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
class Body extends BaseAuthBody {
|
|
|
|
static propTypes = {
|
|
|
|
...BaseAuthBody.propTypes,
|
|
|
|
login: PropTypes.func.isRequired,
|
2016-02-27 16:23:58 +05:30
|
|
|
oAuthComplete: PropTypes.func.isRequired,
|
2016-02-13 20:58:47 +05:30
|
|
|
auth: PropTypes.shape({
|
|
|
|
error: PropTypes.string,
|
|
|
|
login: PropTypes.shape({
|
|
|
|
login: PropTypes.stirng
|
|
|
|
})
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
2016-02-27 16:23:58 +05:30
|
|
|
const {user} = this.props;
|
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
return (
|
2016-01-31 18:29:38 +05:30
|
|
|
<div>
|
2016-02-13 20:58:47 +05:30
|
|
|
{this.renderErrors()}
|
|
|
|
|
2016-01-31 18:29:38 +05:30
|
|
|
<PanelBodyHeader>
|
|
|
|
<div className={styles.authInfo}>
|
|
|
|
<div className={styles.authInfoAvatar}>
|
2016-02-27 16:23:58 +05:30
|
|
|
{user.avatar
|
|
|
|
? <img src={user.avatar} />
|
|
|
|
: <span className={icons.user} />
|
|
|
|
}
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
|
|
|
<div className={styles.authInfoTitle}>
|
|
|
|
<Message {...messages.youAuthorizedAs} />
|
|
|
|
</div>
|
|
|
|
<div className={styles.authInfoEmail}>
|
2016-02-27 16:23:58 +05:30
|
|
|
{user.email}
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</PanelBodyHeader>
|
|
|
|
<div className={styles.permissionsContainer}>
|
|
|
|
<div className={styles.permissionsTitle}>
|
2016-02-06 15:32:23 +05:30
|
|
|
<Message {...messages.theAppNeedsAccess1} /><br />
|
|
|
|
<Message {...messages.theAppNeedsAccess2} />
|
2016-01-31 18:29:38 +05:30
|
|
|
</div>
|
|
|
|
<ul className={styles.permissionsList}>
|
|
|
|
<li>Authorization for Minecraft servers</li>
|
|
|
|
<li>Manage your skins directory and additional rows for multiline</li>
|
|
|
|
<li>Change the active skin</li>
|
|
|
|
<li>View your E-mail address</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-02-13 20:58:47 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
onFormSubmit() {
|
2016-02-27 16:23:58 +05:30
|
|
|
this.props.oAuthComplete({
|
|
|
|
accept: true
|
|
|
|
});
|
2016-02-13 20:58:47 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Permissions() {
|
|
|
|
return {
|
|
|
|
Title: () => ( // TODO: separate component for PageTitle
|
|
|
|
<Message {...messages.permissionsTitle}>
|
|
|
|
{(msg) => <span>{msg}<Helmet title={msg} /></span>}
|
|
|
|
</Message>
|
2016-01-31 18:29:38 +05:30
|
|
|
),
|
2016-02-13 20:58:47 +05:30
|
|
|
Body,
|
2016-01-31 18:29:38 +05:30
|
|
|
Footer: () => (
|
2016-02-13 20:58:47 +05:30
|
|
|
<button className={buttons.orange} autoFocus>
|
2016-01-31 18:29:38 +05:30
|
|
|
<Message {...messages.approve} />
|
|
|
|
</button>
|
|
|
|
),
|
|
|
|
Links: () => (
|
|
|
|
<a href="#">
|
|
|
|
<Message {...messages.decline} />
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|