refac
This commit is contained in:
1 parent
1d892ce2c5
commit
1baf73bdd5
4 files changed
+40
-4
No files matched your search
@@ -179,6 +179,25 @@
|
|||||||
<div class="text-[11px] text-gray-400 dark:text-gray-500 uppercase tracking-wider">
|
<div class="text-[11px] text-gray-400 dark:text-gray-500 uppercase tracking-wider">
|
||||||
{$i18n.t('Calendars')}
|
{$i18n.t('Calendars')}
|
||||||
</div>
|
</div>
|
||||||
|
<button
|
||||||
|
class="p-0.5 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition"
|
||||||
|
title={$i18n.t('New calendar')}
|
||||||
|
on:click={onCreateCalendar}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="size-3 text-gray-400 dark:text-gray-500"
|
||||||
|
><path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M12 4.5v15m7.5-7.5h-15"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#each calendars as cal (cal.id)}
|
{#each calendars as cal (cal.id)}
|
||||||
|
|||||||
@@ -105,8 +105,8 @@
|
|||||||
el.style.contentVisibility = 'visible';
|
el.style.contentVisibility = 'visible';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for DOM update/layout
|
// Let the browser compute layout for the cloned element
|
||||||
await new Promise((r) => setTimeout(r, 100));
|
await new Promise((r) => requestAnimationFrame(r));
|
||||||
|
|
||||||
// Render entire content once
|
// Render entire content once
|
||||||
const canvas = await html2canvas(clonedElement, {
|
const canvas = await html2canvas(clonedElement, {
|
||||||
|
|||||||
@@ -117,8 +117,8 @@
|
|||||||
el.style.contentVisibility = 'visible';
|
el.style.contentVisibility = 'visible';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wait for DOM update/layout
|
// Let the browser compute layout for the cloned element
|
||||||
await new Promise((r) => setTimeout(r, 100));
|
await new Promise((r) => requestAnimationFrame(r));
|
||||||
|
|
||||||
// Render entire content once
|
// Render entire content once
|
||||||
const canvas = await html2canvas(clonedElement, {
|
const canvas = await html2canvas(clonedElement, {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
import CalendarView from '$lib/components/calendar/CalendarView.svelte';
|
import CalendarView from '$lib/components/calendar/CalendarView.svelte';
|
||||||
import CalendarSidebar from '$lib/components/calendar/CalendarSidebar.svelte';
|
import CalendarSidebar from '$lib/components/calendar/CalendarSidebar.svelte';
|
||||||
import CalendarEventModal from '$lib/components/calendar/CalendarEventModal.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 Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
import Plus from '$lib/components/icons/Plus.svelte';
|
import Plus from '$lib/components/icons/Plus.svelte';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
let showEventModal = false;
|
let showEventModal = false;
|
||||||
let editEvent: CalendarEventModel | null = null;
|
let editEvent: CalendarEventModel | null = null;
|
||||||
let defaultStartAt: number | null = null;
|
let defaultStartAt: number | null = null;
|
||||||
|
let showCreateCalendarModal = false;
|
||||||
|
|
||||||
const MONTH_NAMES = [
|
const MONTH_NAMES = [
|
||||||
'January',
|
'January',
|
||||||
@@ -159,6 +161,15 @@
|
|||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleCreateCalendar() {
|
||||||
|
showCreateCalendarModal = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCalendarCreated() {
|
||||||
|
await loadCalendars();
|
||||||
|
await refresh();
|
||||||
|
}
|
||||||
|
|
||||||
function handleNewEvent() {
|
function handleNewEvent() {
|
||||||
editEvent = null;
|
editEvent = null;
|
||||||
defaultStartAt = null;
|
defaultStartAt = null;
|
||||||
@@ -209,6 +220,11 @@
|
|||||||
on:delete={() => refresh()}
|
on:delete={() => refresh()}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<CreateCalendarModal
|
||||||
|
bind:show={showCreateCalendarModal}
|
||||||
|
on:created={handleCalendarCreated}
|
||||||
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex flex-col w-full h-screen max-h-[100dvh] transition-width duration-200 ease-in-out {$showSidebar
|
class="flex flex-col w-full h-screen max-h-[100dvh] transition-width duration-200 ease-in-out {$showSidebar
|
||||||
? 'md:max-w-[calc(100%-var(--sidebar-width))]'
|
? 'md:max-w-[calc(100%-var(--sidebar-width))]'
|
||||||
@@ -350,6 +366,7 @@
|
|||||||
{visibleCalendarIds}
|
{visibleCalendarIds}
|
||||||
{currentDate}
|
{currentDate}
|
||||||
onToggle={toggleCalendar}
|
onToggle={toggleCalendar}
|
||||||
|
onCreateCalendar={handleCreateCalendar}
|
||||||
onDeleteCalendar={handleDeleteCalendar}
|
onDeleteCalendar={handleDeleteCalendar}
|
||||||
onDateSelect={handleDateSelect}
|
onDateSelect={handleDateSelect}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user