Update MobileHeader.vue: conditionally show profile link and logo based on route

- Added `useRouter` to dynamically check the current route and display the profile button or logo depending on whether the path starts with `/user`.
This commit is contained in:
Jeppe Bundgaard
2025-12-18 09:41:14 +01:00
parent 7a6d2e0b8d
commit fba30ba2ac
@@ -4,13 +4,16 @@ import MobileNavigation from "@/components/viewport/page/headers/MobileNavigatio
import NavigationMenuDepartment from "@/components/viewport/page/headers/menu/NavigationMenuDepartment.vue";
import { IS_DEV } from '@/main';
import SessionUser from "@/components/session/token/SessionUser.vue";
import {useRouter} from "vue-router";
const router = useRouter();
const path = router.currentRoute.value.path;
</script>
<template>
<!-- Company Logo | Spacer | Burger Menu -->
<!-- The burger menu is used to toggle the mobile navigation menu -->
<nav class="navbar is-link is-mobile is-fixed-top mobile-header-section" role="navigation" aria-label="main navigation" :class="{'is-blurred': isTransparent}">
<div class="navbar-item">
<div class="navbar-item" v-show="path.startsWith('/user')">
<!-- Profile -->
<router-link class="button is-white py-0" to="/user/profile" v-if="SessionUser.authenticated.value">
<span class="icon is-large">
@@ -19,7 +22,7 @@ import SessionUser from "@/components/session/token/SessionUser.vue";
</span>
</router-link>
</div>
<div class="navbar-brand" v-show="false">
<div class="navbar-brand" v-show="!path.startsWith('/user')">
<a class="navbar-item is-align-content-center" href="/">
<img src="@/assets/branding/truckwash-banner-white-compressed.png"
alt="Truckwash Logo"