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:
@@ -2,6 +2,7 @@
|
|||||||
import { useCalendar } from '@/stores/CalendarStore'
|
import { useCalendar } from '@/stores/CalendarStore'
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { PhMagnifyingGlass } from '@phosphor-icons/vue'
|
||||||
import CalendarMenuNav from './CalendarMenuNav.vue'
|
import CalendarMenuNav from './CalendarMenuNav.vue'
|
||||||
import CalendarMenuToday from './CalendarMenuToday.vue'
|
import CalendarMenuToday from './CalendarMenuToday.vue'
|
||||||
import CalendarSwitch from './CalendarSwitch.vue'
|
import CalendarSwitch from './CalendarSwitch.vue'
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hitCategories = selectedCategories.value.every((selectedCat) => {
|
hitCategories = selectedCategories.value.every((selectedCat) => {
|
||||||
return allCategories.includes(selectedCat)
|
return allCategories.includes(selectedCat as CalendarEventCategory)
|
||||||
})
|
})
|
||||||
|
|
||||||
return (hitTitle || hitDesc) && hitCategories
|
return (hitTitle || hitDesc) && hitCategories
|
||||||
@@ -162,7 +162,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
|
|||||||
|
|
||||||
// Handle categories logic
|
// Handle categories logic
|
||||||
let hitCategories: boolean = false
|
let hitCategories: boolean = false
|
||||||
let allCategories: CalendarEventCategory[] = []
|
let allCategories: CharacterCategory[] = []
|
||||||
|
|
||||||
if (item.category) {
|
if (item.category) {
|
||||||
allCategories.push(item.category)
|
allCategories.push(item.category)
|
||||||
@@ -173,7 +173,7 @@ const searchResults = computed<(Character | CalendarEvent)[]>(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hitCategories = selectedCategories.value.every((selectedCat) => {
|
hitCategories = selectedCategories.value.every((selectedCat) => {
|
||||||
return allCategories.includes(selectedCat)
|
return allCategories.includes(selectedCat as CharacterCategory)
|
||||||
})
|
})
|
||||||
|
|
||||||
return hitTitle && hitCategories
|
return hitTitle && hitCategories
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ const { defaultDate, getFormattedDateTitle } = useCalendar()
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-1 flex gap-4 items-center">
|
<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">
|
<p class="text-sm italic opacity-75 flex items-center gap-1">
|
||||||
<PhHourglassMedium size="16" weight="fill" />
|
<PhHourglassMedium size="16" weight="fill" />
|
||||||
{{ getRelativeString(defaultDate, event.date) }}
|
{{ getRelativeString(defaultDate, event.startDate) }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const sortedResults = computed(() => {
|
|||||||
let secondDate: LeimDate
|
let secondDate: LeimDate
|
||||||
|
|
||||||
if (isCalendarEvent(a)) {
|
if (isCalendarEvent(a)) {
|
||||||
firstDate = a.date
|
firstDate = a.startDate
|
||||||
} else if (isCharacter(a) && a.birth) {
|
} else if (isCharacter(a) && a.birth) {
|
||||||
firstDate = a.birth
|
firstDate = a.birth
|
||||||
} else {
|
} else {
|
||||||
@@ -44,7 +44,7 @@ const sortedResults = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isCalendarEvent(b)) {
|
if (isCalendarEvent(b)) {
|
||||||
secondDate = b.date
|
secondDate = b.startDate
|
||||||
} else if (isCharacter(b) && b.birth) {
|
} else if (isCharacter(b) && b.birth) {
|
||||||
secondDate = b.birth
|
secondDate = b.birth
|
||||||
} else {
|
} else {
|
||||||
@@ -62,7 +62,7 @@ const pagedResults = computed(() => sortedResults.value.slice(props.startAt, pro
|
|||||||
<template>
|
<template>
|
||||||
<ul class="grid gap-4">
|
<ul class="grid gap-4">
|
||||||
<li v-for="r in pagedResults" :key="isCalendarEvent(r) ? r.title : r.name">
|
<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
|
<CharacterCallout
|
||||||
v-else-if="isCharacter(r)"
|
v-else-if="isCharacter(r)"
|
||||||
|
|||||||
@@ -51,24 +51,15 @@ export const regularEvents: CalendarEvent[] = [
|
|||||||
hidden: true
|
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 },
|
startDate: { day: 30, month: 2, year: 340 },
|
||||||
|
endDate: { day: 27, month: 9, year: 355 },
|
||||||
description:
|
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.",
|
"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',
|
category: 'construction',
|
||||||
wiki: 'https://alexcreates.fr/leim/index.php/Plaines_de_poussi%C3%A8re',
|
wiki: 'https://alexcreates.fr/leim/index.php/Plaines_de_poussi%C3%A8re',
|
||||||
hidden: true
|
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
|
// Histoire Récente
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,5 +34,5 @@ export const calendarEventCategories = [
|
|||||||
export type CalendarEventCategory = (typeof calendarEventCategories)[number]
|
export type CalendarEventCategory = (typeof calendarEventCategories)[number]
|
||||||
|
|
||||||
export function isCalendarEvent(object: any): object is CalendarEvent {
|
export function isCalendarEvent(object: any): object is CalendarEvent {
|
||||||
return 'date' in object
|
return 'startDate' in object
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user