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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header class="pt-4 border-slate-400 dark:border-slate-700 border-b-[1px]">
|
<header class="border-slate-200 contrast-more:border-slate-500 dark:border-slate-700 border-b-[1px]">
|
||||||
<div class="px-6 flex justify-between">
|
<div class="px-8 flex justify-between">
|
||||||
<menu class="flex items-center gap-2">
|
<menu class="flex items-center gap-2">
|
||||||
<li v-if="!isReadOnly">
|
<li v-if="!isReadOnly">
|
||||||
<CalendarDialogQuickCreateEvent />
|
<CalendarDialogQuickCreateEvent />
|
||||||
@@ -20,7 +20,7 @@ const { isReadOnly } = storeToRefs(useCalendar())
|
|||||||
<li>
|
<li>
|
||||||
<CalendarMenuNav />
|
<CalendarMenuNav />
|
||||||
</li>
|
</li>
|
||||||
<li class="ml-6">
|
<li class="ml-4">
|
||||||
<CalendarCurrentDate />
|
<CalendarCurrentDate />
|
||||||
</li>
|
</li>
|
||||||
</menu>
|
</menu>
|
||||||
@@ -40,7 +40,7 @@ const { isReadOnly } = storeToRefs(useCalendar())
|
|||||||
</menu>
|
</menu>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ml-6">
|
<div class="ml-8">
|
||||||
<CalendarMenuSubnav />
|
<CalendarMenuSubnav />
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function openEventCreatePopover() {
|
|||||||
function handleClosing(e: Event) {
|
function handleClosing(e: Event) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
popoverOpen.value = false
|
popoverOpen.value = false
|
||||||
setTimeout(() => resetSkeleton(), 100)
|
resetSkeleton()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
ref="calendarTile"
|
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="{
|
:class="{
|
||||||
'text-slate-300 dark:text-slate-500': props.faded,
|
'text-slate-300 dark:text-slate-500': props.faded,
|
||||||
'text-slate-500 dark:text-slate-300': !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>
|
<script lang="ts" setup>
|
||||||
type HeadingLevel = "h1" | "h2" | "h3"
|
type HeadingLevel = "h0" | "h1" | "h2" | "h3"
|
||||||
|
|
||||||
interface HeadingProps {
|
interface HeadingProps {
|
||||||
level?: HeadingLevel
|
level?: HeadingLevel
|
||||||
@@ -11,13 +11,16 @@ withDefaults(defineProps<HeadingProps>(), {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<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 />
|
<slot />
|
||||||
</h1>
|
</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 />
|
<slot />
|
||||||
</h2>
|
</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 />
|
<slot />
|
||||||
</h3>
|
</h3>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,17 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PhCompass, PhList } from "@phosphor-icons/vue"
|
import { PhCompass, PhGlobeHemisphereEast, PhHurricane, PhList } from "@phosphor-icons/vue"
|
||||||
import type { SidebarMenuActionType } from "./SidebarProps";
|
import type { SidebarMenuActionType, SidebarMenuIcon } from "./SidebarProps";
|
||||||
|
|
||||||
const { revealAdvancedSearch } = useCalendar()
|
const { revealAdvancedSearch } = useCalendar()
|
||||||
const { currentMenu } = storeToRefs(useUiStore())
|
const { currentMenu } = storeToRefs(useUiStore())
|
||||||
|
|
||||||
// const user = useSupabaseUser()
|
|
||||||
|
|
||||||
function handleMenuItemAction(actionType: SidebarMenuActionType) {
|
function handleMenuItemAction(actionType: SidebarMenuActionType) {
|
||||||
if (actionType === "event-search") {
|
if (actionType === "event-search") {
|
||||||
revealAdvancedSearch()
|
revealAdvancedSearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function computeMenuItemIcon(iconString: SidebarMenuIcon) {
|
||||||
|
switch (iconString) {
|
||||||
|
case "universe":
|
||||||
|
return PhHurricane
|
||||||
|
case "world":
|
||||||
|
return PhGlobeHemisphereEast
|
||||||
|
default:
|
||||||
|
return PhCompass
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -42,25 +51,39 @@ function handleMenuItemAction(actionType: SidebarMenuActionType) {
|
|||||||
</UiTooltipProvider>
|
</UiTooltipProvider>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li v-for="(item, i) in currentMenu" :key="i">
|
<ClientOnly>
|
||||||
<UiTooltipProvider :delay-duration="50">
|
<li v-for="(item, i) in currentMenu" :key="i">
|
||||||
<UiTooltip>
|
<UiTooltipProvider :delay-duration="50">
|
||||||
<UiTooltipTrigger as-child>
|
<UiTooltip>
|
||||||
<UiButton v-if="item.to" variant="ghost" size="icon" class="rounded-full" as-child>
|
<UiTooltipTrigger as-child>
|
||||||
<RouterLink :to="item.to">
|
<UiButton
|
||||||
<component :is="item.phIcon" size="24" weight="fill" />
|
v-if="item.to"
|
||||||
</RouterLink>
|
variant="ghost"
|
||||||
</UiButton>
|
size="icon"
|
||||||
<UiButton v-if="item.action" variant="ghost" size="icon" class="rounded-full" @click="handleMenuItemAction(item.action!)">
|
class="rounded-full"
|
||||||
<component :is="item.phIcon" size="24" weight="fill" />
|
as-child
|
||||||
</UiButton>
|
>
|
||||||
</UiTooltipTrigger>
|
<RouterLink :to="item.to">
|
||||||
<UiTooltipContent :side="'right'" :side-offset="6">
|
<component :is="computeMenuItemIcon(item.phIcon)" size="24" :weight="item.phIconWeight || 'fill'" />
|
||||||
<p>{{ item.tooltip }}</p>
|
</RouterLink>
|
||||||
</UiTooltipContent>
|
</UiButton>
|
||||||
</UiTooltip>
|
<UiButton
|
||||||
</UiTooltipProvider>
|
v-if="item.action"
|
||||||
</li>
|
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>
|
</menu>
|
||||||
|
|
||||||
<UserCTA />
|
<UserCTA />
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import type { ShallowRef } from "vue"
|
|
||||||
|
|
||||||
export type SidebarMenuActionType = "event-search"
|
export type SidebarMenuActionType = "event-search"
|
||||||
|
|
||||||
|
export type SidebarMenuIcon = "universe" | "world"
|
||||||
|
|
||||||
export interface SidebarMenuItem {
|
export interface SidebarMenuItem {
|
||||||
phIcon: ShallowRef // use shallowRef to build phIcon
|
phIcon: SidebarMenuIcon,
|
||||||
|
phIconWeight?: "regular" | "light" | "fill" | "duotone" | "bold" | "thin"
|
||||||
|
highlight?: boolean
|
||||||
tooltip: string
|
tooltip: string
|
||||||
action?: SidebarMenuActionType
|
action?: SidebarMenuActionType
|
||||||
to?: string
|
to?: string
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue"
|
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";
|
import { cn } from "~/lib/utils";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -186,12 +186,12 @@ function pushRoute(to: AvailableRoutes) {
|
|||||||
<UiDropdownMenuSeparator />
|
<UiDropdownMenuSeparator />
|
||||||
|
|
||||||
<template v-if="user">
|
<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" />
|
<PhGear size="20" weight="fill" />
|
||||||
<span>
|
<span>
|
||||||
{{ $t('ui.sidebarMenu.account') }}
|
{{ $t('ui.sidebarMenu.account') }}
|
||||||
</span>
|
</span>
|
||||||
</UiDropdownMenuItem>
|
</UiDropdownMenuItem> -->
|
||||||
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="handleLogout">
|
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="handleLogout">
|
||||||
<PhSignOut size="20" weight="fill" />
|
<PhSignOut size="20" weight="fill" />
|
||||||
<span>
|
<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",
|
title: "Fantasy calendars for TTRPGs",
|
||||||
description: "Tools for players and game masters to help them visualize fantasy worlds better.",
|
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: {
|
ui: {
|
||||||
action: {
|
action: {
|
||||||
back: "Back",
|
back: "Back",
|
||||||
@@ -49,6 +66,7 @@ export default defineI18nConfig(() => ({
|
|||||||
greeting: "Connected as {user}",
|
greeting: "Connected as {user}",
|
||||||
anonymousGreeting: "Preferences",
|
anonymousGreeting: "Preferences",
|
||||||
backToProfile: "Back to profile",
|
backToProfile: "Back to profile",
|
||||||
|
backToHome: "Back to home",
|
||||||
sidebarMenu: {
|
sidebarMenu: {
|
||||||
profile: "Profile",
|
profile: "Profile",
|
||||||
appearance: "Appearance",
|
appearance: "Appearance",
|
||||||
@@ -90,6 +108,8 @@ export default defineI18nConfig(() => ({
|
|||||||
world: {
|
world: {
|
||||||
nameSingular: "World",
|
nameSingular: "World",
|
||||||
namePlural: "Worlds",
|
namePlural: "Worlds",
|
||||||
|
backToMy: "Back to my universe",
|
||||||
|
backToSingle: "Back to {world}",
|
||||||
addSingle: "Add a world",
|
addSingle: "Add a world",
|
||||||
addSingleFirst: "Add your first world !",
|
addSingleFirst: "Add your first world !",
|
||||||
editSingle: "Edit world",
|
editSingle: "Edit world",
|
||||||
@@ -265,7 +285,18 @@ export default defineI18nConfig(() => ({
|
|||||||
explore: {
|
explore: {
|
||||||
menuLabel: "Explore",
|
menuLabel: "Explore",
|
||||||
title: "Explore worlds",
|
title: "Explore worlds",
|
||||||
|
},
|
||||||
|
profile: {
|
||||||
|
title: "{user} — My universe",
|
||||||
|
metaTitle: "My universe",
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
breadcrumbs: {
|
||||||
|
home: "Home",
|
||||||
|
explore: "Explore",
|
||||||
|
profile: "Universe",
|
||||||
|
world: "World",
|
||||||
|
calendar: "Calendar"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fr: {
|
fr: {
|
||||||
@@ -273,6 +304,23 @@ export default defineI18nConfig(() => ({
|
|||||||
title: "Calendriers fantasies pour JDR",
|
title: "Calendriers fantasies pour JDR",
|
||||||
description: "Outils destinés aux joueurs et maîtres de jeux pour visualiser plus facilement leurs univers.",
|
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: {
|
ui: {
|
||||||
action: {
|
action: {
|
||||||
back: "Retour",
|
back: "Retour",
|
||||||
@@ -314,6 +362,7 @@ export default defineI18nConfig(() => ({
|
|||||||
greeting: "Connecté en tant que {user}",
|
greeting: "Connecté en tant que {user}",
|
||||||
anonymousGreeting: "Préférences",
|
anonymousGreeting: "Préférences",
|
||||||
backToProfile: "Retour au profil",
|
backToProfile: "Retour au profil",
|
||||||
|
backToHome: "Retourner à l'accueil",
|
||||||
sidebarMenu: {
|
sidebarMenu: {
|
||||||
profile: "Profil",
|
profile: "Profil",
|
||||||
appearance: "Apparence",
|
appearance: "Apparence",
|
||||||
@@ -355,6 +404,8 @@ export default defineI18nConfig(() => ({
|
|||||||
world: {
|
world: {
|
||||||
nameSingular: "Monde",
|
nameSingular: "Monde",
|
||||||
namePlural: "Mondes",
|
namePlural: "Mondes",
|
||||||
|
backToMy: "Retourner à mon univers",
|
||||||
|
backToSingle: "Retourner sur {world}",
|
||||||
addSingle: "Ajouter un monde",
|
addSingle: "Ajouter un monde",
|
||||||
addSingleFirst: "Ajouter votre premier monde !",
|
addSingleFirst: "Ajouter votre premier monde !",
|
||||||
editSingle: "Modifier le monde",
|
editSingle: "Modifier le monde",
|
||||||
@@ -534,7 +585,18 @@ export default defineI18nConfig(() => ({
|
|||||||
explore: {
|
explore: {
|
||||||
menuLabel: "Explorer",
|
menuLabel: "Explorer",
|
||||||
title: "Explorer les mondes",
|
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>
|
<script lang="ts" setup>
|
||||||
import type { Calendar } from "~/models/CalendarConfig";
|
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 } })
|
const { data: availableCalendars } = await useLazyFetch<{ data: Calendar[] }>("/api/calendars/query", { key: "explore-calendars", query: { full: true } })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
useHead({
|
useHead({
|
||||||
titleTemplate: null
|
titleTemplate: null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: ["reset-menu"]
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -40,6 +40,31 @@ const {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const isLoading = computed(() => calendarStatus.value === "pending" || categoriesStatus.value === "pending")
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -61,7 +86,19 @@ const isLoading = computed(() => calendarStatus.value === "pending" || categorie
|
|||||||
<Title>{{ calendar.data.name }}</Title>
|
<Title>{{ calendar.data.name }}</Title>
|
||||||
</Head>
|
</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>
|
||||||
|
|
||||||
<div v-else class="h-full w-full grid place-items-center">
|
<div v-else class="h-full w-full grid place-items-center">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const supabase = useSupabaseClient()
|
|||||||
const user = useSupabaseUser()
|
const user = useSupabaseUser()
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: ["auth-guard"]
|
middleware: ["auth-guard", "reset-menu"]
|
||||||
})
|
})
|
||||||
|
|
||||||
const { data: worlds } = await useLazyFetch<{ data: World[] }>("/api/worlds/query", { query: { gmId: user?.value!.id } })
|
const { data: worlds } = await useLazyFetch<{ data: World[] }>("/api/worlds/query", { query: { gmId: user?.value!.id } })
|
||||||
@@ -31,7 +31,6 @@ function hideCreateDialog() {
|
|||||||
/** Active world channel */
|
/** Active world channel */
|
||||||
let worldChannel: RealtimeChannel
|
let worldChannel: RealtimeChannel
|
||||||
|
|
||||||
|
|
||||||
/** Handles world insertion realtime events */
|
/** Handles world insertion realtime events */
|
||||||
function handleInsertedWorld(newWorld: WorldChannelPayload) {
|
function handleInsertedWorld(newWorld: WorldChannelPayload) {
|
||||||
if (!worlds.value?.data) return
|
if (!worlds.value?.data) return
|
||||||
@@ -121,10 +120,12 @@ function hideEditModal() {
|
|||||||
<template>
|
<template>
|
||||||
<main class="p-8">
|
<main class="p-8">
|
||||||
<Head>
|
<Head>
|
||||||
<Title>{{ $t("entity.world.namePlural") }}</Title>
|
<Title>{{ $t("pages.profile.metaTitle") }}</Title>
|
||||||
</Head>
|
</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">
|
<section class="mt-4">
|
||||||
<Spacing size="lg">
|
<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 ===
|
* === Subscriptions ===
|
||||||
*/
|
*/
|
||||||
@@ -172,28 +186,36 @@ function hideEditModal() {
|
|||||||
<Title>{{ world.data.name }}</Title>
|
<Title>{{ world.data.name }}</Title>
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<header class="lg:w-1/2 mb-8">
|
<header class="mb-8">
|
||||||
<Spacing>
|
<Spacing size="lg">
|
||||||
<div class="flex items-center gap-2">
|
<Breadcrumb
|
||||||
<Heading level="h1">{{ world.data.name }}</Heading>
|
:items="[
|
||||||
|
{ label: world.data.name }
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
|
||||||
<UiTooltipProvider :delay-duration="250">
|
<div class="lg:w-1/2">
|
||||||
<UiTooltip>
|
<div class="flex items-center gap-2 mb-2">
|
||||||
<UiTooltipTrigger as-child>
|
<Heading level="h1">{{ world.data.name }}</Heading>
|
||||||
<UiButton size="icon" class="rounded-full h-8 w-8" @click="deployEditModal">
|
|
||||||
<PhPencil size="17" weight="fill" />
|
<UiTooltipProvider :delay-duration="250">
|
||||||
</UiButton>
|
<UiTooltip>
|
||||||
</UiTooltipTrigger>
|
<UiTooltipTrigger as-child>
|
||||||
<UiTooltipContent :side-offset="12" side="right">
|
<UiButton size="icon" class="rounded-full h-8 w-8" @click="deployEditModal">
|
||||||
<p>
|
<PhPencil size="17" weight="fill" />
|
||||||
{{ $t('entity.world.editSingle') }}
|
</UiButton>
|
||||||
</p>
|
</UiTooltipTrigger>
|
||||||
</UiTooltipContent>
|
<UiTooltipContent :side-offset="12" side="right">
|
||||||
</UiTooltip>
|
<p>
|
||||||
</UiTooltipProvider>
|
{{ $t('entity.world.editSingle') }}
|
||||||
|
</p>
|
||||||
|
</UiTooltipContent>
|
||||||
|
</UiTooltip>
|
||||||
|
</UiTooltipProvider>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>{{ world.data.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>{{ world.data.description }}</p>
|
|
||||||
</Spacing>
|
</Spacing>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,13 @@ export const useUiStore = defineStore("ui", () => {
|
|||||||
currentMenu.value = items
|
currentMenu.value = items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetMenu() {
|
||||||
|
currentMenu.value = []
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentMenu,
|
currentMenu,
|
||||||
setCurrentMenu
|
setCurrentMenu,
|
||||||
|
resetMenu
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user