From 8460ca499cea12df47a0d76508e72fb10687db3d Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Mon, 10 Nov 2025 21:15:15 +0100 Subject: [PATCH] feat: #4452 improve calendar design --- packages/widgets/src/calendar/calender-day.tsx | 18 +++++++++++++++--- packages/widgets/src/calendar/component.tsx | 10 +++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/widgets/src/calendar/calender-day.tsx b/packages/widgets/src/calendar/calender-day.tsx index 3629a937f0..4632a132d0 100644 --- a/packages/widgets/src/calendar/calender-day.tsx +++ b/packages/widgets/src/calendar/calender-day.tsx @@ -1,11 +1,17 @@ import { useState } from "react"; import { Box, Container, Flex, Popover, Text, useMantineTheme } from "@mantine/core"; +import { useElementSize } from "@mantine/hooks"; + + 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[]; @@ -17,6 +23,7 @@ interface CalendarDayProps { export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: CalendarDayProps) => { const [opened, setOpened] = useState(false); const { primaryColor } = useMantineTheme(); + const { ref, height } = useElementSize(); const board = useRequiredBoard(); const mantineTheme = useMantineTheme(); const actualItemRadius = mantineTheme.radius[board.itemRadius]; @@ -25,6 +32,8 @@ export const CalendarDay = ({ date, events, disabled, rootHeight, rootWidth }: C const shouldScaleDown = minAxisSize < 350; const isSmall = rootHeight < 256; + const isTooSmallForIndicators = height < 30; + return ( {date.getDate()} - + {!isTooSmallForIndicators && ( + + )} {/* Popover has some offset on the left side, padding is removed because of scrollarea paddings */} @@ -82,9 +94,9 @@ 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 ; + return ; })} ); diff --git a/packages/widgets/src/calendar/component.tsx b/packages/widgets/src/calendar/component.tsx index 1677b2ba29..6fc3d7966c 100644 --- a/packages/widgets/src/calendar/component.tsx +++ b/packages/widgets/src/calendar/component.tsx @@ -124,12 +124,17 @@ const CalendarBase = ({ isEditMode, events, month, setMonth, options }: Calendar }, monthCell: { textAlign: "center", + position: "relative" }, day: { borderRadius: actualItemRadius, width: "100%", height: "100%", - position: "relative", + position: "absolute", + top: 0, + left: 0, + bottom: 0, + right: 0 }, month: { height: "100%", @@ -137,6 +142,9 @@ const CalendarBase = ({ isEditMode, events, month, setMonth, options }: Calendar weekday: { padding: 0, }, + weekdaysRow: { + height: 22 + } }} renderDay={(tileDate) => { const eventsForDate = normalizedEvents