feat: open event details drawer on event row click (#4464)

* feat: open event details drawer on event row click

Closes #4294

* feat: review - display Calendar Event details Inline Cells in readonly mode

* fix: fix calendar event field values not being set

* chore: review - reactivate no-extra-boolean-cast eslint rule
This commit is contained in:
Thaïs
2024-03-15 13:37:36 -03:00
committed by GitHub
parent 680bb11f19
commit 38f28de4a6
31 changed files with 530 additions and 231 deletions

View File

@ -1,7 +1,11 @@
import { endOfDay } from 'date-fns';
import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
export const getCalendarEventEndDate = (
calendarEvent: Pick<CalendarEvent, 'endsAt' | 'isFullDay' | 'startsAt'>,
) => calendarEvent.endsAt ?? endOfDay(calendarEvent.startsAt);
) =>
calendarEvent.endsAt
? new Date(calendarEvent.endsAt)
: endOfDay(getCalendarEventStartDate(calendarEvent));

View File

@ -0,0 +1,5 @@
import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
export const getCalendarEventStartDate = (
calendarEvent: Pick<CalendarEvent, 'startsAt'>,
) => new Date(calendarEvent.startsAt);

View File

@ -1,7 +1,8 @@
import { isPast } from 'date-fns';
import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
export const hasCalendarEventStarted = (
calendarEvent: Pick<CalendarEvent, 'startsAt'>,
) => isPast(calendarEvent.startsAt);
) => isPast(getCalendarEventStartDate(calendarEvent));

View File

@ -1,5 +1,6 @@
import { CalendarEvent } from '@/activities/calendar/types/CalendarEvent';
import { getCalendarEventEndDate } from '@/activities/calendar/utils/getCalendarEventEndDate';
import { getCalendarEventStartDate } from '@/activities/calendar/utils/getCalendarEventStartDate';
import { sortAsc } from '~/utils/sort';
export const sortCalendarEventsAsc = (
@ -7,18 +8,16 @@ export const sortCalendarEventsAsc = (
calendarEventB: Pick<CalendarEvent, 'startsAt' | 'endsAt' | 'isFullDay'>,
) => {
const startsAtSort = sortAsc(
calendarEventA.startsAt.getTime(),
calendarEventB.startsAt.getTime(),
getCalendarEventStartDate(calendarEventA).getTime(),
getCalendarEventStartDate(calendarEventB).getTime(),
);
if (startsAtSort === 0) {
const endsAtA = getCalendarEventEndDate(calendarEventA);
const endsAtB = getCalendarEventEndDate(calendarEventB);
if (startsAtSort !== 0) return startsAtSort;
return sortAsc(endsAtA.getTime(), endsAtB.getTime());
}
return startsAtSort;
return sortAsc(
getCalendarEventEndDate(calendarEventA).getTime(),
getCalendarEventEndDate(calendarEventB).getTime(),
);
};
export const sortCalendarEventsDesc = (