From bc29129546cc219bdc0a2c75bbf3cdf955c28e5e Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Thu, 13 Jun 2024 19:10:03 +0200 Subject: [PATCH] Changed ways to access calendars --- components/calendar/Calendar.vue | 54 +++++++++++----- components/global/Spacing.vue | 5 ++ components/global/user/CTA.vue | 2 +- models/World.ts | 5 +- .../Dashboard.vue => pages/i/index.vue | 31 +++++++-- .../[id].vue => i/world/[id]/calendar.vue} | 0 pages/i/world/[id]/index.vue | 64 +++++++++++++++++++ pages/profile.vue | 25 -------- server/api/characters/query.get.ts | 2 +- server/api/worlds/index.get.ts | 10 --- server/api/worlds/query.get.ts | 30 +++++++++ stores/CalendarStore.ts | 26 ++++++-- 12 files changed, 191 insertions(+), 63 deletions(-) create mode 100644 components/global/Spacing.vue rename components/profile/Dashboard.vue => pages/i/index.vue (88%) rename pages/{calendar/[id].vue => i/world/[id]/calendar.vue} (100%) create mode 100644 pages/i/world/[id]/index.vue delete mode 100644 pages/profile.vue delete mode 100644 server/api/worlds/index.get.ts create mode 100644 server/api/worlds/query.get.ts diff --git a/components/calendar/Calendar.vue b/components/calendar/Calendar.vue index cf5c9b8..2dbf0ee 100644 --- a/components/calendar/Calendar.vue +++ b/components/calendar/Calendar.vue @@ -2,7 +2,7 @@ import { useCalendar } from '@/stores/CalendarStore' import { computed, type Component, type ComputedRef } from 'vue' -import { PhMagnifyingGlass } from '@phosphor-icons/vue' +import { PhCircleNotch, PhMagnifyingGlass } from '@phosphor-icons/vue' import MonthlyLayout from './state/monthly/Layout.vue' import CenturyLayout from './state/centennially/Layout.vue' import DecadeLayout from './state/decennially/Layout.vue' @@ -15,9 +15,11 @@ const { setCalendarId, setMonths, setDefaultDate, currentConfig, selectedDate, j const { setEvents, setCategories } = useCalendarEvents() const { setCharacters } = useCharacters() -const { data: calendar, pending: calPending, refresh: calRefresh } = await useLazyFetch(`/api/calendars/query?world_id=${worldId}`) -const { data: characters, pending: charPending, refresh: charRefresh } = await useLazyFetch(`/api/characters/query?world_id=${worldId}`) -const { data: categories, pending: categoryPending, refresh: categoryRefresh } = await useLazyFetch(`/api/calendars/categories/query`) +const { months } = storeToRefs(useCalendar()) + +const { data: calendar, pending: calPending, refresh: calRefresh } = useFetch(`/api/calendars/query?world_id=${worldId}`) +const { data: characters, pending: charPending, refresh: charRefresh } = useFetch(`/api/characters/query?world_id=${worldId}`) +const { data: categories, pending: categoryPending, refresh: categoryRefresh } = useFetch(`/api/calendars/categories/query`) if (!calendar.value) { await calRefresh() @@ -119,24 +121,44 @@ onMounted(() => { + + diff --git a/components/global/Spacing.vue b/components/global/Spacing.vue new file mode 100644 index 0000000..d847420 --- /dev/null +++ b/components/global/Spacing.vue @@ -0,0 +1,5 @@ + diff --git a/components/global/user/CTA.vue b/components/global/user/CTA.vue index d2618db..d068c6a 100644 --- a/components/global/user/CTA.vue +++ b/components/global/user/CTA.vue @@ -43,7 +43,7 @@ async function handleLogout() { } function gotoProfilePage() { - router.push({ path: '/profile' }) + router.push({ path: '/i' }) closeMenu() } diff --git a/models/World.ts b/models/World.ts index 0daa2f0..3aabc60 100644 --- a/models/World.ts +++ b/models/World.ts @@ -1,7 +1,10 @@ +import type { Calendar } from "./CalendarConfig" + export interface World { id: number uuid: string name: string description?: string - color?: string + color?: string, + calendars?: Calendar[] } diff --git a/components/profile/Dashboard.vue b/pages/i/index.vue similarity index 88% rename from components/profile/Dashboard.vue rename to pages/i/index.vue index 17b9a6f..7f37283 100644 --- a/components/profile/Dashboard.vue +++ b/pages/i/index.vue @@ -1,23 +1,44 @@