Skip to content

Your favorite shift management application!

fix(ui): keep split-shift chips inside their month cell

panteLxdd8d81172560
diff --git a/components/day-cell-entries.tsx b/components/day-cell-entries.tsx
index 9b0cfa3..ec7db00 100644
--- a/components/day-cell-entries.tsx
+++ b/components/day-cell-entries.tsx
@@ -2,7 +2,7 @@
import { useEffect, useMemo, useRef } from "react";
import { useTranslations } from "next-intl";
-import { CalendarClock, RefreshCw, StickyNote, UserPlus } from "lucide-react";
+import { CalendarClock, RefreshCw, Split, StickyNote, UserPlus } from "lucide-react";
import { ShiftWithCalendar } from "@/lib/types";
import { CalendarNote, ExternalSync } from "@/lib/db/schema";
import { formatDateToLocal } from "@/lib/date-utils";
@@ -204,19 +204,36 @@ function ChipTime({
stacked?: boolean;
}) {
const t = useTranslations();
+ const text = shift.isAllDay
+ ? t("calendarView.allDayShort")
+ : full
+ ? formatTimeRange(shift)
+ : shift.startTime.slice(0, 5);
+
+ if (stacked) {
+ return (
+ <span className="mt-0.5 block whitespace-normal break-words font-mono text-[10.5px] leading-4 opacity-75">
+ {text}
+ </span>
+ );
+ }
+
+ // Compact mode only shows the start time, same as any other shift; the icon is what signals "split"
+ const isSplit = !full && !shift.isAllDay && (shift.segments?.length ?? 0) > 0;
return (
- <span
- className={
- stacked
- ? "mt-0.5 block whitespace-normal break-words font-mono text-[10.5px] leading-4 opacity-75"
- : "shrink-0 whitespace-nowrap font-mono text-[10.5px] leading-4 opacity-75"
- }
- >
- {shift.isAllDay
- ? t("calendarView.allDayShort")
- : full || shift.segments?.length
- ? formatTimeRange(shift)
- : shift.startTime.slice(0, 5)}
+ <span className="flex min-w-0 max-w-[45%] shrink items-center gap-0.5">
+ {isSplit && (
+ <Split
+ className="size-[9px] shrink-0 opacity-70"
+ aria-hidden="true"
+ />
+ )}
+ <span
+ className="truncate font-mono text-[10.5px] leading-4 opacity-75"
+ title={isSplit ? t("calendarView.splitShiftIndicator") : undefined}
+ >
+ {text}
+ </span>
</span>
);
}
diff --git a/messages/cs.json b/messages/cs.json
index cdb4330..c644662 100644
--- a/messages/cs.json
+++ b/messages/cs.json
@@ -712,6 +712,7 @@
"sunday": "Ne"
},
"allDayShort": "celý den",
+ "splitShiftIndicator": "Dělená směna",
"externalCount": "{count} externí",
"hasNotes": "{count, plural, one {# poznámka} few {# poznámky} other {# poznámek}}",
"shift": "Směna",
diff --git a/messages/de.json b/messages/de.json
index 9d90af8..d61c88a 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -712,6 +712,7 @@
"sunday": "So"
},
"allDayShort": "ganztg.",
+ "splitShiftIndicator": "Geteilte Schicht",
"externalCount": "{count} extern",
"hasNotes": "{count, plural, one {# Notiz} other {# Notizen}}",
"shift": "Schicht",
diff --git a/messages/en.json b/messages/en.json
index 9f66ab9..9caba43 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -712,6 +712,7 @@
"sunday": "Su"
},
"allDayShort": "all day",
+ "splitShiftIndicator": "Split shift",
"externalCount": "{count} external",
"hasNotes": "{count, plural, one {# note} other {# notes}}",
"shift": "Shift",
diff --git a/messages/es.json b/messages/es.json
index 51b85e2..5463f45 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -712,6 +712,7 @@
"sunday": "Do"
},
"allDayShort": "todo el día",
+ "splitShiftIndicator": "Turno partido",
"externalCount": "{count} externos",
"hasNotes": "{count, plural, one {# nota} other {# notas}}",
"shift": "Turno",
diff --git a/messages/fr.json b/messages/fr.json
index 1570c41..873835d 100755
--- a/messages/fr.json
+++ b/messages/fr.json
@@ -712,6 +712,7 @@
"sunday": "Di"
},
"allDayShort": "journée",
+ "splitShiftIndicator": "Garde fractionnée",
"externalCount": "{count} externes",
"hasNotes": "{count, plural, one {# note} other {# notes}}",
"shift": "Service",
diff --git a/messages/it.json b/messages/it.json
index 9b5b61e..2e2ce19 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -712,6 +712,7 @@
"sunday": "Do"
},
"allDayShort": "giornata",
+ "splitShiftIndicator": "Turno spezzato",
"externalCount": "{count} esterni",
"hasNotes": "{count, plural, one {# nota} other {# note}}",
"shift": "Turno",