Base nuxt move after refactoring until no warnings
There still exists an issue with one Adobe led library ; @international-dates don't seem to compile their sourcemaps correctly. I don't think this is something I can fix however, and it may require hacks and workarounds to solve from what I've gathered
This commit is contained in:
62
pages/calendar.vue
Normal file
62
pages/calendar.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<script lang="ts" setup>
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useCalendar } from '@/stores/CalendarStore'
|
||||
|
||||
import Calendar from '@/components/calendar/Calendar.vue'
|
||||
import Sidebar from '@/components/calendar/Sidebar.vue'
|
||||
import CalendarSearch from '@/components/calendar/search/CalendarSearch.vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { isDigit, isInt, isSignedInt } from '@/utils/Regex'
|
||||
import { onBeforeMount } from 'vue'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { defaultDate, selectedDate, jumpToDate } = useCalendar()
|
||||
const { isAdvancedSearchOpen } = storeToRefs(useCalendar())
|
||||
|
||||
// Check whether all the params are good to go before rendering anything
|
||||
onBeforeMount(() => {
|
||||
let isInvalid: boolean = false
|
||||
|
||||
// If the user already has a selected date from session, jump to it
|
||||
if (selectedDate) {
|
||||
jumpToDate(selectedDate)
|
||||
} else {
|
||||
// Assign default values if no params exist in URL
|
||||
if (!route.query.day || typeof route.query.day === 'object' || !isInt(route.query.day)) {
|
||||
route.query.day = defaultDate.day.toString()
|
||||
isInvalid = true
|
||||
}
|
||||
if (
|
||||
!route.query.month ||
|
||||
typeof route.query.month === 'object' ||
|
||||
!isDigit(route.query.month)
|
||||
) {
|
||||
route.query.month = defaultDate.month.toString()
|
||||
isInvalid = true
|
||||
}
|
||||
if (
|
||||
!route.query.year ||
|
||||
typeof route.query.year === 'object' ||
|
||||
!isSignedInt(route.query.year)
|
||||
) {
|
||||
route.query.year = defaultDate.year.toString()
|
||||
isInvalid = true
|
||||
}
|
||||
|
||||
if (isInvalid) {
|
||||
console.log('replaced')
|
||||
router.replace({ query: route.query, replace: true })
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="h-full grid grid-cols-[auto_1fr]">
|
||||
<Sidebar />
|
||||
<Calendar />
|
||||
|
||||
<CalendarSearch v-model:model-value="isAdvancedSearchOpen" />
|
||||
</main>
|
||||
</template>
|
||||
17
pages/index.vue
Normal file
17
pages/index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<main class="h-full grid place-items-center">
|
||||
<UiCard class="w-1/3 min-w-72" link="/calendar">
|
||||
<UiCardHeader>
|
||||
<UiCardTitle>Calendrier</UiCardTitle>
|
||||
<UiCardDescription>
|
||||
<UiBadge class="mix-blend-luminosity font-bold bg-gray-600" variant="secondary">
|
||||
chronologie
|
||||
</UiBadge>
|
||||
</UiCardDescription>
|
||||
</UiCardHeader>
|
||||
<UiCardContent>
|
||||
Chronologie complète de Léïm, rassemblant les évènements et personnages clés du monde
|
||||
</UiCardContent>
|
||||
</UiCard>
|
||||
</main>
|
||||
</template>
|
||||
Reference in New Issue
Block a user