From c086bb109a1e3e25e89da10dd8f1147e65d460e4 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sun, 7 Apr 2024 20:07:57 +0200 Subject: [PATCH] Moved data out of stores --- src/components/calendar/CalendarEvent.vue | 12 ++++---- src/components/calendar/CalendarMenu.vue | 4 +-- src/data/Characters.ts | 34 +++++++++++++++++++++ src/data/Events.ts | 36 +++++++++++++++++++++++ src/stores/CalendarStore.ts | 2 +- src/stores/CharacterStore.ts | 34 ++------------------- src/stores/EventStore.ts | 30 ++----------------- 7 files changed, 83 insertions(+), 69 deletions(-) create mode 100644 src/data/Characters.ts create mode 100644 src/data/Events.ts diff --git a/src/components/calendar/CalendarEvent.vue b/src/components/calendar/CalendarEvent.vue index 1b1e22a..4df8e22 100644 --- a/src/components/calendar/CalendarEvent.vue +++ b/src/components/calendar/CalendarEvent.vue @@ -15,12 +15,12 @@ defineProps<{ class="text-xs text-white px-2 py-1 block w-full text-left rounded-sm whitespace-nowrap overflow-hidden text-ellipsis" :class="{ 'bg-slate-600 hover:bg-slate-700': !event.category, - 'bg-green-700 hover:bg-green-800': event.category === 'birth', - 'bg-stone-600 hover:bg-stone-800': event.category === 'death', - 'bg-red-600 hover:bg-red-800': event.category === 'catastrophe', - 'bg-pink-600 hover:bg-pink-800': event.category === 'natural-disaster', - 'bg-blue-600 hover:bg-blue-800': event.category === 'legal', - 'bg-amber-700 hover:bg-amber-800': event.category === 'player' + 'bg-lime-600 hover:bg-lime-700': event.category === 'birth', + 'bg-stone-600 hover:bg-stone-700': event.category === 'death', + 'bg-orange-600 hover:bg-orange-700': event.category === 'catastrophe', + 'bg-pink-600 hover:bg-pink-700': event.category === 'natural-disaster', + 'bg-sky-600 hover:bg-sky-700': event.category === 'legal', + 'bg-emerald-600 hover:bg-emerald-700': event.category === 'player' }" > {{ event.title }} diff --git a/src/components/calendar/CalendarMenu.vue b/src/components/calendar/CalendarMenu.vue index 22c3247..cf186b1 100644 --- a/src/components/calendar/CalendarMenu.vue +++ b/src/components/calendar/CalendarMenu.vue @@ -51,8 +51,8 @@ const dateDifference = computed(() => getRelativeString(defaultDate, selectedDat
-
- {{ currentDate.currentDateTitle }} +
+ {{ currentDate.currentDateTitle }}
diff --git a/src/data/Characters.ts b/src/data/Characters.ts new file mode 100644 index 0000000..c8031c9 --- /dev/null +++ b/src/data/Characters.ts @@ -0,0 +1,34 @@ +import type { Character } from '@/models/Characters' + +export const charactersList: Character[] = [ + // Counts of the Alliance + { name: 'Alfrid de Lagarde', birth: { day: 29, month: 7, year: 3193, period: 'nante' } }, + { name: 'Alaric de Lagarde', birth: { day: 23, month: 8, year: 3192, period: 'nante' } }, + { name: 'Anastael III de Quillon', birth: { day: 1, month: 5, year: 3184, period: 'nante' } }, + { name: 'Antoine de Mireloin', birth: { day: 31, month: 5, year: 3190, period: 'nante' } }, + { name: 'Armance Ronchère', birth: { day: 1, month: 1, year: 3132, period: 'nante' } }, + { name: 'Baranne Rougefer', birth: { day: 1, month: 0, year: 3175, period: 'nante' } }, + { name: 'Béatrice II de Grandlac', birth: { day: 21, month: 4, year: 3158, period: 'nante' } }, + { name: 'Favio Asharos-Losantelle', birth: { day: 17, month: 3, year: 3091, period: 'nante' } }, + { name: 'Firmin de Montardieu', birth: { day: 9, month: 2, year: 3203, period: 'nante' } }, + { + name: 'Laura de Montardieu', + birth: { day: 32, month: 3, year: 3167, period: 'nante' }, + death: { day: 1, month: 4, year: 3217, period: 'nante' } + }, + { name: 'Lazarus Tymos', birth: { day: 29, month: 9, year: 3145, period: 'nante' } }, + { name: 'Marion de Corambre', birth: { day: 14, month: 7, year: 3190, period: 'nante' } }, + { name: 'Relforg Pergaré', birth: { day: 18, month: 9, year: 3182, period: 'nante' } }, + { name: 'Vilgarde de Ternâcre', birth: { day: 3, month: 3, year: 2998, period: 'nante' } }, + { name: 'Ysildy Milopée', birth: { day: 3, month: 1, year: 3187, period: 'nante' } }, + + // "Les Milles Cages" + { name: 'Ernestin Pomel', birth: { day: 11, month: 2, year: 3179, period: 'nante' } }, + { name: 'Quacille Lévios', birth: { day: 3, month: 6, year: 3162, period: 'nante' } }, + { name: 'Anastael Simon', birth: { day: 32, month: 2, year: 3166, period: 'nante' } }, + { name: 'Grestain', birth: { day: 9, month: 2, year: 3162, period: 'nante' } }, + { name: 'Tivian Rodhus', birth: { day: 13, month: 3, year: 3157, period: 'nante' } }, + + // Player characters + { name: 'Sulvan Trois-Barbes', birth: { day: 20, month: 3, year: 3169, period: 'nante' } } +] diff --git a/src/data/Events.ts b/src/data/Events.ts new file mode 100644 index 0000000..dddf375 --- /dev/null +++ b/src/data/Events.ts @@ -0,0 +1,36 @@ +import type { CalendarEvent } from '@/models/Events' + +export const regularEvents: CalendarEvent[] = [ + { + title: "Arrivée d'aventuriers à Borélis", + date: { day: 12, month: 7, year: 3209, period: 'nante' }, + description: + 'Tara Belyus, Vascylly et Adol Sulvan livrent 3 condamnés à Handany. Ils partent pour la mer durant la journée.', + category: 'player' + }, + { + title: "Naufrage de l'Éclipse", + description: + "L'Éclipse, le navire de la garde contenant des condamnés à destination des Cages Handaniennes, s'échoue au large des côtes montagneuses de la Lance d'Aldys.", + date: { day: 14, month: 7, year: 3209, period: 'nante' }, + category: 'catastrophe' + }, + { + title: 'Emprisonnement de Tivian Rodhus', + description: "Celui qu'on surnomme la Bête d'Ambrose arrive à Handany, où il purgera sa peine.", + date: { day: 14, month: 7, year: 3209, period: 'nante' }, + category: 'legal' + }, + { + title: 'Sulvan et Anastael atteignent Bamast', + date: { day: 19, month: 2, year: 3210, period: 'nante' }, + category: 'player' + }, + { + title: 'Jugement de Bormis Griloup', + description: + "Bromis Griloup est jugé coupable d'escroquerie et sabotage aux Cours d'Acier de Tourgrise. Il purgera une peine de 10 ans au sein des prisons royales.", + date: { day: 4, month: 8, year: 3209, period: 'nante' }, + category: 'legal' + } +] diff --git a/src/stores/CalendarStore.ts b/src/stores/CalendarStore.ts index 3c6fcc2..feec2c5 100644 --- a/src/stores/CalendarStore.ts +++ b/src/stores/CalendarStore.ts @@ -81,7 +81,7 @@ export const useCalendar = defineStore('calendar', () => { write: true }) - // Default date settings (current day) + // Default date settings (current day in the world) const defaultDay = 23 const defaultMonth = 8 const defaultYear = 3209 diff --git a/src/stores/CharacterStore.ts b/src/stores/CharacterStore.ts index f4eb0a6..1779ea1 100644 --- a/src/stores/CharacterStore.ts +++ b/src/stores/CharacterStore.ts @@ -1,40 +1,10 @@ +import { charactersList } from '@/data/Characters' import type { Character } from '@/models/Characters' import { defineStore } from 'pinia' import { computed, type ComputedRef } from 'vue' export const useCharacters = defineStore('characters', () => { - const characters: Character[] = [ - // Counts of the Alliance - { name: 'Alfrid de Lagarde', birth: { day: 29, month: 7, year: 3193, period: 'nante' } }, - { name: 'Alaric de Lagarde', birth: { day: 23, month: 8, year: 3192, period: 'nante' } }, - { name: 'Anastael III de Quillon', birth: { day: 1, month: 5, year: 3184, period: 'nante' } }, - { name: 'Antoine de Mireloin', birth: { day: 31, month: 5, year: 3190, period: 'nante' } }, - { name: 'Armance Ronchère', birth: { day: 1, month: 1, year: 3132, period: 'nante' } }, - { name: 'Baranne Rougefer', birth: { day: 1, month: 0, year: 3175, period: 'nante' } }, - { name: 'Béatrice II de Grandlac', birth: { day: 21, month: 4, year: 3158, period: 'nante' } }, - { name: 'Favio Asharos-Losantelle', birth: { day: 17, month: 3, year: 3091, period: 'nante' } }, - { name: 'Firmin de Montardieu', birth: { day: 9, month: 2, year: 3203, period: 'nante' } }, - { - name: 'Laura de Montardieu', - birth: { day: 32, month: 3, year: 3167, period: 'nante' }, - death: { day: 1, month: 4, year: 3217, period: 'nante' } - }, - { name: 'Lazarus Tymos', birth: { day: 29, month: 9, year: 3145, period: 'nante' } }, - { name: 'Marion de Corambre', birth: { day: 14, month: 7, year: 3190, period: 'nante' } }, - { name: 'Relforg Pergaré', birth: { day: 18, month: 9, year: 3182, period: 'nante' } }, - { name: 'Vilgarde de Ternâcre', birth: { day: 3, month: 3, year: 2998, period: 'nante' } }, - { name: 'Ysildy Milopée', birth: { day: 3, month: 1, year: 3187, period: 'nante' } }, - - // "Les Milles Cages" - { name: 'Ernestin Pomel', birth: { day: 11, month: 2, year: 3179, period: 'nante' } }, - { name: 'Quacille Lévios', birth: { day: 3, month: 6, year: 3162, period: 'nante' } }, - { name: 'Anastael Simon', birth: { day: 32, month: 2, year: 3166, period: 'nante' } }, - { name: 'Grestain', birth: { day: 9, month: 2, year: 3162, period: 'nante' } }, - { name: 'Tivian Rodhus', birth: { day: 13, month: 3, year: 3157, period: 'nante' } }, - - // Player characters - { name: 'Sulvan Trois-Barbes', birth: { day: 20, month: 3, year: 3169, period: 'nante' } } - ] + const characters: Character[] = charactersList // Get all birth events const charactersWithBirthData: ComputedRef = computed(() => diff --git a/src/stores/EventStore.ts b/src/stores/EventStore.ts index ebade07..04ba0ed 100644 --- a/src/stores/EventStore.ts +++ b/src/stores/EventStore.ts @@ -3,39 +3,13 @@ import { defineStore } from 'pinia' import { computed, ref, watch, type Ref } from 'vue' import { useCalendar } from './CalendarStore' import { useCharacters } from './CharacterStore' +import { regularEvents } from '@/data/Events' export const useCalendarEvents = defineStore('calendar-events', () => { const { currentDate, currentConfig } = useCalendar() const { charactersWithBirthData, charactersWithDeathData } = useCharacters() - const baseEvents = ref([ - { - title: "Arrivée d'aventuriers à Borélis", - date: { day: 12, month: 7, year: 3209, period: 'nante' }, - description: - 'Tara Belyus, Vascylly et Adol Sulvan livrent 3 condamnés à Handany. Ils partent pour la mer durant la journée.', - category: 'player' - }, - { - title: "Naufrage de l'Éclipse", - description: - "L'Éclipse, le navire de la garde contenant des condamnés à destination des Cages Handaniennes, s'échoue au large des côtes montagneuses de la Lance d'Aldys.", - date: { day: 14, month: 7, year: 3209, period: 'nante' }, - category: 'catastrophe' - }, - { - title: 'Sulvan et Anastael atteignent Bamast', - date: { day: 19, month: 2, year: 3210, period: 'nante' }, - category: 'player' - }, - { - title: 'Jugement de Bormis Griloup', - description: - "Bromis Griloup est jugé coupable d'escroquerie et sabotage aux Cours d'Acier de Tourgrise. Il purgera une peine de 10 ans au sein des prisons royales.", - date: { day: 4, month: 8, year: 3209, period: 'nante' }, - category: 'legal' - } - ]) + const baseEvents = ref(regularEvents) const characterBirthEvents = computed(() => { return charactersWithBirthData.map((character) => {