diff --git a/plugins/calendar-resources/src/components/CalendarView.svelte b/plugins/calendar-resources/src/components/CalendarView.svelte index fa3e52cdb7..29e78bbb3f 100644 --- a/plugins/calendar-resources/src/components/CalendarView.svelte +++ b/plugins/calendar-resources/src/components/CalendarView.svelte @@ -39,7 +39,7 @@ getMonday, showPopup } from '@hcengineering/ui' - import { CalendarMode, DayCalendar, calendarStore, hidePrivateEvents } from '../index' + import { CalendarMode, DayCalendar, calendarByIdStore, hidePrivateEvents } from '../index' import calendar from '../plugin' import Day from './Day.svelte' @@ -140,7 +140,7 @@ ) } $: update(_class, query, calendars, options) - $: visible = hidePrivateEvents(raw, $calendarStore) + $: visible = hidePrivateEvents(raw, $calendarByIdStore) $: objects = getAllEvents(visible, from, to) function inRange (start: Date, end: Date, startPeriod: Date, period: 'day' | 'hour'): boolean { @@ -276,7 +276,7 @@ function clear (dragItem: Doc | undefined) { if (dragItem === undefined) { raw = raw.filter((p) => p._id !== dragItemId) - visible = hidePrivateEvents(raw, $calendarStore) + visible = hidePrivateEvents(raw, $calendarByIdStore) objects = getAllEvents(visible, from, to) } } diff --git a/plugins/calendar-resources/src/components/EventElement.svelte b/plugins/calendar-resources/src/components/EventElement.svelte index 7519af2fa1..a1b9ee54ca 100644 --- a/plugins/calendar-resources/src/components/EventElement.svelte +++ b/plugins/calendar-resources/src/components/EventElement.svelte @@ -19,7 +19,7 @@ import { Component, MILLISECONDS_IN_MINUTE, showPopup, tooltip } from '@hcengineering/ui' import view, { ObjectEditor } from '@hcengineering/view' import { showMenu } from '@hcengineering/view-resources' - import { calendarStore, isVisible } from '../utils' + import { calendarByIdStore, isVisible } from '../utils' import EventPresenter from './EventPresenter.svelte' export let event: Event @@ -48,7 +48,7 @@ let div: HTMLDivElement - $: visible = isVisible(event, $calendarStore) + $: visible = isVisible(event, $calendarByIdStore) function contextMenu (e: MouseEvent): void { showMenu(e, { object: event }) diff --git a/plugins/calendar-resources/src/utils.ts b/plugins/calendar-resources/src/utils.ts index eb61914f80..a4dfa48fe4 100644 --- a/plugins/calendar-resources/src/utils.ts +++ b/plugins/calendar-resources/src/utils.ts @@ -70,7 +70,9 @@ export function isVisible (value: Event, calendars: IdMap): boolean { } } -export const calendarStore = writable>(new Map()) +export const calendarByIdStore = writable>(new Map()) +export const calendarStore = writable([]) +export const visibleCalendarStore = writable([]) function fillStores (): void { const client = getClient() @@ -78,7 +80,9 @@ function fillStores (): void { if (client !== undefined) { const query = createQuery(true) query.query(calendar.class.Calendar, {}, (res) => { - calendarStore.set(toIdMap(res)) + calendarStore.set(res) + visibleCalendarStore.set(res.filter((p) => !p.hidden)) + calendarByIdStore.set(toIdMap(res)) }) } else { setTimeout(() => { diff --git a/plugins/time-resources/src/components/PlanningCalendar.svelte b/plugins/time-resources/src/components/PlanningCalendar.svelte index 9a337dcad3..a4d5218bcc 100644 --- a/plugins/time-resources/src/components/PlanningCalendar.svelte +++ b/plugins/time-resources/src/components/PlanningCalendar.svelte @@ -1,7 +1,7 @@
diff --git a/plugins/time-resources/src/components/team/calendar/EventElement.svelte b/plugins/time-resources/src/components/team/calendar/EventElement.svelte index 6ae3dc9f1c..5a16e32900 100644 --- a/plugins/time-resources/src/components/team/calendar/EventElement.svelte +++ b/plugins/time-resources/src/components/team/calendar/EventElement.svelte @@ -14,7 +14,7 @@ -->