import { useState } from "react"; import { Box, Container, Flex, Popover, Text, useMantineTheme } from "@mantine/core"; import { useRequiredBoard } from "@homarr/boards/context"; import type { CalendarEvent } from "@homarr/integrations/types"; import { CalendarEventList } from "./calendar-event-list"; interface CalendarDayProps { date: Date; events: CalendarEvent[]; disabled: boolean; rootWidth: number; rootHeight: number; } export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: CalendarDayProps) => { const [opened, setOpened] = useState(false); const { primaryColor } = useMantineTheme(); const board = useRequiredBoard(); const mantineTheme = useMantineTheme(); const actualItemRadius = mantineTheme.radius[board.itemRadius]; const minAxisSize = Math.min(rootWidth, rootHeight); const shouldScaleDown = minAxisSize < 350; const isSmall = rootHeight < 256; return ( { if (disabled) return; setOpened((prev) => !prev); }} > {date.getDate()} {/* Popover has some offset on the left side, padding is removed because of scrollarea paddings */} ); }; interface NotificationIndicatorProps { events: CalendarEvent[]; isSmall: boolean; } const NotificationIndicator = ({ events, isSmall }: NotificationIndicatorProps) => { const notificationEvents = [...new Set(events.map((event) => event.indicatorColor))].filter(String); /* position bottom is lower when small to not be on top of number*/ return ( {notificationEvents.map((notificationEvent) => { return ; })} ); };