Fixed some bugs

One issue was a missing ui component and the other was about the previous commit's changes with startDate
This commit is contained in:
Alexis
2024-05-01 14:47:06 +02:00
parent 87df080857
commit e9c14f355d
6 changed files with 12 additions and 20 deletions

View File

@@ -2,6 +2,7 @@
import { useCalendar } from '@/stores/CalendarStore'
import { Button } from '@/components/ui/button'
import { PhMagnifyingGlass } from '@phosphor-icons/vue'
import CalendarMenuNav from './CalendarMenuNav.vue'
import CalendarMenuToday from './CalendarMenuToday.vue'
import CalendarSwitch from './CalendarSwitch.vue'

View File

@@ -139,7 +139,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
}
hitCategories = selectedCategories.value.every((selectedCat) => {
return allCategories.includes(selectedCat)
return allCategories.includes(selectedCat as CalendarEventCategory)
})
return (hitTitle || hitDesc) && hitCategories
@@ -162,7 +162,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
// Handle categories logic
let hitCategories: boolean = false
let allCategories: CalendarEventCategory[] = []
let allCategories: CharacterCategory[] = []
if (item.category) {
allCategories.push(item.category)
@@ -173,7 +173,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
}
hitCategories = selectedCategories.value.every((selectedCat) => {
return allCategories.includes(selectedCat)
return allCategories.includes(selectedCat as CharacterCategory)
})
return hitTitle && hitCategories

View File

@@ -53,10 +53,10 @@ const { defaultDate, getFormattedDateTitle } = useCalendar()
</div>
<div class="mb-1 flex gap-4 items-center">
<p class="opacity-75">{{ getFormattedDateTitle(event.date, true) }}</p>
<p class="opacity-75">{{ getFormattedDateTitle(event.startDate, true) }}</p>
<p class="text-sm italic opacity-75 flex items-center gap-1">
<PhHourglassMedium size="16" weight="fill" />
{{ getRelativeString(defaultDate, event.date) }}
{{ getRelativeString(defaultDate, event.startDate) }}
</p>
</div>

View File

@@ -36,7 +36,7 @@ const sortedResults = computed(() => {
let secondDate: LeimDate
if (isCalendarEvent(a)) {
firstDate = a.date
firstDate = a.startDate
} else if (isCharacter(a) && a.birth) {
firstDate = a.birth
} else {
@@ -44,7 +44,7 @@ const sortedResults = computed(() => {
}
if (isCalendarEvent(b)) {
secondDate = b.date
secondDate = b.startDate
} else if (isCharacter(b) && b.birth) {
secondDate = b.birth
} else {
@@ -62,7 +62,7 @@ const pagedResults = computed(() => sortedResults.value.slice(props.startAt, pro
<template>
<ul class="grid gap-4">
<li v-for="r in pagedResults" :key="isCalendarEvent(r) ? r.title : r.name">
<EventCallout v-if="isCalendarEvent(r)" @click="handleJumpToDate(r.date)" :event="r" />
<EventCallout v-if="isCalendarEvent(r)" @click="handleJumpToDate(r.startDate)" :event="r" />
<CharacterCallout
v-else-if="isCharacter(r)"

View File

@@ -51,24 +51,15 @@ export const regularEvents: CalendarEvent[] = [
hidden: true
},
{
title: 'Début de la construction du Rempart de Laurdieu',
title: 'Construction du Rempart de Laurdieu',
startDate: { day: 30, month: 2, year: 340 },
endDate: { day: 27, month: 9, year: 355 },
description:
"Le Grand Conseil Kaldélien ordonne la construction d'une muraille autour des Plaines de Poussières, afin de contenir les quelques démons y sortant.",
category: 'construction',
wiki: 'https://alexcreates.fr/leim/index.php/Plaines_de_poussi%C3%A8re',
hidden: true
},
{
title: 'Finition du Rempart de Laurdieu',
startDate: { day: 27, month: 9, year: 355 },
description:
"Les terramanciens kaldéliens terminent les remparts protégeant l'alliance des démons des Plaines de Poussières.",
category: 'construction',
secondaryCategories: ['inauguration'],
wiki: 'https://alexcreates.fr/leim/index.php/Plaines_de_poussi%C3%A8re',
hidden: true
},
// Histoire Récente
{

View File

@@ -34,5 +34,5 @@ export const calendarEventCategories = [
export type CalendarEventCategory = (typeof calendarEventCategories)[number]
export function isCalendarEvent(object: any): object is CalendarEvent {
return 'date' in object
return 'startDate' in object
}