2016-01-04 11:32:13 +05:30
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
|
|
import { Link } from 'react-router';
|
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
|
|
|
|
|
|
|
import buttons from 'components/ui/buttons.scss';
|
|
|
|
|
2016-05-22 13:36:21 +05:30
|
|
|
import messages from './Userbar.intl.json';
|
2016-01-04 11:32:13 +05:30
|
|
|
import styles from './userbar.scss';
|
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
import { userShape } from 'components/user/User';
|
|
|
|
|
2016-03-02 02:31:56 +05:30
|
|
|
import LoggedInPanel from './LoggedInPanel';
|
|
|
|
|
2016-01-04 11:32:13 +05:30
|
|
|
export default class Userbar extends Component {
|
2016-02-13 20:58:47 +05:30
|
|
|
static displayName = 'Userbar';
|
|
|
|
static propTypes = {
|
|
|
|
user: userShape
|
|
|
|
};
|
|
|
|
|
2016-01-04 11:32:13 +05:30
|
|
|
render() {
|
2016-02-13 20:58:47 +05:30
|
|
|
const { user } = this.props;
|
|
|
|
|
2016-01-04 11:32:13 +05:30
|
|
|
return (
|
|
|
|
<div className={styles.userbar}>
|
2016-02-13 20:58:47 +05:30
|
|
|
{user.isGuest
|
|
|
|
? (
|
|
|
|
<Link to="/register" className={buttons.blue}>
|
|
|
|
<Message {...messages.register} />
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
: (
|
2016-03-02 02:31:56 +05:30
|
|
|
<LoggedInPanel {...this.props} />
|
2016-02-13 20:58:47 +05:30
|
|
|
)
|
|
|
|
}
|
2016-01-04 11:32:13 +05:30
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|