diff --git a/apps/docs/docs/widgets/calendar/index.mdx b/apps/docs/docs/widgets/calendar/index.mdx index 57ca565fe..82d8a1cbd 100644 --- a/apps/docs/docs/widgets/calendar/index.mdx +++ b/apps/docs/docs/widgets/calendar/index.mdx @@ -69,6 +69,7 @@ import advancedView from "./img/advanced-view.png"; ### Interactions +- Colored dots directly below a date mark its events. They scale with the widget and are hidden when the calendar is too short. - Hover over a marked date to preview its events in a popover. - The advanced view replaces the month grid with a grouped event list, keeps every event attributed to its source integration, and expands titles, locations, and descriptions. Use its previous and next controls to change months. - If one selected integration is unavailable, its warning indicator remains visible while events from healthy integrations continue to load. diff --git a/packages/widgets/src/calendar/calender-day.tsx b/packages/widgets/src/calendar/calender-day.tsx index 75fb09570..679d4e9f6 100644 --- a/packages/widgets/src/calendar/calender-day.tsx +++ b/packages/widgets/src/calendar/calender-day.tsx @@ -20,27 +20,29 @@ export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: C const minAxisSize = Math.min(rootWidth, rootHeight); const shouldScaleDown = minAxisSize < 350; - const isSmall = rootHeight < 256; + const shouldShowIndicators = rootHeight >= 256; + const indicatorSize = shouldScaleDown ? 3 : 4; const cell = ( {date.getDate()} - + ); @@ -67,25 +69,34 @@ export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: C interface NotificationIndicatorProps { events: CalendarEvent[]; - isSmall: boolean; + size: number; + visible: boolean; } -const NotificationIndicator = ({ events, isSmall }: NotificationIndicatorProps) => { - const notificationEvents = [...new Set(events.map((event) => event.indicatorColor))].filter(String); +const NotificationIndicator = ({ events, size, visible }: NotificationIndicatorProps) => { + const notificationEvents = [...new Set(events.map((event) => event.indicatorColor))].filter( + (color): color is string => Boolean(color), + ); + + if (!visible) return null; + return ( {notificationEvents.map((notificationEvent) => { - return ; + return ( + + ); })} );