1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Button, Container, Nav, Navbar } from 'react-bootstrap';
4 import { LinkContainer } from 'react-router-bootstrap';
5 import { useTranslation } from 'react-i18next';
7 import Icon from './Icon';
8 import LanguageSwitcher from './LanguageSwitcher';
9 import { getAvatarUrl } from '../../helpers/User';
10 import { withUser } from '../../helpers/UserContext';
12 const Header = ({ doLogout, user }) => {
13 const { t } = useTranslation();
15 return <Navbar id="header" bg="dark" variant="dark">
17 <LinkContainer to="/">
23 <LinkContainer to="/tournaments/6">
24 <Nav.Link href="/tournaments/6">
28 <LinkContainer to="/tournaments/5">
29 <Nav.Link href="/tournaments/5">
34 <Nav className="ms-auto">
35 <LinkContainer to="/tech">
36 <Nav.Link href="/tech">
40 <LinkContainer to="/map">
41 <Nav.Link href="/map">
46 <Navbar.Text className="mx-2">
52 <LinkContainer to={`/users/${user.id}`}>
54 <img alt="" src={getAvatarUrl(user)} />
56 <span className="text-muted">#{user.discriminator}</span>
61 title={t('button.logout')}
62 variant="outline-secondary"
64 <Icon.LOGOUT title="" />
71 if (location.pathname.length > 1) {
72 localStorage.setItem('returnPath', location.pathname.substr(1));
88 doLogout: PropTypes.func,
89 user: PropTypes.shape({
90 avatar: PropTypes.string,
91 discriminator: PropTypes.string,
93 username: PropTypes.string,
97 export default withUser(Header);