Updated title functions on pages
This commit is contained in:
@@ -45,20 +45,17 @@ async function handleLogout() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gotoProfilePage() {
|
type AvailableRoutes = "/my" | "/my/settings"
|
||||||
router.push({ path: "/my/preferences" })
|
|
||||||
|
|
||||||
closeMenu()
|
function pushRoute(to: AvailableRoutes) {
|
||||||
}
|
router.push({ path: to })
|
||||||
|
|
||||||
function gotoSettingsPage() {
|
|
||||||
router.push({ path: "/my/settings" })
|
|
||||||
|
|
||||||
closeMenu()
|
closeMenu()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
{{ preference }}
|
||||||
<ClientOnly>
|
<ClientOnly>
|
||||||
<UiDropdownMenu v-model:open="menuOpened">
|
<UiDropdownMenu v-model:open="menuOpened">
|
||||||
<UiDropdownMenuTrigger>
|
<UiDropdownMenuTrigger>
|
||||||
@@ -79,7 +76,7 @@ function gotoSettingsPage() {
|
|||||||
<template v-if="user">
|
<template v-if="user">
|
||||||
<p class="p-2 text-xs opacity-75">Connecté en tant que {{ user?.email }}</p>
|
<p class="p-2 text-xs opacity-75">Connecté en tant que {{ user?.email }}</p>
|
||||||
|
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="gotoProfilePage">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my')">
|
||||||
<PhGlobeHemisphereWest size="20" weight="fill" />
|
<PhGlobeHemisphereWest size="20" weight="fill" />
|
||||||
<span>Mondes</span>
|
<span>Mondes</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem>
|
||||||
@@ -95,15 +92,15 @@ function gotoSettingsPage() {
|
|||||||
</UiDropdownMenuSubTrigger>
|
</UiDropdownMenuSubTrigger>
|
||||||
<UiDropdownMenuPortal>
|
<UiDropdownMenuPortal>
|
||||||
<UiDropdownMenuSubContent>
|
<UiDropdownMenuSubContent>
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="$colorMode.preference = 'dark'">
|
||||||
<PhMoon size="20" />
|
<PhMoon size="20" />
|
||||||
<span>Sombre</span>
|
<span>Sombre</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem>
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="$colorMode.preference = 'light'">
|
||||||
<PhSun size="20" />
|
<PhSun size="20" />
|
||||||
<span>Clair</span>
|
<span>Clair</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem>
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="$colorMode.preference = 'system'">
|
||||||
<PhLaptop size="20" />
|
<PhLaptop size="20" />
|
||||||
<span>Système</span>
|
<span>Système</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem>
|
||||||
@@ -134,7 +131,7 @@ function gotoSettingsPage() {
|
|||||||
|
|
||||||
<UiDropdownMenuSeparator />
|
<UiDropdownMenuSeparator />
|
||||||
|
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="gotoSettingsPage">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my/settings')">
|
||||||
<PhGear size="20" weight="fill" />
|
<PhGear size="20" weight="fill" />
|
||||||
<span>Compte</span>
|
<span>Compte</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface Calendar extends CalendarConfig {
|
|||||||
id?: number
|
id?: number
|
||||||
name: string
|
name: string
|
||||||
events: CalendarEvent[]
|
events: CalendarEvent[]
|
||||||
color?: string,
|
color?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const postCalendarSchema = z.object({
|
export const postCalendarSchema = z.object({
|
||||||
|
|||||||
@@ -24,8 +24,16 @@ const { data: catData, pending: catPending } = await useLazyFetch("/api/calendar
|
|||||||
const cal = computed<Calendar>(() => calendarData?.value?.data as Calendar)
|
const cal = computed<Calendar>(() => calendarData?.value?.data as Calendar)
|
||||||
const categories = computed<Category[]>(() => catData?.value?.data as Category[])
|
const categories = computed<Category[]>(() => catData?.value?.data as Category[])
|
||||||
|
|
||||||
useHead({
|
if (cal.value) {
|
||||||
title: cal.value.name
|
useHead({
|
||||||
|
title: cal.value.name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(cal, (n) => {
|
||||||
|
useHead({
|
||||||
|
title: n.name
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,20 @@ const { data: res, pending } = await useFetch("/api/worlds/query", { query: { id
|
|||||||
|
|
||||||
const world = ref<World>(res.value?.data as World)
|
const world = ref<World>(res.value?.data as World)
|
||||||
|
|
||||||
useHead({
|
if (world.value) {
|
||||||
title: world.value.name
|
useHead({
|
||||||
})
|
title: world.value.name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(world, (n) => {
|
||||||
|
if (n) {
|
||||||
|
useHead({
|
||||||
|
title: n.name
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, { deep: true })
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: ["auth-guard"]
|
middleware: ["auth-guard"]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user