Skip to content

Your favorite shift management application!

feat: Adds day highlighting with custom weekdays & color (#90)

panteL803c3bd27f65
diff --git a/app/page.tsx b/app/page.tsx
index e045ffe..44d8858 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -832,6 +832,8 @@ function HomeContent() {
shiftSortType={viewSettings.shiftSortType}
shiftSortOrder={viewSettings.shiftSortOrder}
combinedSortMode={viewSettings.combinedSortMode}
+ highlightedWeekdays={viewSettings.highlightedWeekdays}
+ highlightColor={viewSettings.highlightColor}
statsRefreshTrigger={statsRefreshTrigger}
locale={dateLocale}
onDayClick={handleCompareDayClick}
@@ -1040,6 +1042,11 @@ function HomeContent() {
handleShiftSortOrderChange: viewSettings.handleShiftSortOrderChange,
handleCombinedSortModeChange:
viewSettings.handleCombinedSortModeChange,
+ handleHighlightWeekendsChange:
+ viewSettings.handleHighlightWeekendsChange,
+ handleHighlightedWeekdaysChange:
+ viewSettings.handleHighlightedWeekdaysChange,
+ handleHighlightColorChange: viewSettings.handleHighlightColorChange,
}}
showNoteDialog={noteActions.showNoteDialog}
onNoteDialogChange={noteActions.handleNoteDialogChange}
@@ -1158,6 +1165,8 @@ function HomeContent() {
shiftSortType={viewSettings.shiftSortType}
shiftSortOrder={viewSettings.shiftSortOrder}
combinedSortMode={viewSettings.combinedSortMode}
+ highlightedWeekdays={viewSettings.highlightedWeekdays}
+ highlightColor={viewSettings.highlightColor}
selectedCalendar={selectedCalendar || null}
statsRefreshTrigger={statsRefreshTrigger}
shouldHideUIElements={shouldHideUIElements}
@@ -1248,6 +1257,11 @@ function HomeContent() {
handleShiftSortOrderChange: viewSettings.handleShiftSortOrderChange,
handleCombinedSortModeChange:
viewSettings.handleCombinedSortModeChange,
+ handleHighlightWeekendsChange:
+ viewSettings.handleHighlightWeekendsChange,
+ handleHighlightedWeekdaysChange:
+ viewSettings.handleHighlightedWeekdaysChange,
+ handleHighlightColorChange: viewSettings.handleHighlightColorChange,
}}
showNoteDialog={noteActions.showNoteDialog}
onNoteDialogChange={noteActions.handleNoteDialogChange}
diff --git a/components/calendar-compare-view.tsx b/components/calendar-compare-view.tsx
index 276d967..5b5d684 100644
--- a/components/calendar-compare-view.tsx
+++ b/components/calendar-compare-view.tsx
@@ -34,6 +34,8 @@ interface CalendarCompareViewProps {
shiftSortType: "startTime" | "createdAt" | "title";
shiftSortOrder: "asc" | "desc";
combinedSortMode: boolean;
+ highlightedWeekdays?: number[];
+ highlightColor?: string;
statsRefreshTrigger: number;
locale?: Locale;
onDayClick: (calendarId: string, date: Date) => void;
@@ -283,6 +285,8 @@ export function CalendarCompareView(props: CalendarCompareViewProps) {
shiftSortType={props.shiftSortType}
shiftSortOrder={props.shiftSortOrder}
combinedSortMode={props.combinedSortMode}
+ highlightedWeekdays={props.highlightedWeekdays}
+ highlightColor={props.highlightColor}
selectedCalendar={calendar.id}
statsRefreshTrigger={props.statsRefreshTrigger}
shouldHideUIElements={false}
diff --git a/components/calendar-content.tsx b/components/calendar-content.tsx
index 5606c87..1470557 100644
--- a/components/calendar-content.tsx
+++ b/components/calendar-content.tsx
@@ -25,6 +25,8 @@ interface CalendarContentProps {
shiftSortType: "startTime" | "createdAt" | "title";
shiftSortOrder: "asc" | "desc";
combinedSortMode: boolean;
+ highlightedWeekdays?: number[];
+ highlightColor?: string;
selectedCalendar: string | null;
statsRefreshTrigger: number;
shouldHideUIElements: boolean;
@@ -64,6 +66,8 @@ export function CalendarContent(props: CalendarContentProps) {
shiftSortType={props.shiftSortType}
shiftSortOrder={props.shiftSortOrder}
combinedSortMode={props.combinedSortMode}
+ highlightedWeekdays={props.highlightedWeekdays}
+ highlightColor={props.highlightColor}
onDayClick={props.onDayClick}
onDayRightClick={props.onDayRightClick}
onNoteIconClick={props.onNoteIconClick}
diff --git a/components/calendar-grid.tsx b/components/calendar-grid.tsx
index ddea41f..e279346 100644
--- a/components/calendar-grid.tsx
+++ b/components/calendar-grid.tsx
@@ -23,6 +23,8 @@ interface CalendarGridProps {
shiftSortType?: "startTime" | "createdAt" | "title"; // sort type
shiftSortOrder?: "asc" | "desc"; // sort order
combinedSortMode?: boolean; // sort all shifts together or separately
+ highlightedWeekdays?: number[]; // weekdays to highlight (0=Sunday, 6=Saturday)
+ highlightColor?: string; // color for highlighted days
onDayClick: (date: Date) => void;
onDayRightClick?: (e: React.MouseEvent, date: Date) => void;
onNoteIconClick?: (e: React.MouseEvent, date: Date) => void;
@@ -46,6 +48,8 @@ export function CalendarGrid({
shiftSortType = "createdAt",
shiftSortOrder = "asc",
combinedSortMode = false,
+ highlightedWeekdays = [],
+ highlightColor = "#fbbf24",
onDayClick,
onDayRightClick,
onNoteIconClick,
@@ -149,6 +153,10 @@ export function CalendarGrid({
}
};
+ const isHighlighted =
+ highlightedWeekdays.length > 0 &&
+ highlightedWeekdays.includes(day.getDay());
+
return (
<motion.button
key={idx}
@@ -168,6 +176,11 @@ export function CalendarGrid({
WebkitUserSelect: "none",
userSelect: "none",
WebkitTouchCallout: "none",
+ ...(isHighlighted &&
+ !isTodayDate && {
+ backgroundColor: `${highlightColor}15`,
+ borderColor: `${highlightColor}40`,
+ }),
}}
className={`
min-h-25 sm:min-h-28 px-1 py-1.5 sm:p-2.5 rounded-md sm:rounded-lg text-sm transition-all relative flex flex-col border sm:border-2
diff --git a/components/dialog-manager.tsx b/components/dialog-manager.tsx
index 25846f3..b79c63e 100644
--- a/components/dialog-manager.tsx
+++ b/components/dialog-manager.tsx
@@ -76,6 +76,9 @@ interface DialogManagerProps {
shiftSortType: "startTime" | "createdAt" | "title";
shiftSortOrder: "asc" | "desc";
combinedSortMode: boolean;
+ highlightWeekends: boolean;
+ highlightedWeekdays: number[];
+ highlightColor: string;
};
onViewSettingsChange: {
handleShiftsPerDayChange: (count: number | null) => void;
@@ -87,6 +90,9 @@ interface DialogManagerProps {
) => void;
handleShiftSortOrderChange: (order: "asc" | "desc") => void;
handleCombinedSortModeChange: (combined: boolean) => void;
+ handleHighlightWeekendsChange: (highlight: boolean) => void;
+ handleHighlightedWeekdaysChange: (days: number[]) => void;
+ handleHighlightColorChange: (color: string) => void;
};
// Note Dialog
@@ -198,6 +204,9 @@ export function DialogManager(props: DialogManagerProps) {
shiftSortType={props.viewSettings.shiftSortType}
shiftSortOrder={props.viewSettings.shiftSortOrder}
combinedSortMode={props.viewSettings.combinedSortMode}
+ highlightWeekends={props.viewSettings.highlightWeekends}
+ highlightedWeekdays={props.viewSettings.highlightedWeekdays}
+ highlightColor={props.viewSettings.highlightColor}
onShiftsPerDayChange={
props.onViewSettingsChange.handleShiftsPerDayChange
}
@@ -219,6 +228,15 @@ export function DialogManager(props: DialogManagerProps) {
onCombinedSortModeChange={
props.onViewSettingsChange.handleCombinedSortModeChange
}
+ onHighlightWeekendsChange={
+ props.onViewSettingsChange.handleHighlightWeekendsChange
+ }
+ onHighlightedWeekdaysChange={
+ props.onViewSettingsChange.handleHighlightedWeekdaysChange
+ }
+ onHighlightColorChange={
+ props.onViewSettingsChange.handleHighlightColorChange
+ }
/>
<NoteSheet
diff --git a/components/view-settings-sheet.tsx b/components/view-settings-sheet.tsx
index 368cf2f..6f339d1 100644
--- a/components/view-settings-sheet.tsx
+++ b/components/view-settings-sheet.tsx
@@ -18,7 +18,14 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { Maximize2, FileText, Infinity, ArrowUpDown } from "lucide-react";
+import {
+ Maximize2,
+ FileText,
+ Infinity,
+ ArrowUpDown,
+ Highlighter,
+} from "lucide-react";
+import { PRESET_COLORS } from "@/lib/constants";
interface ViewSettingsSheetProps {
open: boolean;
@@ -30,6 +37,9 @@ interface ViewSettingsSheetProps {
shiftSortType: "startTime" | "createdAt" | "title";
shiftSortOrder: "asc" | "desc";
combinedSortMode: boolean;
+ highlightWeekends: boolean;
+ highlightedWeekdays: number[];
+ highlightColor: string;
onShiftsPerDayChange: (count: number | null) => void;
onExternalShiftsPerDayChange: (count: number | null) => void;
onShowShiftNotesChange: (show: boolean) => void;
@@ -37,6 +47,9 @@ interface ViewSettingsSheetProps {
onShiftSortTypeChange: (type: "startTime" | "createdAt" | "title") => void;
onShiftSortOrderChange: (order: "asc" | "desc") => void;
onCombinedSortModeChange: (combined: boolean) => void;
+ onHighlightWeekendsChange: (highlight: boolean) => void;
+ onHighlightedWeekdaysChange: (days: number[]) => void;
+ onHighlightColorChange: (color: string) => void;
}
export function ViewSettingsSheet({
@@ -49,6 +62,9 @@ export function ViewSettingsSheet({
shiftSortType,
shiftSortOrder,
combinedSortMode,
+ highlightWeekends,
+ highlightedWeekdays,
+ highlightColor,
onShiftsPerDayChange,
onExternalShiftsPerDayChange,
onShowShiftNotesChange,
@@ -56,6 +72,9 @@ export function ViewSettingsSheet({
onShiftSortTypeChange,
onShiftSortOrderChange,
onCombinedSortModeChange,
+ onHighlightWeekendsChange,
+ onHighlightedWeekdaysChange,
+ onHighlightColorChange,
}: ViewSettingsSheetProps) {
const t = useTranslations();
@@ -304,6 +323,139 @@ export function ViewSettingsSheet({
</div>
</div>
</div>
+
+ {/* Day Highlighting */}
+ <div className="space-y-4">
+ <div className="flex items-center gap-2">
+ <Highlighter className="h-4 w-4 text-primary" />
+ <Label className="text-sm font-semibold">
+ {t("view.dayHighlighting")}
+ </Label>
+ </div>
+ <div className="space-y-4 pl-6 border-l-2 border-border/50">
+ {/* Quick Toggle: Weekends */}
+ <div className="flex items-start gap-3">
+ <Checkbox
+ id="highlight-weekends"
+ checked={highlightWeekends}
+ onCheckedChange={(checked: boolean) => {
+ onHighlightWeekendsChange(checked);
+ if (checked) {
+ // Add Saturday (6) and Sunday (0) to existing weekdays
+ const newDays = Array.from(
+ new Set([...highlightedWeekdays, 0, 6])
+ ).sort((a, b) => a - b);
+ onHighlightedWeekdaysChange(newDays);
+ } else {
+ // Remove Saturday and Sunday, keep other weekdays
+ const filtered = highlightedWeekdays.filter(
+ (d) => d !== 0 && d !== 6
+ );
+ onHighlightedWeekdaysChange(filtered);
+ }
+ }}
+ className="mt-0.5"
+ />
+ <div className="flex-1 space-y-1">
+ <Label
+ htmlFor="highlight-weekends"
+ className="text-sm font-medium cursor-pointer"
+ >
+ {t("view.highlightWeekends")}
+ </Label>
+ <p className="text-xs text-muted-foreground">
+ {t("view.highlightWeekendsHint")}
+ </p>
+ </div>
+ </div>
+
+ {/* Custom Weekdays */}
+ <div className="space-y-2">
+ <Label className="text-xs text-muted-foreground">
+ {t("view.customWeekdays")}
+ </Label>
+ <div className="grid grid-cols-7 gap-1">
+ {[
+ { day: 1, label: t("view.monday") },
+ { day: 2, label: t("view.tuesday") },
+ { day: 3, label: t("view.wednesday") },
+ { day: 4, label: t("view.thursday") },
+ { day: 5, label: t("view.friday") },
+ { day: 6, label: t("view.saturday") },
+ { day: 0, label: t("view.sunday") },
+ ].map(({ day, label }) => {
+ const isSelected = highlightedWeekdays.includes(day);
+ return (
+ <button
+ key={day}
+ type="button"
+ onClick={() => {
+ const newDays = isSelected
+ ? highlightedWeekdays.filter((d) => d !== day)
+ : [...highlightedWeekdays, day];
+ onHighlightedWeekdaysChange(newDays);
+
+ // Update weekends toggle state
+ const hasWeekends =
+ newDays.includes(0) && newDays.includes(6);
+ if (hasWeekends !== highlightWeekends) {
+ onHighlightWeekendsChange(hasWeekends);
+ }
+ }}
+ className={`
+ px-1 py-2 text-xs font-medium rounded-md transition-all border-2
+ ${
+ isSelected
+ ? "bg-primary/20 border-primary text-primary"
+ : "bg-muted/30 border-border/30 text-muted-foreground hover:bg-muted/50"
+ }
+ `}
+ title={label}
+ >
+ {label.substring(0, 2)}
+ </button>
+ );
+ })}
+ </div>
+ <p className="text-xs text-muted-foreground">
+ {t("view.customWeekdaysHint")}
+ </p>
+ </div>
+
+ {/* Highlight Color */}
+ <div className="space-y-2">
+ <Label className="text-xs text-muted-foreground">
+ {t("view.highlightColor")}
+ </Label>
+ <div className="grid grid-cols-4 gap-2">
+ {PRESET_COLORS.map((color) => (
+ <button
+ key={color.value}
+ type="button"
+ onClick={() => onHighlightColorChange(color.value)}
+ className={`
+ h-10 rounded-lg border-2 transition-all
+ ${
+ highlightColor === color.value
+ ? "border-foreground ring-2 ring-foreground/20 scale-105"
+ : "border-border/30 hover:border-border"
+ }
+ `}
+ style={{
+ backgroundColor: `${color.value}20`,
+ }}
+ title={color.name}
+ >
+ <div
+ className="h-4 w-4 rounded-full mx-auto"
+ style={{ backgroundColor: color.value }}
+ />
+ </button>
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
</div>
</SheetContent>
</Sheet>
diff --git a/hooks/useViewSettings.ts b/hooks/useViewSettings.ts
index ea2aba7..af6abc8 100644
--- a/hooks/useViewSettings.ts
+++ b/hooks/useViewSettings.ts
@@ -85,6 +85,38 @@ export function useViewSettings() {
return false;
});
+ const [highlightWeekends, setHighlightWeekends] = useState<boolean>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("highlight-weekends");
+ return stored === "true";
+ }
+ return false;
+ });
+
+ const [highlightedWeekdays, setHighlightedWeekdays] = useState<number[]>(
+ () => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("highlighted-weekdays");
+ if (stored) {
+ try {
+ return JSON.parse(stored);
+ } catch {
+ return [];
+ }
+ }
+ }
+ return [];
+ }
+ );
+
+ const [highlightColor, setHighlightColor] = useState<string>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("highlight-color");
+ if (stored) return stored;
+ }
+ return "#fbbf24"; // Default amber
+ });
+
const handleShiftsPerDayChange = useCallback((count: number | null) => {
setShiftsPerDay(count);
if (typeof window !== "undefined") {
@@ -153,6 +185,27 @@ export function useViewSettings() {
}
}, []);
+ const handleHighlightWeekendsChange = useCallback((highlight: boolean) => {
+ setHighlightWeekends(highlight);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("highlight-weekends", highlight.toString());
+ }
+ }, []);
+
+ const handleHighlightedWeekdaysChange = useCallback((days: number[]) => {
+ setHighlightedWeekdays(days);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("highlighted-weekdays", JSON.stringify(days));
+ }
+ }, []);
+
+ const handleHighlightColorChange = useCallback((color: string) => {
+ setHighlightColor(color);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("highlight-color", color);
+ }
+ }, []);
+
return {
shiftsPerDay,
externalShiftsPerDay,
@@ -162,6 +215,9 @@ export function useViewSettings() {
shiftSortOrder,
combinedSortMode,
hidePresetHeader,
+ highlightWeekends,
+ highlightedWeekdays,
+ highlightColor,
handleShiftsPerDayChange,
handleExternalShiftsPerDayChange,
handleShowShiftNotesChange,
@@ -170,5 +226,8 @@ export function useViewSettings() {
handleShiftSortOrderChange,
handleCombinedSortModeChange,
handleHidePresetHeaderChange,
+ handleHighlightWeekendsChange,
+ handleHighlightedWeekdaysChange,
+ handleHighlightColorChange,
};
}
diff --git a/messages/de.json b/messages/de.json
index 6d1615e..688e9e7 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -189,7 +189,20 @@
"showNotes": "Schichtnotizen anzeigen",
"showNotesHint": "Notizen der Schichten im Kalender anzeigen",
"showFullTitles": "Vollständige Schichttitel anzeigen",
- "showFullTitlesHint": "Schichttitel vollständig ohne Kürzung anzeigen"
+ "showFullTitlesHint": "Schichttitel vollständig ohne Kürzung anzeigen",
+ "dayHighlighting": "Tage hervorheben",
+ "highlightWeekends": "Wochenenden hervorheben",
+ "highlightWeekendsHint": "Samstage und Sonntage farbig hervorheben",
+ "customWeekdays": "Eigene Wochentage",
+ "customWeekdaysHint": "Wähle einzelne Wochentage zum Hervorheben aus",
+ "monday": "Montag",
+ "tuesday": "Dienstag",
+ "wednesday": "Mittwoch",
+ "thursday": "Donnerstag",
+ "friday": "Freitag",
+ "saturday": "Samstag",
+ "sunday": "Sonntag",
+ "highlightColor": "Hervorhebungsfarbe"
},
"stats": {
"title": "Schichtenstatistik",
diff --git a/messages/en.json b/messages/en.json
index 9f8950a..99a9c38 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -189,7 +189,20 @@
"showNotes": "Show shift notes",
"showNotesHint": "Display shift notes in calendar grid",
"showFullTitles": "Show full shift titles",
- "showFullTitlesHint": "Display complete shift titles without truncation"
+ "showFullTitlesHint": "Display complete shift titles without truncation",
+ "dayHighlighting": "Day Highlighting",
+ "highlightWeekends": "Highlight Weekends",
+ "highlightWeekendsHint": "Highlight Saturdays and Sundays with color",
+ "customWeekdays": "Custom Weekdays",
+ "customWeekdaysHint": "Select individual weekdays to highlight",
+ "monday": "Monday",
+ "tuesday": "Tuesday",
+ "wednesday": "Wednesday",
+ "thursday": "Thursday",
+ "friday": "Friday",
+ "saturday": "Saturday",
+ "sunday": "Sunday",
+ "highlightColor": "Highlight Color"
},
"stats": {
"title": "Shift Statistics",
diff --git a/messages/it.json b/messages/it.json
index 3ed344b..03f1924 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -189,7 +189,20 @@
"showNotes": "Mostra note turni",
"showNotesHint": "Visualizza note dei turni nella griglia calendario",
"showFullTitles": "Mostra titoli completi",
- "showFullTitlesHint": "Visualizza titoli completi dei turni senza troncamento"
+ "showFullTitlesHint": "Visualizza titoli completi dei turni senza troncamento",
+ "dayHighlighting": "Evidenziazione Giorni",
+ "highlightWeekends": "Evidenzia Fine Settimana",
+ "highlightWeekendsHint": "Evidenzia sabato e domenica con colore",
+ "customWeekdays": "Giorni della Settimana Personalizzati",
+ "customWeekdaysHint": "Seleziona singoli giorni della settimana da evidenziare",
+ "monday": "Lunedì",
+ "tuesday": "Martedì",
+ "wednesday": "Mercoledì",
+ "thursday": "Giovedì",
+ "friday": "Venerdì",
+ "saturday": "Sabato",
+ "sunday": "Domenica",
+ "highlightColor": "Colore Evidenziazione"
},
"stats": {
"title": "Statistiche Turni",