From 0520aa44e634bb9c324121fe0e727b80502bb1ec Mon Sep 17 00:00:00 2001
From: Alexis <35.alexis.pele@gmail.com>
Date: Wed, 1 May 2024 23:00:12 +0200
Subject: [PATCH] Added tags for start and end dates
---
src/components/calendar/CalendarEvent.vue | 59 +++++++++++--------
.../calendar/CalendarEventDetails.vue | 49 ++++++++++-----
.../calendar/state/monthly/DayTile.vue | 9 ++-
src/data/Events.ts | 12 +++-
src/stores/EventStore.ts | 16 +++--
5 files changed, 99 insertions(+), 46 deletions(-)
diff --git a/src/components/calendar/CalendarEvent.vue b/src/components/calendar/CalendarEvent.vue
index 0a794f1..c8d445e 100644
--- a/src/components/calendar/CalendarEvent.vue
+++ b/src/components/calendar/CalendarEvent.vue
@@ -1,12 +1,21 @@
@@ -14,32 +23,36 @@ defineProps<{
-
+
diff --git a/src/components/calendar/CalendarEventDetails.vue b/src/components/calendar/CalendarEventDetails.vue
index 3fb9fc5..5f50f4b 100644
--- a/src/components/calendar/CalendarEventDetails.vue
+++ b/src/components/calendar/CalendarEventDetails.vue
@@ -3,13 +3,18 @@ import { getRelativeString } from '@/models/Date'
import type { CalendarEvent } from '@/models/Events'
import { useCalendar } from '@/stores/CalendarStore'
-import { PhHourglassMedium, PhAlarm } from '@phosphor-icons/vue'
+import { PhHourglassMedium, PhAlarm, PhHourglassHigh, PhHourglassLow } from '@phosphor-icons/vue'
import { Badge } from '@/components/ui/badge'
import { PopoverContent } from '@/components/ui/popover'
const { defaultDate, getFormattedDateTitle } = useCalendar()
-const props = defineProps<{ event: CalendarEvent }>()
+const props = defineProps<{
+ event: CalendarEvent
+ spansMultipleDays: boolean
+ isStartEvent?: boolean
+ isEndEvent?: boolean
+}>()
const dateDifference: string = getRelativeString(defaultDate, props.event.startDate)
const dateDuration: string | null = props.event.endDate
@@ -20,9 +25,11 @@ const dateDuration: string | null = props.event.endDate
-
+
+
{{ getFormattedDateTitle(event.startDate, true) }}
-
+
Du {{ getFormattedDateTitle(event.startDate, true) }} au
{{ getFormattedDateTitle(event.endDate, true) }}
-
-
- Pendant {{ dateDuration }}
-
-
+
+
+
{{ dateDifference }}
+
+
+ Pendant {{ dateDuration }}
+
+
@@ -86,12 +96,21 @@ const dateDuration: string | null = props.event.endDate
-
+
+
-
- {{ event.description }}
-
+
+ {{ event.description }}
+
+
+
+
+ Début
+
+
+ Fin
+
diff --git a/src/components/calendar/state/monthly/DayTile.vue b/src/components/calendar/state/monthly/DayTile.vue
index 5d9aada..3852cc1 100644
--- a/src/components/calendar/state/monthly/DayTile.vue
+++ b/src/components/calendar/state/monthly/DayTile.vue
@@ -24,7 +24,10 @@ const { currentEvents } = storeToRefs(useCalendarEvents())
const eventsForTheDay = computed(() => {
return currentEvents.value.filter((currentEvent) => {
- return areDatesIdentical(currentEvent.startDate, props.date)
+ return (
+ areDatesIdentical(currentEvent.startDate, props.date) ||
+ areDatesIdentical(currentEvent.endDate!, props.date)
+ )
})
})
@@ -90,7 +93,7 @@ const eventsNotDisplayed = computed(
}"
>
-
+
@@ -116,7 +119,7 @@ const eventsNotDisplayed = computed(
:key="event.title"
class="grid pointer-events-auto"
>
-
+
diff --git a/src/data/Events.ts b/src/data/Events.ts
index 26258bf..11abfc3 100644
--- a/src/data/Events.ts
+++ b/src/data/Events.ts
@@ -22,6 +22,16 @@ export const regularEvents: CalendarEvent[] = [
wiki: 'https://alexcreates.fr/leim/index.php/Pr%C3%AAtresses_d%27Asm%C3%A9nys',
hidden: true
},
+ {
+ title: 'Marche du sang',
+ startDate: { day: 18, month: 9, year: -420 },
+ endDate: { day: 27, month: 1, year: -419 },
+ description:
+ "L'empereur de Kaliatos ordonne personnellement la traque de Jorhas Kirendre pour connivence avec les démons. Plusieurs bataillons sont affectés à la chasse de Jorhas, qui se terminera par son incarcération ainsi que la mort de plusieurs centaines de soldats.",
+ category: 'criminalité',
+ wiki: 'https://alexcreates.fr/leim/index.php/Jorhas_Kirendre',
+ hidden: true
+ },
{
title: 'Exécution de Tyhos',
startDate: { day: 1, month: 0, year: 0 },
@@ -130,7 +140,7 @@ export const regularEvents: CalendarEvent[] = [
description: "Le Moine Premier inaugure la grande cloche d'argent au sommet du Pilier d'Ikami.",
startDate: { day: 29, month: 5, year: 3209 },
category: 'religion',
- hidden: true
+ secondaryCategories: ['inauguration']
},
{
title: '1ère disparation à Cantane',
diff --git a/src/stores/EventStore.ts b/src/stores/EventStore.ts
index 663f2f5..c47a6b1 100644
--- a/src/stores/EventStore.ts
+++ b/src/stores/EventStore.ts
@@ -47,10 +47,15 @@ export const useCalendarEvents = defineStore('calendar-events', () => {
* @returns Whether the event should appear in the current view
*/
function shouldEventBeDisplayed(event: CalendarEvent): boolean {
- const eventDateToDays = convertDateToDays(event.startDate)
+ const eventStartDateToDays = convertDateToDays(event.startDate)
+ const eventEndDateToDays: number = event.endDate ? convertDateToDays(event.endDate) : 0
+
const isEventOnCurrentScreen =
- event.startDate.year === currentDate.currentYear &&
- event.startDate.month === currentDate.currentMonth
+ (event.startDate.year === currentDate.currentYear &&
+ event.startDate.month === currentDate.currentMonth) ||
+ (event.endDate &&
+ event.endDate.year === currentDate.currentYear &&
+ event.endDate.month === currentDate.currentMonth)
// Check whether the event is on the last 8 tiles
// This is to allow leap events from appearing on the last 8 tiles
@@ -63,7 +68,10 @@ export const useCalendarEvents = defineStore('calendar-events', () => {
const last8Tiles = lastDayOfCurrentMonth + 8
const isEventOnNext8Tiles =
- eventDateToDays <= last8Tiles && eventDateToDays >= lastDayOfCurrentMonth
+ (eventStartDateToDays <= last8Tiles && eventStartDateToDays >= lastDayOfCurrentMonth) ||
+ (Boolean(event.endDate) &&
+ eventEndDateToDays <= last8Tiles &&
+ eventEndDateToDays >= lastDayOfCurrentMonth)
switch (currentConfig.viewType) {
case 'month':