Fix players page title

This commit is contained in:
Aurora Lahtela 2022-06-05 22:12:00 +03:00
parent 56a3be1835
commit 576485d20c
1 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,6 @@ import {useTranslation} from "react-i18next";
import {Outlet} from "react-router-dom";
import {useNavigation} from "../../hooks/navigationHook";
import {faSearch} from "@fortawesome/free-solid-svg-icons";
import {useAuth} from "../../hooks/authenticationHook";
import {NightModeCss} from "../../hooks/themeHook";
import Sidebar from "../../components/navigation/Sidebar";
import Header from "../../components/navigation/Header";
@ -18,7 +17,7 @@ const PlayersPage = () => {
const [error] = useState(undefined);
const [sidebarItems, setSidebarItems] = useState([]);
const {currentTab} = useNavigation();
const {currentTab, setCurrentTab} = useNavigation();
useEffect(() => {
const items = [
@ -28,15 +27,16 @@ const PlayersPage = () => {
setSidebarItems(items);
window.document.title = `Plan | Player list`;
}, [t, i18n])
setCurrentTab('html.label.players')
}, [t, i18n, setCurrentTab])
const {authRequired, user} = useAuth();
const showBackButton = isProxy && (!authRequired || user.permissions.filter(perm => perm !== 'page.network').length);
// const {authRequired, user} = useAuth();
const showBackButton = true; // TODO
if (error) {
return <>
<NightModeCss/>
<Sidebar items={[]} showBackButton={true}/>
<Sidebar items={[]} showBackButton={showBackButton}/>
<div className="d-flex flex-column" id="content-wrapper">
<Header page={error.title ? error.title : 'Unexpected error occurred'}/>
<div id="content" style={{display: 'flex'}}>
@ -55,7 +55,7 @@ const PlayersPage = () => {
return (
<>
<NightModeCss/>
<Sidebar items={sidebarItems} showBackButton={true}/>
<Sidebar items={sidebarItems} showBackButton={showBackButton}/>
<div className="d-flex flex-column" id="content-wrapper">
<Header page={displayedServerName} tab={currentTab}/>
<div id="content" style={{display: 'flex'}}>