import { Container, Popover, useMantineTheme } from "@mantine/core"; import { useDisclosure } from "@mantine/hooks"; import type { CalendarEvent } from "@homarr/integrations/types"; import { CalendarEventList } from "./calendar-event-list"; interface CalendarDayProps { date: Date; events: CalendarEvent[]; disabled: boolean; } export const CalendarDay = ({ date, events, disabled }: CalendarDayProps) => { const [opened, { close, open }] = useDisclosure(false); const { primaryColor } = useMantineTheme(); return ( 0 && !opened ? open : close} h="100%" w="100%" p={0} m={0} bd={`1cqmin solid ${opened && !disabled ? primaryColor : "transparent"}`} style={{ alignContent: "center", borderRadius: "3.5cqmin", cursor: events.length === 0 || disabled ? "default" : "pointer", }} >
{date.getDate()}
); }; interface NotificationIndicatorProps { events: CalendarEvent[]; } const NotificationIndicator = ({ events }: NotificationIndicatorProps) => { const notificationEvents = [...new Set(events.map((event) => event.links[0]?.notificationColor))].filter(String); return ( {notificationEvents.map((notificationEvent) => { return ( ); })} ); };