diff --git a/frontend/src/components/MenuBar.vue b/frontend/src/components/MenuBar.vue index bcce07f..96d3804 100644 --- a/frontend/src/components/MenuBar.vue +++ b/frontend/src/components/MenuBar.vue @@ -25,6 +25,16 @@ import DarkModeSwitcher from "./DarkModeSwitcher.vue"; import { useRoute } from "vue-router"; import { pb, login, logout } from "../service/pocketbase"; +interface MenuItem { + label: string; + icon: string; + route?: string; + url?: string; + info?: string; + items?: MenuItem[]; + command?: (event?: unknown) => void; +} + const { t } = useI18n({ useScope: "global" }); const toast = useToast(); @@ -44,7 +54,7 @@ onUnmounted(() => { }); const items = computed(() => { - const menuItems = [ + const menuItems: MenuItem[] = [ { label: t("createCalendar"), icon: "pi pi-fw pi-plus", @@ -91,10 +101,21 @@ const items = computed(() => { if (currentUser.value) { menuItems.push({ - label: "Professor Dashboard", + label: t("professorDashboard"), icon: "pi pi-fw pi-user", route: "/professor/dashboard", }); + menuItems.push({ + label: t("logout"), + icon: "pi pi-fw pi-sign-out", + command: () => logout(), + }); + } else { + menuItems.push({ + label: t("login"), + icon: "pi pi-fw pi-sign-in", + command: () => handleLogin(), + }); } return menuItems; @@ -180,6 +201,18 @@ function handleDarkModeToggled(isDarkVar: boolean) { {{ item.label }} + + + + {{ item.label }} + -