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';
|
|
|
|
|
|
|
|
import messages from './Userbar.messages.js';
|
|
|
|
import styles from './userbar.scss';
|
|
|
|
|
2016-02-13 20:58:47 +05:30
|
|
|
import { userShape } from 'components/user/User';
|
|
|
|
|
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>
|
|
|
|
)
|
|
|
|
: (
|
|
|
|
<Link to="/logout" className={buttons.blue}>
|
|
|
|
<Message {...messages.logout} />
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
}
|
2016-01-04 11:32:13 +05:30
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|