front > menu > account : link conditionally to panel or front account depending on user role
This commit is contained in:
parent
c3119a5cab
commit
4113c69ccf
2 changed files with 45 additions and 38 deletions
|
|
@ -18,6 +18,9 @@ return function ($page, $kirby, $site) {
|
|||
"name" => (string) $kirby->user()->client()->toPage()->title(),
|
||||
"uuid" => (string) $kirby->user()->client()->toPage()->uuid()
|
||||
];
|
||||
if ($kirby->user()->client()->toPage()->logo()->isNotEmpty()) {
|
||||
$userData['client']["logo"] = $kirby->user()->client()->toPage()->logo()->toFile()->url();
|
||||
}
|
||||
}
|
||||
|
||||
if ($kirby->user()->projects()->exists() && $kirby->user()->projects()->isNotEmpty()) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<title id="menu-toggle">
|
||||
{{ isExpanded ? "Masquer le menu" : "Afficher le menu" }}
|
||||
{{ isExpanded ? 'Masquer le menu' : 'Afficher le menu' }}
|
||||
</title>
|
||||
<path
|
||||
d="M10.6751 2.625L3.00007 10.3125C2.94028 10.3686 2.89263 10.4364 2.86005 10.5116C2.82748 10.5869 2.81067 10.668 2.81067 10.75C2.81067 10.832 2.82748 10.9131 2.86005 10.9884C2.89263 11.0636 2.94028 11.1314 3.00007 11.1875L10.6751 18.875M17.1876 2.625L9.50007 10.3125C9.38555 10.4293 9.32141 10.5864 9.32141 10.75C9.32141 10.9136 9.38555 11.0707 9.50007 11.1875L17.1876 18.875"
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<span
|
||||
v-if="mainItem.title === 'Inspirations' && page?.newInspirations"
|
||||
class="pill pill--secondary"
|
||||
>{{ "Nouveautés" }}</span
|
||||
>{{ 'Nouveautés' }}</span
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -95,7 +95,11 @@
|
|||
<footer class="w-full">
|
||||
<ul class="flex">
|
||||
<li data-icon="user">
|
||||
<a href="/panel/account" @click="collapse()">Profil</a>
|
||||
<a
|
||||
:href="user.role === 'admin' ? '/panel/account' : '/account'"
|
||||
@click="collapse()"
|
||||
>Profil</a
|
||||
>
|
||||
</li>
|
||||
<li data-icon="logout">
|
||||
<a href="/logout" @click="collapse()">Déconnexion</a>
|
||||
|
|
@ -106,13 +110,13 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed, ref } from "vue";
|
||||
import { useProjectsStore } from "../stores/projects";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useUserStore } from "../stores/user";
|
||||
import { usePageStore } from "../stores/page";
|
||||
import { useProjectStore } from "../stores/project";
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useProjectsStore } from '../stores/projects';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useUserStore } from '../stores/user';
|
||||
import { usePageStore } from '../stores/page';
|
||||
import { useProjectStore } from '../stores/project';
|
||||
|
||||
const route = useRoute();
|
||||
const isExpanded = ref(true);
|
||||
|
|
@ -132,30 +136,30 @@ const unreadNotificationsCount = computed(() => {
|
|||
|
||||
const mainItems = [
|
||||
{
|
||||
title: "Home",
|
||||
path: "/",
|
||||
icon: "home",
|
||||
title: 'Home',
|
||||
path: '/',
|
||||
icon: 'home',
|
||||
},
|
||||
{
|
||||
title: "Notifications",
|
||||
path: "/notifications",
|
||||
icon: "megaphone",
|
||||
title: 'Notifications',
|
||||
path: '/notifications',
|
||||
icon: 'megaphone',
|
||||
},
|
||||
{
|
||||
title: "Réunions",
|
||||
path: "/reunions",
|
||||
icon: "calendar",
|
||||
title: 'Réunions',
|
||||
path: '/reunions',
|
||||
icon: 'calendar',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
title: "Design to Light",
|
||||
path: "/design-to-light",
|
||||
icon: "leaf",
|
||||
title: 'Design to Light',
|
||||
path: '/design-to-light',
|
||||
icon: 'leaf',
|
||||
},
|
||||
{
|
||||
title: "Inspirations",
|
||||
path: "/inspirations",
|
||||
icon: "inspiration",
|
||||
title: 'Inspirations',
|
||||
path: '/inspirations',
|
||||
icon: 'inspiration',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -176,7 +180,7 @@ function hasUnreadNotification(project) {
|
|||
if (!user.value) return false;
|
||||
return notifications.value.some((notification) => {
|
||||
return (
|
||||
notification.isread != "true" &&
|
||||
notification.isread != 'true' &&
|
||||
project.uri.includes(notification.location.project.uri)
|
||||
);
|
||||
});
|
||||
|
|
@ -190,31 +194,31 @@ function collapse() {
|
|||
</script>
|
||||
|
||||
<style>
|
||||
button[aria-controls="menu"] {
|
||||
button[aria-controls='menu'] {
|
||||
position: fixed;
|
||||
z-index: 101;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
}
|
||||
button[aria-controls="menu"] svg {
|
||||
button[aria-controls='menu'] svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
button[aria-controls="menu"][aria-expanded="true"] {
|
||||
button[aria-controls='menu'][aria-expanded='true'] {
|
||||
margin-top: 1rem;
|
||||
padding: 0.625rem; /* 10px */
|
||||
left: var(--gutter);
|
||||
transform: translateX(calc(var(--sidebar-width) - 100% - 1rem));
|
||||
}
|
||||
button[aria-controls="menu"][aria-expanded="false"] {
|
||||
button[aria-controls='menu'][aria-expanded='false'] {
|
||||
min-width: 3.5rem;
|
||||
min-height: 3.5rem;
|
||||
padding: 1.125rem;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
button[aria-controls="menu"][aria-expanded="false"]
|
||||
button[aria-controls='menu'][aria-expanded='false']
|
||||
+ main
|
||||
> header:not([role="tablist"]) {
|
||||
> header:not([role='tablist']) {
|
||||
margin-left: 4rem;
|
||||
width: calc(100% - 4rem);
|
||||
}
|
||||
|
|
@ -238,7 +242,7 @@ button[aria-controls="menu"][aria-expanded="false"]
|
|||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
button[aria-controls="menu"][aria-expanded="true"] {
|
||||
button[aria-controls='menu'][aria-expanded='true'] {
|
||||
left: 0;
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
|
|
@ -252,8 +256,8 @@ button[aria-controls="menu"][aria-expanded="false"]
|
|||
height: 100vh;
|
||||
padding-top: 2.5rem;
|
||||
}
|
||||
button[aria-controls="menu"][aria-expanded="true"] + #menu::before {
|
||||
content: "";
|
||||
button[aria-controls='menu'][aria-expanded='true'] + #menu::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
|
@ -281,7 +285,7 @@ button[aria-controls="menu"][aria-expanded="false"]
|
|||
z-index: 1;
|
||||
}
|
||||
#menu header::before {
|
||||
content: "";
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -1rem;
|
||||
|
|
@ -350,7 +354,7 @@ button[aria-controls="menu"][aria-expanded="false"]
|
|||
align-items: center;
|
||||
}
|
||||
#menu li a::before {
|
||||
content: "";
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
|
|
@ -386,7 +390,7 @@ button[aria-controls="menu"][aria-expanded="false"]
|
|||
width: fit-content;
|
||||
}
|
||||
#menu details .new::after {
|
||||
content: "" / "Nouvelles modifications";
|
||||
content: '' / 'Nouvelles modifications';
|
||||
color: transparent;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue