2022-12-02 04:06:08 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 23:38:10 +09:00
|
|
|
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
2019-04-21 03:32:16 +09:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2023-05-28 23:38:10 +09:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
|
2019-04-21 03:32:16 +09:00
|
|
|
import Permalink from 'flavours/glitch/components/permalink';
|
2022-10-11 17:41:15 +09:00
|
|
|
import { profileLink } from 'flavours/glitch/utils/backend_links';
|
2019-04-21 03:32:16 +09:00
|
|
|
|
2023-11-15 20:01:51 +09:00
|
|
|
import { Avatar } from '../../../components/avatar';
|
|
|
|
|
2023-05-28 23:38:10 +09:00
|
|
|
import ActionBar from './action_bar';
|
|
|
|
|
2019-04-21 03:32:16 +09:00
|
|
|
export default class NavigationBar extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
2022-12-02 04:06:08 +09:00
|
|
|
onLogout: PropTypes.func.isRequired,
|
2023-12-10 04:29:53 +09:00
|
|
|
onClose: PropTypes.func,
|
2019-04-21 03:32:16 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
render () {
|
2023-12-10 04:29:53 +09:00
|
|
|
const username = this.props.account.get('acct');
|
2019-04-21 03:32:16 +09:00
|
|
|
return (
|
2022-12-02 04:06:08 +09:00
|
|
|
<div className='navigation-bar'>
|
2023-12-10 04:29:53 +09:00
|
|
|
<Permalink className='avatar' href={this.props.account.get('url')} to={`/@${username}`}>
|
|
|
|
<span style={{ display: 'none' }}>{username}</span>
|
|
|
|
<Avatar account={this.props.account} size={46} />
|
2019-04-21 03:32:16 +09:00
|
|
|
</Permalink>
|
|
|
|
|
2019-06-19 22:41:17 +09:00
|
|
|
<div className='navigation-bar__profile'>
|
2023-12-18 21:20:08 +09:00
|
|
|
<span>
|
|
|
|
<Permalink className='acct' href={this.props.account.get('url')} to={`/@${username}`}>
|
|
|
|
<strong className='navigation-bar__profile-account'>@{username}</strong>
|
|
|
|
</Permalink>
|
|
|
|
</span>
|
2019-04-21 03:32:16 +09:00
|
|
|
|
2019-06-19 22:41:17 +09:00
|
|
|
{ profileLink !== undefined && (
|
|
|
|
<a
|
|
|
|
className='edit'
|
2022-12-02 04:06:08 +09:00
|
|
|
href={profileLink}
|
2019-06-19 22:41:17 +09:00
|
|
|
><FormattedMessage id='navigation_bar.edit_profile' defaultMessage='Edit profile' /></a>
|
|
|
|
)}
|
|
|
|
</div>
|
2022-12-02 04:06:08 +09:00
|
|
|
|
|
|
|
<div className='navigation-bar__actions'>
|
|
|
|
<ActionBar account={this.props.account} onLogout={this.props.onLogout} />
|
|
|
|
</div>
|
2019-04-21 03:32:16 +09:00
|
|
|
</div>
|
|
|
|
);
|
2022-12-02 04:06:08 +09:00
|
|
|
}
|
|
|
|
|
2019-04-21 03:32:16 +09:00
|
|
|
}
|