Merge pull request #71 from AlexisNP/features/revamp-sidebar
Features/revamp sidebar
This commit is contained in:
@@ -8,8 +8,8 @@ const { isReadOnly } = storeToRefs(useCalendar())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="pt-4 border-slate-400 dark:border-slate-700 border-b-[1px]">
|
||||
<div class="px-6 flex justify-between">
|
||||
<header class="border-slate-200 contrast-more:border-slate-500 dark:border-slate-700 border-b-[1px]">
|
||||
<div class="px-8 flex justify-between">
|
||||
<menu class="flex items-center gap-2">
|
||||
<li v-if="!isReadOnly">
|
||||
<CalendarDialogQuickCreateEvent />
|
||||
@@ -20,7 +20,7 @@ const { isReadOnly } = storeToRefs(useCalendar())
|
||||
<li>
|
||||
<CalendarMenuNav />
|
||||
</li>
|
||||
<li class="ml-6">
|
||||
<li class="ml-4">
|
||||
<CalendarCurrentDate />
|
||||
</li>
|
||||
</menu>
|
||||
@@ -40,7 +40,7 @@ const { isReadOnly } = storeToRefs(useCalendar())
|
||||
</menu>
|
||||
</div>
|
||||
|
||||
<div class="ml-6">
|
||||
<div class="ml-8">
|
||||
<CalendarMenuSubnav />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -38,7 +38,7 @@ function openEventCreatePopover() {
|
||||
function handleClosing(e: Event) {
|
||||
e.preventDefault()
|
||||
popoverOpen.value = false
|
||||
setTimeout(() => resetSkeleton(), 100)
|
||||
resetSkeleton()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
|
||||
<template>
|
||||
<div
|
||||
ref="calendarTile"
|
||||
class="tile relative text-xs p-2 border-slate-400 dark:border-slate-700 dark:bg-black transition-colors"
|
||||
class="tile relative text-xs p-2 border-slate-200 contrast-more:border-slate-500 dark:border-slate-700 dark:bg-black transition-colors"
|
||||
:class="{
|
||||
'text-slate-300 dark:text-slate-500': props.faded,
|
||||
'text-slate-500 dark:text-slate-300': !props.faded
|
||||
|
||||
60
components/global/Breadcrumb.vue
Normal file
60
components/global/Breadcrumb.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<script setup lang="ts">
|
||||
import { PhCaretRight } from "@phosphor-icons/vue";
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
export type BreadcrumbItem = {
|
||||
label?: string;
|
||||
translateKey?: string;
|
||||
to?: string;
|
||||
}
|
||||
|
||||
defineProps<{
|
||||
items?: BreadcrumbItem[];
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UiBreadcrumb>
|
||||
<UiBreadcrumbList>
|
||||
<UiBreadcrumbItem v-if="route.path !== '/my'">
|
||||
<UiBreadcrumbLink as-child>
|
||||
<NuxtLink to="/my">
|
||||
{{ $t("breadcrumbs.profile") }}
|
||||
</NuxtLink>
|
||||
</UiBreadcrumbLink>
|
||||
</UiBreadcrumbItem>
|
||||
<UiBreadcrumbItem v-else>
|
||||
<UiBreadcrumbPage>
|
||||
{{ $t("breadcrumbs.profile") }}
|
||||
</UiBreadcrumbPage>
|
||||
</UiBreadcrumbItem>
|
||||
|
||||
<template v-for="(item, index) in items" :key="index">
|
||||
<UiBreadcrumbSeparator>
|
||||
<PhCaretRight />
|
||||
</UiBreadcrumbSeparator>
|
||||
<UiBreadcrumbItem>
|
||||
<UiBreadcrumbLink v-if="item.to" as-child>
|
||||
<NuxtLink :to="item.to">
|
||||
<template v-if="item.label">
|
||||
{{ item.label }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t(`breadcrumbs.${item.translateKey}`) }}
|
||||
</template>
|
||||
</NuxtLink>
|
||||
</UiBreadcrumbLink>
|
||||
<UiBreadcrumbPage v-else>
|
||||
<template v-if="item.label">
|
||||
{{ item.label }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ $t(`breadcrumbs.${item.translateKey}`) }}
|
||||
</template>
|
||||
</UiBreadcrumbPage>
|
||||
</UiBreadcrumbItem>
|
||||
</template>
|
||||
</UiBreadcrumbList>
|
||||
</UiBreadcrumb>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
type HeadingLevel = "h1" | "h2" | "h3"
|
||||
type HeadingLevel = "h0" | "h1" | "h2" | "h3"
|
||||
|
||||
interface HeadingProps {
|
||||
level?: HeadingLevel
|
||||
@@ -11,13 +11,16 @@ withDefaults(defineProps<HeadingProps>(), {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1 v-if="level === 'h1'" class="text-4xl font-bold flex">
|
||||
<h1 v-if="level === 'h0'" class="text-4xl md:text-6xl font-bold flex">
|
||||
<slot />
|
||||
</h1>
|
||||
<h2 v-else-if="level === 'h2'" class="text-2xl font-bold flex">
|
||||
<h1 v-else-if="level === 'h1'" class="text-2xl md:text-4xl font-bold flex">
|
||||
<slot />
|
||||
</h1>
|
||||
<h2 v-else-if="level === 'h2'" class="text-xl md:text-2xl font-bold flex">
|
||||
<slot />
|
||||
</h2>
|
||||
<h3 v-if="level === 'h3'" class="text-xl font-bold flex">
|
||||
<h3 v-if="level === 'h3'" class="text-lg md:text-xl font-bold flex">
|
||||
<slot />
|
||||
</h3>
|
||||
</template>
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
<script lang="ts" setup>
|
||||
import { PhCompass, PhList } from "@phosphor-icons/vue"
|
||||
import type { SidebarMenuActionType } from "./SidebarProps";
|
||||
import { PhCompass, PhGlobeHemisphereEast, PhHurricane, PhList } from "@phosphor-icons/vue"
|
||||
import type { SidebarMenuActionType, SidebarMenuIcon } from "./SidebarProps";
|
||||
|
||||
const { revealAdvancedSearch } = useCalendar()
|
||||
const { currentMenu } = storeToRefs(useUiStore())
|
||||
|
||||
// const user = useSupabaseUser()
|
||||
|
||||
function handleMenuItemAction(actionType: SidebarMenuActionType) {
|
||||
if (actionType === "event-search") {
|
||||
revealAdvancedSearch()
|
||||
}
|
||||
}
|
||||
|
||||
function computeMenuItemIcon(iconString: SidebarMenuIcon) {
|
||||
switch (iconString) {
|
||||
case "universe":
|
||||
return PhHurricane
|
||||
case "world":
|
||||
return PhGlobeHemisphereEast
|
||||
default:
|
||||
return PhCompass
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -42,25 +51,39 @@ function handleMenuItemAction(actionType: SidebarMenuActionType) {
|
||||
</UiTooltipProvider>
|
||||
</li>
|
||||
|
||||
<li v-for="(item, i) in currentMenu" :key="i">
|
||||
<UiTooltipProvider :delay-duration="50">
|
||||
<UiTooltip>
|
||||
<UiTooltipTrigger as-child>
|
||||
<UiButton v-if="item.to" variant="ghost" size="icon" class="rounded-full" as-child>
|
||||
<RouterLink :to="item.to">
|
||||
<component :is="item.phIcon" size="24" weight="fill" />
|
||||
</RouterLink>
|
||||
</UiButton>
|
||||
<UiButton v-if="item.action" variant="ghost" size="icon" class="rounded-full" @click="handleMenuItemAction(item.action!)">
|
||||
<component :is="item.phIcon" size="24" weight="fill" />
|
||||
</UiButton>
|
||||
</UiTooltipTrigger>
|
||||
<UiTooltipContent :side="'right'" :side-offset="6">
|
||||
<p>{{ item.tooltip }}</p>
|
||||
</UiTooltipContent>
|
||||
</UiTooltip>
|
||||
</UiTooltipProvider>
|
||||
</li>
|
||||
<ClientOnly>
|
||||
<li v-for="(item, i) in currentMenu" :key="i">
|
||||
<UiTooltipProvider :delay-duration="50">
|
||||
<UiTooltip>
|
||||
<UiTooltipTrigger as-child>
|
||||
<UiButton
|
||||
v-if="item.to"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="rounded-full"
|
||||
as-child
|
||||
>
|
||||
<RouterLink :to="item.to">
|
||||
<component :is="computeMenuItemIcon(item.phIcon)" size="24" :weight="item.phIconWeight || 'fill'" />
|
||||
</RouterLink>
|
||||
</UiButton>
|
||||
<UiButton
|
||||
v-if="item.action"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="rounded-full"
|
||||
@click="handleMenuItemAction(item.action!)"
|
||||
>
|
||||
<component :is="computeMenuItemIcon(item.phIcon)" size="24" :weight="item.phIconWeight || 'fill'" />
|
||||
</UiButton>
|
||||
</UiTooltipTrigger>
|
||||
<UiTooltipContent :side="'right'" :side-offset="6">
|
||||
<p>{{ item.tooltip }}</p>
|
||||
</UiTooltipContent>
|
||||
</UiTooltip>
|
||||
</UiTooltipProvider>
|
||||
</li>
|
||||
</ClientOnly>
|
||||
</menu>
|
||||
|
||||
<UserCTA />
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { ShallowRef } from "vue"
|
||||
|
||||
export type SidebarMenuActionType = "event-search"
|
||||
|
||||
export type SidebarMenuIcon = "universe" | "world"
|
||||
|
||||
export interface SidebarMenuItem {
|
||||
phIcon: ShallowRef // use shallowRef to build phIcon
|
||||
phIcon: SidebarMenuIcon,
|
||||
phIconWeight?: "regular" | "light" | "fill" | "duotone" | "bold" | "thin"
|
||||
highlight?: boolean
|
||||
tooltip: string
|
||||
action?: SidebarMenuActionType
|
||||
to?: string
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue"
|
||||
|
||||
import { PhCheckCircle, PhGear, PhUser, PhLaptop, PhMoon, PhPalette, PhSignIn, PhSignOut, PhSun, PhTranslate, PhUserCircle } from "@phosphor-icons/vue"
|
||||
import { PhCheckCircle, PhUser, PhLaptop, PhMoon, PhPalette, PhSignIn, PhSignOut, PhSun, PhTranslate, PhUserCircle } from "@phosphor-icons/vue"
|
||||
import { cn } from "~/lib/utils";
|
||||
|
||||
const router = useRouter()
|
||||
@@ -186,12 +186,12 @@ function pushRoute(to: AvailableRoutes) {
|
||||
<UiDropdownMenuSeparator />
|
||||
|
||||
<template v-if="user">
|
||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my/settings')">
|
||||
<!-- <UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my/settings')">
|
||||
<PhGear size="20" weight="fill" />
|
||||
<span>
|
||||
{{ $t('ui.sidebarMenu.account') }}
|
||||
</span>
|
||||
</UiDropdownMenuItem>
|
||||
</UiDropdownMenuItem> -->
|
||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="handleLogout">
|
||||
<PhSignOut size="20" weight="fill" />
|
||||
<span>
|
||||
|
||||
13
components/ui/breadcrumb/Breadcrumb.vue
Normal file
13
components/ui/breadcrumb/Breadcrumb.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav aria-label="breadcrumb" :class="props.class">
|
||||
<slot />
|
||||
</nav>
|
||||
</template>
|
||||
22
components/ui/breadcrumb/BreadcrumbEllipsis.vue
Normal file
22
components/ui/breadcrumb/BreadcrumbEllipsis.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { MoreHorizontal } from "lucide-vue-next"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
:class="cn('flex h-9 w-9 items-center justify-center', props.class)"
|
||||
>
|
||||
<slot>
|
||||
<MoreHorizontal class="h-4 w-4" />
|
||||
</slot>
|
||||
<span class="sr-only">More</span>
|
||||
</span>
|
||||
</template>
|
||||
16
components/ui/breadcrumb/BreadcrumbItem.vue
Normal file
16
components/ui/breadcrumb/BreadcrumbItem.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
:class="cn('inline-flex items-center gap-1.5', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</li>
|
||||
</template>
|
||||
20
components/ui/breadcrumb/BreadcrumbLink.vue
Normal file
20
components/ui/breadcrumb/BreadcrumbLink.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PrimitiveProps } from "radix-vue"
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Primitive } from "radix-vue"
|
||||
|
||||
const props = withDefaults(defineProps<PrimitiveProps & { class?: HTMLAttributes["class"] }>(), {
|
||||
as: "a",
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn('transition-colors hover:text-foreground', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
16
components/ui/breadcrumb/BreadcrumbList.vue
Normal file
16
components/ui/breadcrumb/BreadcrumbList.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ol
|
||||
:class="cn('flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</ol>
|
||||
</template>
|
||||
19
components/ui/breadcrumb/BreadcrumbPage.vue
Normal file
19
components/ui/breadcrumb/BreadcrumbPage.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
role="link"
|
||||
aria-disabled="true"
|
||||
aria-current="page"
|
||||
:class="cn('font-normal text-foreground', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
21
components/ui/breadcrumb/BreadcrumbSeparator.vue
Normal file
21
components/ui/breadcrumb/BreadcrumbSeparator.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<script lang="ts" setup>
|
||||
import type { HTMLAttributes } from "vue"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ChevronRight } from "lucide-vue-next"
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes["class"]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<li
|
||||
role="presentation"
|
||||
aria-hidden="true"
|
||||
:class="cn('[&>svg]:w-3 [&>svg]:h-3', props.class)"
|
||||
>
|
||||
<slot>
|
||||
<ChevronRight />
|
||||
</slot>
|
||||
</li>
|
||||
</template>
|
||||
7
components/ui/breadcrumb/index.ts
Normal file
7
components/ui/breadcrumb/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export { default as Breadcrumb } from "./Breadcrumb.vue"
|
||||
export { default as BreadcrumbEllipsis } from "./BreadcrumbEllipsis.vue"
|
||||
export { default as BreadcrumbItem } from "./BreadcrumbItem.vue"
|
||||
export { default as BreadcrumbLink } from "./BreadcrumbLink.vue"
|
||||
export { default as BreadcrumbList } from "./BreadcrumbList.vue"
|
||||
export { default as BreadcrumbPage } from "./BreadcrumbPage.vue"
|
||||
export { default as BreadcrumbSeparator } from "./BreadcrumbSeparator.vue"
|
||||
104
error.vue
Normal file
104
error.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import type { NuxtError } from "#app";
|
||||
import { PhArrowBendDoubleUpLeft, PhBugBeetle, PhImageBroken, PhLinkBreak } from "@phosphor-icons/vue";
|
||||
|
||||
useHead({
|
||||
titleTemplate: (titleChunk) => {
|
||||
return titleChunk ? `${titleChunk} — TTTools` : "TTTools";
|
||||
},
|
||||
meta: [
|
||||
{ name: "charset", content: "UTF-8" },
|
||||
{ name: "viewport", content: "width=device-width, initial-scale=1.0" },
|
||||
{ name: "author", content: "Alexis Pelé" },
|
||||
{ name: "generator", content: "Nuxt" },
|
||||
{ name: "msapplication-TileColor", content: "00aba9" },
|
||||
{ name: "theme-color", content: "00aba9" },
|
||||
{ name: "og:type", content: "tabletop-tools" },
|
||||
{ name: "og:url", content: "ttt.alexcreates.fr" },
|
||||
{ name: "robots", content: "noindex, nofollow"}
|
||||
],
|
||||
link: [
|
||||
{ rel: "apple-touch-icon", sizes: "76x76", href: "/apple-touch-icon.png" },
|
||||
{ rel: "icon", sizes: "32x32", type: "image/png", href: "/favicon-32x32.png" },
|
||||
{ rel: "icon", sizes: "16x16", type: "image/png", href: "/favicon-16x16.png" },
|
||||
{ rel: "manifest", href: "/site.webmanifest" },
|
||||
{ rel: "mask-icon", href: "/safari-pinned-tab.svg", color: "#6595b4" },
|
||||
]
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
error: Object as () => NuxtError
|
||||
})
|
||||
|
||||
const { statusCode } = props.error!
|
||||
|
||||
let titleKey: string
|
||||
let descriptionKey: string
|
||||
let subDescriptionKey: string
|
||||
|
||||
switch (statusCode) {
|
||||
case 404:
|
||||
titleKey = "error.notFound.title"
|
||||
descriptionKey = "error.notFound.descriptionMain"
|
||||
subDescriptionKey = "error.notFound.descriptionSub"
|
||||
break;
|
||||
|
||||
case 500:
|
||||
titleKey = "error.unknownServer.title"
|
||||
descriptionKey = "error.unknownServer.descriptionMain"
|
||||
subDescriptionKey = "error.unknownServer.descriptionSub"
|
||||
break;
|
||||
|
||||
default:
|
||||
titleKey = "error.default.title"
|
||||
descriptionKey = "error.default.descriptionMain"
|
||||
subDescriptionKey = "error.default.descriptionSub"
|
||||
break;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-screen">
|
||||
<div class="h-full grid grid-cols-[auto_1fr] dark:bg-black transition-colors">
|
||||
<Sidebar />
|
||||
|
||||
<div class="wrapper shadow-body-light dark:shadow-body-dark transition-all">
|
||||
<div class="h-full w-full grid place-items-center">
|
||||
<Head>
|
||||
<Title>{{ $t(titleKey) }}</Title>
|
||||
</Head>
|
||||
|
||||
<div class="grid text-center justify-items-center opacity-80">
|
||||
<PhImageBroken v-if="statusCode === 404" size="100" class="opacity-60" />
|
||||
<PhLinkBreak v-else-if="statusCode === 500" size="100" class="opacity-60" />
|
||||
<PhBugBeetle v-else size="100" class="opacity-60" />
|
||||
|
||||
<Heading level="h0">
|
||||
{{ $t(titleKey) }}
|
||||
</Heading>
|
||||
|
||||
<div class="mt-6 md:text-lg">
|
||||
<p>{{ $t(descriptionKey) }}</p>
|
||||
<p>{{ $t(subDescriptionKey) }}</p>
|
||||
</div>
|
||||
|
||||
<UiButton variant="default" class="mt-6 gap-2" as-child>
|
||||
<RouterLink to="/">
|
||||
<PhArrowBendDoubleUpLeft size="24" />
|
||||
|
||||
{{ $t('ui.backToHome') }}
|
||||
</RouterLink>
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wrapper > * {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -8,6 +8,23 @@ export default defineI18nConfig(() => ({
|
||||
title: "Fantasy calendars for TTRPGs",
|
||||
description: "Tools for players and game masters to help them visualize fantasy worlds better.",
|
||||
},
|
||||
error: {
|
||||
default: {
|
||||
title: "An error occured",
|
||||
description: "An error occured while loading the page.",
|
||||
descriptionSub: "Please try again later or contact the administrator !"
|
||||
},
|
||||
notFound: {
|
||||
title: "Page not found",
|
||||
description: "The page you're looking for doesn't exist.",
|
||||
descriptionSub: "Maybe it has been deleted or moved ?"
|
||||
},
|
||||
unknownServer: {
|
||||
title: "Internal server error",
|
||||
description: "An error occured while loading the page.",
|
||||
descriptionSub: "Please try again later or contact the administrator !"
|
||||
},
|
||||
},
|
||||
ui: {
|
||||
action: {
|
||||
back: "Back",
|
||||
@@ -49,6 +66,7 @@ export default defineI18nConfig(() => ({
|
||||
greeting: "Connected as {user}",
|
||||
anonymousGreeting: "Preferences",
|
||||
backToProfile: "Back to profile",
|
||||
backToHome: "Back to home",
|
||||
sidebarMenu: {
|
||||
profile: "Profile",
|
||||
appearance: "Appearance",
|
||||
@@ -90,6 +108,8 @@ export default defineI18nConfig(() => ({
|
||||
world: {
|
||||
nameSingular: "World",
|
||||
namePlural: "Worlds",
|
||||
backToMy: "Back to my universe",
|
||||
backToSingle: "Back to {world}",
|
||||
addSingle: "Add a world",
|
||||
addSingleFirst: "Add your first world !",
|
||||
editSingle: "Edit world",
|
||||
@@ -265,7 +285,18 @@ export default defineI18nConfig(() => ({
|
||||
explore: {
|
||||
menuLabel: "Explore",
|
||||
title: "Explore worlds",
|
||||
},
|
||||
profile: {
|
||||
title: "{user} — My universe",
|
||||
metaTitle: "My universe",
|
||||
}
|
||||
},
|
||||
breadcrumbs: {
|
||||
home: "Home",
|
||||
explore: "Explore",
|
||||
profile: "Universe",
|
||||
world: "World",
|
||||
calendar: "Calendar"
|
||||
}
|
||||
},
|
||||
fr: {
|
||||
@@ -273,6 +304,23 @@ export default defineI18nConfig(() => ({
|
||||
title: "Calendriers fantasies pour JDR",
|
||||
description: "Outils destinés aux joueurs et maîtres de jeux pour visualiser plus facilement leurs univers.",
|
||||
},
|
||||
error: {
|
||||
default: {
|
||||
title: "Une erreur est survenue",
|
||||
descriptionMain: "Une erreur est survenue lors du chargement de la page.",
|
||||
descriptionSub: "Merci de rééssayer plus tard ou de contacter l'administrateur !"
|
||||
},
|
||||
notFound: {
|
||||
title: "Page introuvable",
|
||||
descriptionMain: "La page que vous cherchez n'existe pas.",
|
||||
descriptionSub: "Peut-être a t-elle été supprimée ou déplacée ?"
|
||||
},
|
||||
unknownServer: {
|
||||
title: "Une erreur du serveur est survenue",
|
||||
descriptionMain: "Une erreur est survenue lors du chargement de la page.",
|
||||
descriptionSub: "Merci de rééssayer plus tard ou de contacter l'administrateur !"
|
||||
},
|
||||
},
|
||||
ui: {
|
||||
action: {
|
||||
back: "Retour",
|
||||
@@ -314,6 +362,7 @@ export default defineI18nConfig(() => ({
|
||||
greeting: "Connecté en tant que {user}",
|
||||
anonymousGreeting: "Préférences",
|
||||
backToProfile: "Retour au profil",
|
||||
backToHome: "Retourner à l'accueil",
|
||||
sidebarMenu: {
|
||||
profile: "Profil",
|
||||
appearance: "Apparence",
|
||||
@@ -355,6 +404,8 @@ export default defineI18nConfig(() => ({
|
||||
world: {
|
||||
nameSingular: "Monde",
|
||||
namePlural: "Mondes",
|
||||
backToMy: "Retourner à mon univers",
|
||||
backToSingle: "Retourner sur {world}",
|
||||
addSingle: "Ajouter un monde",
|
||||
addSingleFirst: "Ajouter votre premier monde !",
|
||||
editSingle: "Modifier le monde",
|
||||
@@ -534,7 +585,18 @@ export default defineI18nConfig(() => ({
|
||||
explore: {
|
||||
menuLabel: "Explorer",
|
||||
title: "Explorer les mondes",
|
||||
},
|
||||
profile: {
|
||||
title: "{user} — Mon univers",
|
||||
metaTitle: "Mon univers",
|
||||
}
|
||||
},
|
||||
breadcrumbs: {
|
||||
home: "Accueil",
|
||||
explore: "Explorer",
|
||||
profile: "Univers",
|
||||
world: "Monde",
|
||||
calendar: "Calendrier"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
middleware/resetMenu.ts
Normal file
4
middleware/resetMenu.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default defineNuxtRouteMiddleware(() => {
|
||||
const { resetMenu } = useUiStore()
|
||||
resetMenu()
|
||||
})
|
||||
@@ -1,6 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Calendar } from "~/models/CalendarConfig";
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["reset-menu"]
|
||||
})
|
||||
|
||||
const { data: availableCalendars } = await useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
useHead({
|
||||
titleTemplate: null
|
||||
})
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["reset-menu"]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -40,6 +40,31 @@ const {
|
||||
)
|
||||
|
||||
const isLoading = computed(() => calendarStatus.value === "pending" || categoriesStatus.value === "pending")
|
||||
|
||||
// Set custom menu
|
||||
// This should be reserved for actions, not for breadcrumbs
|
||||
//
|
||||
// const { t } = useI18n()
|
||||
// const { setCurrentMenu } = useUiStore()
|
||||
|
||||
// // Set menu once we have the calendar data
|
||||
// watch(calendar, (n) => {
|
||||
// if (n?.data) {
|
||||
// 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"
|
||||
// },
|
||||
// ])
|
||||
// }
|
||||
// }, { immediate: true })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -61,7 +86,19 @@ const isLoading = computed(() => calendarStatus.value === "pending" || categorie
|
||||
<Title>{{ calendar.data.name }}</Title>
|
||||
</Head>
|
||||
|
||||
<Calendar :calendar-data="calendar.data" :categories="categories.data" />
|
||||
<div class="h-full grid grid-rows-[auto_1fr] pt-8 gap-y-2">
|
||||
<div class="px-8">
|
||||
<Breadcrumb
|
||||
v-if="calendar.data.world"
|
||||
:items="[
|
||||
{ label: calendar.data.world.name, to: `/my/worlds/${calendar.data.world.id}` },
|
||||
{ label: calendar.data.name },
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Calendar :calendar-data="calendar.data" :categories="categories.data" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="h-full w-full grid place-items-center">
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -24,6 +24,20 @@ watch(user, (n) => {
|
||||
}
|
||||
})
|
||||
|
||||
// Set custom menu
|
||||
// This should be reserved for actions, not for breadcrumbs
|
||||
//
|
||||
// const { setCurrentMenu } = useUiStore()
|
||||
|
||||
// setCurrentMenu([
|
||||
// {
|
||||
// tooltip: t("entity.world.backToMy"),
|
||||
// to: "/my",
|
||||
// phIcon: "universe",
|
||||
// highlight: true
|
||||
// },
|
||||
// ])
|
||||
|
||||
/**
|
||||
* === Subscriptions ===
|
||||
*/
|
||||
@@ -172,28 +186,36 @@ function hideEditModal() {
|
||||
<Title>{{ world.data.name }}</Title>
|
||||
</Head>
|
||||
|
||||
<header class="lg:w-1/2 mb-8">
|
||||
<Spacing>
|
||||
<div class="flex items-center gap-2">
|
||||
<Heading level="h1">{{ world.data.name }}</Heading>
|
||||
<header class="mb-8">
|
||||
<Spacing size="lg">
|
||||
<Breadcrumb
|
||||
:items="[
|
||||
{ label: world.data.name }
|
||||
]"
|
||||
/>
|
||||
|
||||
<UiTooltipProvider :delay-duration="250">
|
||||
<UiTooltip>
|
||||
<UiTooltipTrigger as-child>
|
||||
<UiButton size="icon" class="rounded-full h-8 w-8" @click="deployEditModal">
|
||||
<PhPencil size="17" weight="fill" />
|
||||
</UiButton>
|
||||
</UiTooltipTrigger>
|
||||
<UiTooltipContent :side-offset="12" side="right">
|
||||
<p>
|
||||
{{ $t('entity.world.editSingle') }}
|
||||
</p>
|
||||
</UiTooltipContent>
|
||||
</UiTooltip>
|
||||
</UiTooltipProvider>
|
||||
<div class="lg:w-1/2">
|
||||
<div class="flex items-center gap-2 mb-2">
|
||||
<Heading level="h1">{{ world.data.name }}</Heading>
|
||||
|
||||
<UiTooltipProvider :delay-duration="250">
|
||||
<UiTooltip>
|
||||
<UiTooltipTrigger as-child>
|
||||
<UiButton size="icon" class="rounded-full h-8 w-8" @click="deployEditModal">
|
||||
<PhPencil size="17" weight="fill" />
|
||||
</UiButton>
|
||||
</UiTooltipTrigger>
|
||||
<UiTooltipContent :side-offset="12" side="right">
|
||||
<p>
|
||||
{{ $t('entity.world.editSingle') }}
|
||||
</p>
|
||||
</UiTooltipContent>
|
||||
</UiTooltip>
|
||||
</UiTooltipProvider>
|
||||
</div>
|
||||
|
||||
<p>{{ world.data.description }}</p>
|
||||
</div>
|
||||
|
||||
<p>{{ world.data.description }}</p>
|
||||
</Spacing>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@ export const useUiStore = defineStore("ui", () => {
|
||||
currentMenu.value = items
|
||||
}
|
||||
|
||||
function resetMenu() {
|
||||
currentMenu.value = []
|
||||
}
|
||||
|
||||
return {
|
||||
currentMenu,
|
||||
setCurrentMenu
|
||||
setCurrentMenu,
|
||||
resetMenu
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user