diff --git a/apps/manacore/apps/web/src/lib/modules/calendar/components/QuickEventPopover.svelte b/apps/manacore/apps/web/src/lib/modules/calendar/components/QuickEventPopover.svelte new file mode 100644 index 000000000..7b9d2b219 --- /dev/null +++ b/apps/manacore/apps/web/src/lib/modules/calendar/components/QuickEventPopover.svelte @@ -0,0 +1,322 @@ + + + + + + +
+ + + + + diff --git a/apps/manacore/apps/web/src/lib/modules/calendar/components/WeekView.svelte b/apps/manacore/apps/web/src/lib/modules/calendar/components/WeekView.svelte index 8b349c5cc..22772249a 100644 --- a/apps/manacore/apps/web/src/lib/modules/calendar/components/WeekView.svelte +++ b/apps/manacore/apps/web/src/lib/modules/calendar/components/WeekView.svelte @@ -33,7 +33,7 @@ interface Props { onEventClick?: (event: CalendarEvent) => void; - onQuickCreate?: (startTime: Date, endTime: Date) => void; + onQuickCreate?: (startTime: Date, endTime: Date, position: { x: number; y: number }) => void; } let { onEventClick, onQuickCreate }: Props = $props(); @@ -85,9 +85,9 @@ hourHeight: HOUR_HEIGHT_PX, minutesToPercent, isOtherOperationActive: () => eventDragDrop.isDragging || eventDragDrop.isResizing, - onCreateEnd: (startTime, endTime, _position) => { + onCreateEnd: (startTime, endTime, position) => { if (onQuickCreate) { - onQuickCreate(startTime, endTime); + onQuickCreate(startTime, endTime, position); } }, })); diff --git a/apps/manacore/apps/web/src/routes/(app)/calendar/+page.svelte b/apps/manacore/apps/web/src/routes/(app)/calendar/+page.svelte index a6c9cce51..622999d9c 100644 --- a/apps/manacore/apps/web/src/routes/(app)/calendar/+page.svelte +++ b/apps/manacore/apps/web/src/routes/(app)/calendar/+page.svelte @@ -19,6 +19,7 @@ import AgendaView from '$lib/modules/calendar/components/AgendaView.svelte'; import EventDetailModal from '$lib/modules/calendar/components/EventDetailModal.svelte'; import EventForm from '$lib/modules/calendar/components/EventForm.svelte'; + import QuickEventPopover from '$lib/modules/calendar/components/QuickEventPopover.svelte'; import { ShareNetwork } from '@manacore/shared-icons'; import { ShareModal } from '@manacore/shared-uload'; @@ -70,6 +71,12 @@ let createStartTime = $state(null); let createEndTime = $state(null); + // Quick create popover (inline in calendar grid) + let showQuickCreate = $state(false); + let quickCreateStart = $state(new Date()); + let quickCreateEnd = $state(new Date()); + let quickCreatePosition = $state({ x: 0, y: 0 }); + function handleEventClick(event: CalendarEvent) { selectedEvent = event; } @@ -80,9 +87,39 @@ showCreateForm = true; } - function handleQuickCreate(startTime: Date, endTime: Date) { - createStartTime = startTime; - createEndTime = endTime; + function handleQuickCreate(startTime: Date, endTime: Date, position: { x: number; y: number }) { + quickCreateStart = startTime; + quickCreateEnd = endTime; + quickCreatePosition = position; + showQuickCreate = true; + } + + function handleQuickSave(data: { + title: string; + calendarId: string; + startTime: string; + endTime: string; + isAllDay: boolean; + location: string | null; + }) { + eventsStore.createEvent({ + calendarId: data.calendarId, + title: data.title, + description: null, + startTime: data.startTime, + endTime: data.endTime, + isAllDay: data.isAllDay, + location: data.location, + recurrenceRule: null, + }); + showQuickCreate = false; + } + + function expandQuickCreate() { + // Transfer quick create data to full modal + createStartTime = quickCreateStart; + createEndTime = quickCreateEnd; + showQuickCreate = false; showCreateForm = true; } @@ -139,12 +176,24 @@ + +{#if showQuickCreate} + (showQuickCreate = false)} + onExpand={expandQuickCreate} + /> +{/if} + {#if selectedEvent} (selectedEvent = null)} /> {/if} - + {#if showCreateForm}