From 1baf73bdd56f4e5ded12a4bd3c168f4d2a70b840 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 9 May 2026 06:34:03 +0900 Subject: [PATCH] refac --- .../calendar/CalendarSidebar.svelte | 19 +++++++++++++++++++ src/lib/components/layout/Navbar/Menu.svelte | 4 ++-- .../components/layout/Sidebar/ChatMenu.svelte | 4 ++-- src/routes/(app)/calendar/+page.svelte | 17 +++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/lib/components/calendar/CalendarSidebar.svelte b/src/lib/components/calendar/CalendarSidebar.svelte index d3ea51a472..992bcc6854 100644 --- a/src/lib/components/calendar/CalendarSidebar.svelte +++ b/src/lib/components/calendar/CalendarSidebar.svelte @@ -179,6 +179,25 @@
{$i18n.t('Calendars')}
+ {#each calendars as cal (cal.id)} diff --git a/src/lib/components/layout/Navbar/Menu.svelte b/src/lib/components/layout/Navbar/Menu.svelte index 70ae564de8..43bdc2b745 100644 --- a/src/lib/components/layout/Navbar/Menu.svelte +++ b/src/lib/components/layout/Navbar/Menu.svelte @@ -105,8 +105,8 @@ el.style.contentVisibility = 'visible'; }); - // Wait for DOM update/layout - await new Promise((r) => setTimeout(r, 100)); + // Let the browser compute layout for the cloned element + await new Promise((r) => requestAnimationFrame(r)); // Render entire content once const canvas = await html2canvas(clonedElement, { diff --git a/src/lib/components/layout/Sidebar/ChatMenu.svelte b/src/lib/components/layout/Sidebar/ChatMenu.svelte index 156449b7b8..1bc932e430 100644 --- a/src/lib/components/layout/Sidebar/ChatMenu.svelte +++ b/src/lib/components/layout/Sidebar/ChatMenu.svelte @@ -117,8 +117,8 @@ el.style.contentVisibility = 'visible'; }); - // Wait for DOM update/layout - await new Promise((r) => setTimeout(r, 100)); + // Let the browser compute layout for the cloned element + await new Promise((r) => requestAnimationFrame(r)); // Render entire content once const canvas = await html2canvas(clonedElement, { diff --git a/src/routes/(app)/calendar/+page.svelte b/src/routes/(app)/calendar/+page.svelte index ec61a27eb9..9e4006bd19 100644 --- a/src/routes/(app)/calendar/+page.svelte +++ b/src/routes/(app)/calendar/+page.svelte @@ -13,6 +13,7 @@ import CalendarView from '$lib/components/calendar/CalendarView.svelte'; import CalendarSidebar from '$lib/components/calendar/CalendarSidebar.svelte'; import CalendarEventModal from '$lib/components/calendar/CalendarEventModal.svelte'; + import CreateCalendarModal from '$lib/components/calendar/CreateCalendarModal.svelte'; import Spinner from '$lib/components/common/Spinner.svelte'; import Plus from '$lib/components/icons/Plus.svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte'; @@ -34,6 +35,7 @@ let showEventModal = false; let editEvent: CalendarEventModel | null = null; let defaultStartAt: number | null = null; + let showCreateCalendarModal = false; const MONTH_NAMES = [ 'January', @@ -159,6 +161,15 @@ refresh(); } + function handleCreateCalendar() { + showCreateCalendarModal = true; + } + + async function handleCalendarCreated() { + await loadCalendars(); + await refresh(); + } + function handleNewEvent() { editEvent = null; defaultStartAt = null; @@ -209,6 +220,11 @@ on:delete={() => refresh()} /> + +