Fixed crash with function stringify

This commit is contained in:
Alexis
2024-06-08 14:18:19 +02:00
parent f963116018
commit 3002ae593c
5 changed files with 27 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
import { useCalendar } from '@/stores/CalendarStore' import { useCalendar } from '@/stores/CalendarStore'
import { computed, type Component, type ComputedRef } from 'vue' import { computed, type Component, type ComputedRef } from 'vue'
import { PhMagnifyingGlass } from '@phosphor-icons/vue'
import MonthlyLayout from './state/monthly/Layout.vue' import MonthlyLayout from './state/monthly/Layout.vue'
import CenturyLayout from './state/centennially/Layout.vue' import CenturyLayout from './state/centennially/Layout.vue'
import DecadeLayout from './state/decennially/Layout.vue' import DecadeLayout from './state/decennially/Layout.vue'
@@ -85,8 +86,18 @@ const currentViewComponent: ComputedRef<Component> = computed<Component>(() => {
} }
}) })
const { setCurrentMenu } = useUiStore()
onMounted(() => { onMounted(() => {
jumpToDate(selectedDate) jumpToDate(selectedDate)
setCurrentMenu([
{
phIcon: PhMagnifyingGlass,
tooltip: 'Recherche avancée',
action: 'event-search'
}
])
}) })
</script> </script>
@@ -107,8 +118,8 @@ onMounted(() => {
</div> </div>
</template> </template>
<CalendarSearch /> <LazyCalendarSearch />
<CalendarFormUpdateEvent /> <LazyCalendarFormUpdateEvent />
<CalendarFormDeleteEvent /> <LazyCalendarFormDeleteEvent />
</div> </div>
</template> </template>

View File

@@ -65,7 +65,7 @@ function handleClosePopover() {
</button> </button>
</UiPopoverTrigger> </UiPopoverTrigger>
<CalendarEventDetails <LazyCalendarEventDetails
:event :event
:spans-multiple-days :spans-multiple-days
:is-start-event :is-start-event

View File

@@ -1,7 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { PhHouse, PhList } from '@phosphor-icons/vue' import { PhHouse, PhList } from '@phosphor-icons/vue'
import type { SidebarMenuActionType } from './SidebarProps';
const { revealAdvancedSearch } = useCalendar()
const { currentMenu } = storeToRefs(useUiStore()) const { currentMenu } = storeToRefs(useUiStore())
function handleMenuItemAction(actionType: SidebarMenuActionType) {
if (actionType === 'event-search') {
revealAdvancedSearch()
}
}
</script> </script>
<template> <template>
@@ -39,7 +47,7 @@ const { currentMenu } = storeToRefs(useUiStore())
<component :is="item.phIcon" size="24" weight="fill" /> <component :is="item.phIcon" size="24" weight="fill" />
</RouterLink> </RouterLink>
</UiButton> </UiButton>
<UiButton v-if="item.clickHandler" variant="ghost" size="icon" class="rounded-full" @click="item.clickHandler"> <UiButton v-if="item.action" variant="ghost" size="icon" class="rounded-full" @click="handleMenuItemAction(item.action!)">
<component :is="item.phIcon" size="24" weight="fill" /> <component :is="item.phIcon" size="24" weight="fill" />
</UiButton> </UiButton>
</UiTooltipTrigger> </UiTooltipTrigger>

View File

@@ -1,7 +1,9 @@
export type SidebarMenuActionType = "event-search"
export interface SidebarMenuItem { export interface SidebarMenuItem {
phIcon: Component phIcon: Component
tooltip: string tooltip: string
clickHandler?: () => void action?: SidebarMenuActionType
to?: string to?: string
} }

View File

@@ -1,6 +1,4 @@
<script lang="ts" setup> <script lang="ts" setup>
import { PhMagnifyingGlass } from '@phosphor-icons/vue';
useHead({ useHead({
title: 'Calendrier' title: 'Calendrier'
}) })
@@ -15,17 +13,6 @@ watch(user, (n, _o) => {
navigateTo('/') navigateTo('/')
} }
}) })
const { setCurrentMenu } = useUiStore()
const { revealAdvancedSearch } = useCalendar()
setCurrentMenu([
{
phIcon: PhMagnifyingGlass,
tooltip: 'Recherche avancée',
clickHandler: revealAdvancedSearch
}
])
</script> </script>
<template> <template>