Skip to content

Commit

Permalink
Update menu order
Browse files Browse the repository at this point in the history
  • Loading branch information
daveearley committed Sep 15, 2024
1 parent 1b84773 commit 19575f2
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions frontend/src/components/common/GlobalMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ import {useDisclosure} from "@mantine/hooks";
import {AboutModal} from "../../modals/AboutModal/index.tsx";
import {getConfig} from "../../../utilites/config.ts";

interface Link {
label: string;
icon: any;
link?: string;
target?: string;
onClick?: (event: any) => void;
}

export const GlobalMenu = () => {
const {data: me} = useGetMe();
const [aboutModalOpen, {open: openAboutModal, close: closeAboutModal}] =
useDisclosure(false);

const links = [
const links: Link[] = [
{
label: t`My Profile`,
icon: IconUser,
Expand All @@ -25,16 +33,6 @@ export const GlobalMenu = () => {
icon: IconSettingsCog,
link: `/account/settings`,
},
{
label: t`Logout`,
icon: IconLogout,
onClick: (event: any) => {
event.preventDefault();
authClient.logout();
localStorage.removeItem("token");
window.location.href = "/auth/login";
},
},
];

if (!getConfig("VITE_HIDE_ABOUT_LINK")) {
Expand All @@ -45,6 +43,17 @@ export const GlobalMenu = () => {
});
}

links.push({
label: t`Logout`,
icon: IconLogout,
onClick: (event: any) => {
event.preventDefault();
authClient.logout();
localStorage.removeItem("token");
window.location.href = "/auth/login";
},
});

return (
<>
<Menu shadow="md" width={200}>
Expand Down

0 comments on commit 19575f2

Please sign in to comment.