Changed the way the sidebar works

This commit is contained in:
Alexis
2025-03-13 18:25:04 +01:00
parent fdb77a20f3
commit f0e3fc2167
10 changed files with 117 additions and 34 deletions

View File

@@ -40,6 +40,24 @@ const {
)
const isLoading = computed(() => calendarStatus.value === "pending" || categoriesStatus.value === "pending")
// Set custom menu
const { t } = useI18n()
const { setCurrentMenu } = useUiStore()
setCurrentMenu([
{
tooltip: t("entity.world.backToMy"),
to: "/my",
phIcon: "universe",
phIconWeight: "regular"
},
{
tooltip: t("entity.world.backToSingle", { world: calendar.value?.data.world?.name }),
to: `/my/worlds/${calendar.value?.data.world?.id}`,
phIcon: "world"
},
])
</script>
<template>

View File

@@ -6,7 +6,7 @@ const supabase = useSupabaseClient()
const user = useSupabaseUser()
definePageMeta({
middleware: ["auth-guard"]
middleware: ["auth-guard", "reset-menu"]
})
const { data: worlds } = await useLazyFetch<{ data: World[] }>("/api/worlds/query", { query: { gmId: user?.value!.id } })
@@ -31,7 +31,6 @@ function hideCreateDialog() {
/** Active world channel */
let worldChannel: RealtimeChannel
/** Handles world insertion realtime events */
function handleInsertedWorld(newWorld: WorldChannelPayload) {
if (!worlds.value?.data) return
@@ -121,10 +120,12 @@ function hideEditModal() {
<template>
<main class="p-8">
<Head>
<Title>{{ $t("entity.world.namePlural") }}</Title>
<Title>{{ $t("pages.profile.metaTitle") }}</Title>
</Head>
<Heading level="h1">{{ user?.user_metadata.full_name }}</Heading>
<Heading level="h1">
{{ $t("pages.profile.title", { user: user?.user_metadata.full_name }) }}
</Heading>
<section class="mt-4">
<Spacing size="lg">

View File

@@ -4,6 +4,8 @@ import type { World } from "~/models/World";
import type { Calendar, CalendarChannelPayload } from "~/models/CalendarConfig";
import { PhArrowBendDoubleUpLeft, PhGlobeHemisphereWest, PhPencil } from "@phosphor-icons/vue";
const { t } = useI18n()
const supabase = useSupabaseClient()
const route = useRoute()
const id = route.params.id
@@ -24,6 +26,18 @@ watch(user, (n) => {
}
})
// Set custom menu
const { setCurrentMenu } = useUiStore()
setCurrentMenu([
{
tooltip: t("entity.world.backToMy"),
to: "/my",
phIcon: "universe",
highlight: true
},
])
/**
* === Subscriptions ===
*/