import { Box, Container, Flex, HoverCard, 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 board = useRequiredBoard();
const mantineTheme = useMantineTheme();
const actualItemRadius = mantineTheme.radius[board.itemRadius];
const minAxisSize = Math.min(rootWidth, rootHeight);
const shouldScaleDown = minAxisSize < 350;
const shouldShowIndicators = rootHeight >= 256;
const indicatorSize = shouldScaleDown ? 3 : 4;
const cell = (
{date.getDate()}
);
if (disabled) return cell;
return (
{cell}
);
};
interface NotificationIndicatorProps {
events: CalendarEvent[];
size: number;
visible: boolean;
}
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 (
);
})}
);
};