From d903b371b23285d67c998a44b85639e309607872 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 31 Mar 2024 12:43:12 +0200 Subject: [PATCH] Added calendar config base --- src/stores/calendar.ts | 60 ++++++++++++++++++++++++++++++++++++++++++ src/stores/counter.ts | 12 --------- src/views/HomeView.vue | 8 +++++- 3 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 src/stores/calendar.ts delete mode 100644 src/stores/counter.ts diff --git a/src/stores/calendar.ts b/src/stores/calendar.ts new file mode 100644 index 0000000..80fc6c1 --- /dev/null +++ b/src/stores/calendar.ts @@ -0,0 +1,60 @@ +import { computed, ref, type Ref } from 'vue' +import { defineStore } from 'pinia' + +type CalendarPeriod = 'ante' | 'nante' + +type CalendarStaticConfig = { + months: string[] + monthsPerYear: number + daysPerYear: number + daysPerMonth: number + daysPerWeek: number +} + +type CalendarCurrentConfig = { + currentPeriod: Ref + currentYear: Ref + currentMonth: Ref + currentDay: Ref +} + +export const useCalendar = defineStore('calendar', () => { + const months = [ + 'Jalen', + 'Malsen', + 'Verlys', + 'Nalys', + 'Verdore', + 'Sidore', + 'Lyllion', + 'Rion', + 'Farene', + 'Dalvene' + ] + const monthsPerYear = computed(() => months.length) + const daysPerYear = 320 + const daysPerMonth = computed(() => daysPerYear / monthsPerYear.value) + const daysPerWeek = 6 + + const staticConfig: CalendarStaticConfig = { + months, + monthsPerYear: monthsPerYear.value, + daysPerYear, + daysPerMonth: daysPerMonth.value, + daysPerWeek + } + + const currentPeriod: Ref<'nante' | 'ante'> = ref('nante') + const currentYear = ref(3209) + const currentMonth = ref(8) + const currentDay = ref(12) + + const config: CalendarCurrentConfig = { + currentPeriod, + currentYear, + currentMonth, + currentDay + } + + return { staticConfig, config } +}) diff --git a/src/stores/counter.ts b/src/stores/counter.ts deleted file mode 100644 index b6757ba..0000000 --- a/src/stores/counter.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ref, computed } from 'vue' -import { defineStore } from 'pinia' - -export const useCounterStore = defineStore('counter', () => { - const count = ref(0) - const doubleCount = computed(() => count.value * 2) - function increment() { - count.value++ - } - - return { count, doubleCount, increment } -}) diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 128941e..75c3e88 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,5 +1,11 @@ + +