Fix language resets on logout

Fix Column Actions text not translated
This commit is contained in:
CyferShepard
2024-05-21 08:45:15 +02:00
parent 617dcf88a7
commit c1598f918d
2 changed files with 38 additions and 36 deletions

View File

@@ -259,6 +259,7 @@ export default function ActivityTable(props) {
filterByColumn: `${i18next.t("ACTIVITY_TABLE.FILTER_BY")} {column}`,
toggleSelectAll: i18next.t("ACTIVITY_TABLE.TOGGLE_SELECT_ALL"),
toggleSelectRow: i18next.t("ACTIVITY_TABLE.TOGGLE_SELECT_ROW"),
columnActions: i18next.t("ACTIVITY_TABLE.COLUMN_ACTIONS"),
},
columnFilterDisplayMode: "popover",
layoutMode: "grid",

View File

@@ -1,56 +1,57 @@
import { Nav, Navbar as BootstrapNavbar } from "react-bootstrap";
import { Nav, Navbar as BootstrapNavbar } from "react-bootstrap";
import { Link, useLocation } from "react-router-dom";
import { navData } from "../../../lib/navdata";
import LogoutBoxLineIcon from "remixicon-react/LogoutBoxLineIcon";
import logo_dark from '../../images/icon-b-512.png';
import logo_dark from "../../images/icon-b-512.png";
import "../../css/navbar.css";
import VersionCard from "./version-card";
import { Trans } from "react-i18next";
export default function Navbar() {
const handleLogout = () => {
localStorage.clear();
localStorage.removeItem("token");
window.location.reload();
};
const location = useLocation();
const location = useLocation();
return (
<BootstrapNavbar variant="dark" className=" d-flex flex-column py-0 text-center sticky-top">
<div className="sticky-top py-md-3">
<BootstrapNavbar variant="dark" className=" d-flex flex-column py-0 text-center sticky-top">
<div className="sticky-top py-md-3">
<BootstrapNavbar.Brand as={Link} to={"/"} className="d-none d-md-inline">
<img src={logo_dark} style={{height:"52px"}} className="px-2" alt=''/>
<span><Trans i18nKey="JELLYSTAT" /></span>
<img src={logo_dark} style={{ height: "52px" }} className="px-2" alt="" />
<span>
<Trans i18nKey="JELLYSTAT" />
</span>
</BootstrapNavbar.Brand>
<Nav className="flex-row flex-md-column w-100">
{navData.map((item) => {
const locationString=location.pathname.toLocaleLowerCase();
const isActive = locationString.includes(('/'+item.link).toLocaleLowerCase()) && ((locationString.length>0 && item.link.length>0) || (locationString.length===1 && item.link.length===0)); // check if the link is the current path
return (
<Nav.Link
as={Link}
key={item.id}
className={`navitem${isActive ? " active" : ""} p-2`} // add the "active" class if the link is active
to={item.link}
>
{item.icon}
<span className="d-none d-md-block nav-text">{item.text}</span>
</Nav.Link>
);
})}
<Nav.Link className="navitem p-2 logout" href="#logout" onClick={handleLogout}>
<LogoutBoxLineIcon />
<span className="d-none d-md-block nav-text"><Trans i18nKey="MENU_TABS.LOGOUT" /></span>
</Nav.Link>
</Nav>
</div>
<VersionCard/>
<Nav className="flex-row flex-md-column w-100">
{navData.map((item) => {
const locationString = location.pathname.toLocaleLowerCase();
const isActive =
locationString.includes(("/" + item.link).toLocaleLowerCase()) &&
((locationString.length > 0 && item.link.length > 0) || (locationString.length === 1 && item.link.length === 0)); // check if the link is the current path
return (
<Nav.Link
as={Link}
key={item.id}
className={`navitem${isActive ? " active" : ""} p-2`} // add the "active" class if the link is active
to={item.link}
>
{item.icon}
<span className="d-none d-md-block nav-text">{item.text}</span>
</Nav.Link>
);
})}
<Nav.Link className="navitem p-2 logout" href="#logout" onClick={handleLogout}>
<LogoutBoxLineIcon />
<span className="d-none d-md-block nav-text">
<Trans i18nKey="MENU_TABS.LOGOUT" />
</span>
</Nav.Link>
</Nav>
</div>
<VersionCard />
</BootstrapNavbar>
);
}