Added explorer page

This commit is contained in:
Alexis
2024-12-19 19:38:57 +01:00
parent 199cfb6634
commit bf8257e60f
5 changed files with 73 additions and 10 deletions

View File

@@ -1,11 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { PhGlobeHemisphereWest, PhList } from "@phosphor-icons/vue" import { PhCompass, PhList } from "@phosphor-icons/vue"
import type { SidebarMenuActionType } from "./SidebarProps"; import type { SidebarMenuActionType } from "./SidebarProps";
const { revealAdvancedSearch } = useCalendar() const { revealAdvancedSearch } = useCalendar()
const { currentMenu } = storeToRefs(useUiStore()) const { currentMenu } = storeToRefs(useUiStore())
const user = useSupabaseUser() // const user = useSupabaseUser()
function handleMenuItemAction(actionType: SidebarMenuActionType) { function handleMenuItemAction(actionType: SidebarMenuActionType) {
if (actionType === "event-search") { if (actionType === "event-search") {
@@ -23,19 +23,19 @@ function handleMenuItemAction(actionType: SidebarMenuActionType) {
</UiButton> </UiButton>
</li> </li>
<li v-if="user"> <li>
<UiTooltipProvider :delay-duration="50"> <UiTooltipProvider :delay-duration="50">
<UiTooltip> <UiTooltip>
<UiTooltipTrigger as-child> <UiTooltipTrigger as-child>
<UiButton variant="ghost" size="icon" class="rounded-full" as-child> <UiButton variant="ghost" size="icon" class="rounded-full" as-child>
<RouterLink to="/my"> <RouterLink to="/explore">
<PhGlobeHemisphereWest size="24" weight="fill" /> <PhCompass size="24" weight="fill" />
</RouterLink> </RouterLink>
</UiButton> </UiButton>
</UiTooltipTrigger> </UiTooltipTrigger>
<UiTooltipContent :side="'right'" :side-offset="6"> <UiTooltipContent :side="'right'" :side-offset="6">
<p> <p>
{{ $t('entity.world.namePlural') }} {{ $t('pages.explore.menuLabel') }}
</p> </p>
</UiTooltipContent> </UiTooltipContent>
</UiTooltip> </UiTooltip>

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from "vue" import { computed } from "vue"
import { PhCheckCircle, PhGear, PhGlobeHemisphereWest, PhLaptop, PhMoon, PhPalette, PhSignIn, PhSignOut, PhSun, PhTranslate, PhUserCircle } from "@phosphor-icons/vue" import { PhCheckCircle, PhGear, 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()
@@ -82,9 +82,9 @@ function pushRoute(to: AvailableRoutes) {
</p> </p>
<UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my')"> <UiDropdownMenuItem class="flex gap-[.5ch] items-center rounded-none" @click="pushRoute('/my')">
<PhGlobeHemisphereWest size="20" weight="fill" /> <PhUser size="20" weight="fill" />
<span> <span>
{{ $t('entity.world.namePlural') }} {{ $t('ui.sidebarMenu.profile') }}
</span> </span>
</UiDropdownMenuItem> </UiDropdownMenuItem>

View File

@@ -41,6 +41,7 @@ export default defineI18nConfig(() => ({
greeting: "Connected as {user}", greeting: "Connected as {user}",
anonymousGreeting: "Preferences", anonymousGreeting: "Preferences",
sidebarMenu: { sidebarMenu: {
profile: "Profile",
appearance: "Appearance", appearance: "Appearance",
language: "Language", language: "Language",
account: "Account", account: "Account",
@@ -94,6 +95,8 @@ export default defineI18nConfig(() => ({
calendar: { calendar: {
nameSingular: "Calendar", nameSingular: "Calendar",
namePlural: "Calendars", namePlural: "Calendars",
namePublicSingular: "Public Calendar",
namePublicPlural: "Public Calendars",
addSingle: "Add a calendar", addSingle: "Add a calendar",
notFound: "Calendar not found", notFound: "Calendar not found",
notFoundDescription: "The link is not valid or the calendar has been deleted / archived.", notFoundDescription: "The link is not valid or the calendar has been deleted / archived.",
@@ -229,6 +232,12 @@ export default defineI18nConfig(() => ({
nameSingular: "Character", nameSingular: "Character",
namePlural: "Characters", namePlural: "Characters",
} }
},
pages: {
explore: {
menuLabel: "Explore",
title: "Explore worlds",
}
} }
}, },
fr: { fr: {
@@ -269,6 +278,7 @@ export default defineI18nConfig(() => ({
greeting: "Connecté en tant que {user}", greeting: "Connecté en tant que {user}",
anonymousGreeting: "Préférences", anonymousGreeting: "Préférences",
sidebarMenu: { sidebarMenu: {
profile: "Profil",
appearance: "Apparence", appearance: "Apparence",
language: "Langue", language: "Langue",
account: "Compte", account: "Compte",
@@ -322,6 +332,8 @@ export default defineI18nConfig(() => ({
calendar: { calendar: {
nameSingular: "Calendriers", nameSingular: "Calendriers",
namePlural: "Calendrier", namePlural: "Calendrier",
namePublicSingular: "Calendrier Public",
namePublicPlural: "Calendriers Publics",
addSingle: "Ajouter un calendrier", addSingle: "Ajouter un calendrier",
notFound: "Aucun calendrier trouvé", notFound: "Aucun calendrier trouvé",
notFoundDescription: "Le lien n'est pas valide ou le calendrier a été supprimé / archivé.", notFoundDescription: "Le lien n'est pas valide ou le calendrier a été supprimé / archivé.",
@@ -458,6 +470,12 @@ export default defineI18nConfig(() => ({
nameSingular: "Personnage", nameSingular: "Personnage",
namePlural: "Personnages", namePlural: "Personnages",
} }
},
pages: {
explore: {
menuLabel: "Explorer",
title: "Explorer les mondes",
}
} }
} }
} }

View File

@@ -39,7 +39,8 @@ export default defineNuxtConfig({
login: "/", login: "/",
callback: "/my/", callback: "/my/",
exclude: [ exclude: [
"/calendars(/*)?" "/calendars(/*)?",
"/explore(/*)?"
] ]
} }
}, },

44
pages/explore.vue Normal file
View File

@@ -0,0 +1,44 @@
<script lang="ts" setup>
import type { Calendar } from "~/models/CalendarConfig";
const { data } = await useFetch("/api/calendars/query")
const availableCalendars = data.value?.data as Calendar[]
</script>
<template>
<main class="p-8">
<Head>
<Title>{{ $t("pages.explore.title") }}</Title>
</Head>
<Spacing size="lg">
<Heading level="h1">
{{ $t("pages.explore.title") }}
</Heading>
<Spacing size="lg">
<Heading level="h2">
{{ $t("entity.calendar.namePublicPlural") }}
</Heading>
<ul v-if="availableCalendars && availableCalendars?.length > 0" class="grid md:grid-cols-3 gap-2">
<li v-for="calendar in availableCalendars" :key="calendar.shortId">
<UiCard
class="w-full transition-all hover:bg-slate-50 dark:bg-gray-950 dark:hover:bg-indigo-950 dark:focus-within:outline-gray-900"
:link="`/calendars/${calendar.shortId}`"
>
<UiCardHeader>
<UiCardTitle class="text-xl pr-12">{{ calendar.name }}</UiCardTitle>
</UiCardHeader>
<UiCardContent>
<p class="italic">Description future (ou alors des informations sur le nb d'évènements)</p>
</UiCardContent>
</UiCard>
</li>
</ul>
</Spacing>
</Spacing>
</main>
</template>