Skip to content

Your favorite shift management application!

feat: add iCloud sync display modes and manage visibility options (#8)

panteL5e59f22be831
diff --git a/app/api/icloud-syncs/[id]/route.ts b/app/api/icloud-syncs/[id]/route.ts
index 4184e13..dbdd625 100644
--- a/app/api/icloud-syncs/[id]/route.ts
+++ b/app/api/icloud-syncs/[id]/route.ts
@@ -44,7 +44,8 @@ export async function PATCH(
try {
const { id } = await params;
const body = await request.json();
- const { name, icloudUrl, color } = body;
+ const { name, icloudUrl, color, displayMode, isHidden, hideFromStats } =
+ body;
// Validate iCloud URL if provided
if (icloudUrl !== undefined && !isValidICloudUrl(icloudUrl)) {
@@ -64,6 +65,9 @@ export async function PATCH(
if (name !== undefined) updateData.name = name;
if (icloudUrl !== undefined) updateData.icloudUrl = icloudUrl;
if (color !== undefined) updateData.color = color;
+ if (displayMode !== undefined) updateData.displayMode = displayMode;
+ if (isHidden !== undefined) updateData.isHidden = isHidden;
+ if (hideFromStats !== undefined) updateData.hideFromStats = hideFromStats;
const [updated] = await db
.update(icloudSyncs)
@@ -97,6 +101,16 @@ export async function PATCH(
});
}
+ // Emit event to notify clients about visibility changes
+ if (isHidden !== undefined || hideFromStats !== undefined) {
+ eventEmitter.emit("calendar-change", {
+ type: "shift",
+ action: "update",
+ calendarId: updated.calendarId,
+ data: { icloudSyncId: id, visibilityUpdated: true },
+ });
+ }
+
return NextResponse.json(updated);
} catch (error) {
console.error("Failed to update iCloud sync:", error);
diff --git a/app/api/icloud-syncs/route.ts b/app/api/icloud-syncs/route.ts
index 1f222b7..a268591 100644
--- a/app/api/icloud-syncs/route.ts
+++ b/app/api/icloud-syncs/route.ts
@@ -37,7 +37,7 @@ export async function GET(request: Request) {
export async function POST(request: Request) {
try {
const body = await request.json();
- const { calendarId, name, icloudUrl, color } = body;
+ const { calendarId, name, icloudUrl, color, displayMode } = body;
if (!calendarId || !name || !icloudUrl) {
return NextResponse.json(
@@ -65,6 +65,7 @@ export async function POST(request: Request) {
name,
icloudUrl,
color: color || "#3b82f6",
+ displayMode: displayMode || "normal",
createdAt: new Date(),
updatedAt: new Date(),
})
diff --git a/app/api/shifts/route.ts b/app/api/shifts/route.ts
index 936aeba..a1f4c03 100644
--- a/app/api/shifts/route.ts
+++ b/app/api/shifts/route.ts
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import { db } from "@/lib/db";
-import { calendars, shifts } from "@/lib/db/schema";
-import { eq, and, gte, lte } from "drizzle-orm";
+import { calendars, shifts, icloudSyncs } from "@/lib/db/schema";
+import { eq, and, gte, lte, or, isNull } from "drizzle-orm";
import { eventEmitter, CalendarChangeEvent } from "@/lib/event-emitter";
// GET shifts for a calendar (with optional date filter)
@@ -30,6 +30,7 @@ export async function GET(request: Request) {
notes: shifts.notes,
isAllDay: shifts.isAllDay,
isSecondary: shifts.isSecondary,
+ syncedFromIcloud: shifts.syncedFromIcloud,
icloudSyncId: shifts.icloudSyncId,
createdAt: shifts.createdAt,
updatedAt: shifts.updatedAt,
@@ -40,7 +41,8 @@ export async function GET(request: Request) {
},
})
.from(shifts)
- .leftJoin(calendars, eq(shifts.calendarId, calendars.id));
+ .leftJoin(calendars, eq(shifts.calendarId, calendars.id))
+ .leftJoin(icloudSyncs, eq(shifts.icloudSyncId, icloudSyncs.id));
if (date) {
const targetDate = new Date(date);
@@ -51,13 +53,21 @@ export async function GET(request: Request) {
and(
eq(shifts.calendarId, calendarId),
gte(shifts.date, startOfDay),
- lte(shifts.date, endOfDay)
+ lte(shifts.date, endOfDay),
+ // Exclude shifts from hidden iCloud syncs (or shifts that are not synced)
+ or(isNull(shifts.icloudSyncId), eq(icloudSyncs.isHidden, false))
)
);
return NextResponse.json(result);
}
- const result = await query.where(eq(shifts.calendarId, calendarId));
+ const result = await query.where(
+ and(
+ eq(shifts.calendarId, calendarId),
+ // Exclude shifts from hidden iCloud syncs (or shifts that are not synced)
+ or(isNull(shifts.icloudSyncId), eq(icloudSyncs.isHidden, false))
+ )
+ );
return NextResponse.json(result);
} catch (error) {
console.error("Failed to fetch shifts:", error);
diff --git a/app/api/shifts/stats/route.ts b/app/api/shifts/stats/route.ts
index 22b5ea9..847352f 100644
--- a/app/api/shifts/stats/route.ts
+++ b/app/api/shifts/stats/route.ts
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server";
import { db } from "@/lib/db";
-import { shifts } from "@/lib/db/schema";
-import { eq, and, gte, lte, sql } from "drizzle-orm";
+import { shifts, icloudSyncs } from "@/lib/db/schema";
+import { eq, and, gte, lte, sql, or, isNull } from "drizzle-orm";
import {
startOfWeek,
endOfWeek,
@@ -48,18 +48,27 @@ export async function GET(request: Request) {
break;
}
- // Fetch shifts for the period
+ // Fetch shifts for the period, excluding shifts from iCloud syncs that are hidden or hidden from stats
const result = await db
.select({
title: shifts.title,
count: sql<number>`count(*)`.as("count"),
})
.from(shifts)
+ .leftJoin(icloudSyncs, eq(shifts.icloudSyncId, icloudSyncs.id))
.where(
and(
eq(shifts.calendarId, calendarId),
gte(shifts.date, startDate),
- lte(shifts.date, endDate)
+ lte(shifts.date, endDate),
+ // Exclude shifts from iCloud syncs that are hidden or hidden from stats
+ or(
+ isNull(shifts.icloudSyncId),
+ and(
+ eq(icloudSyncs.isHidden, false),
+ eq(icloudSyncs.hideFromStats, false)
+ )
+ )
)
)
.groupBy(shifts.title)
diff --git a/app/page.tsx b/app/page.tsx
index d03ecc0..4cd768e 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState, useEffect, Suspense } from "react";
+import { useState, useEffect, useCallback, Suspense } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useTranslations, useLocale } from "next-intl";
import { CalendarDialog } from "@/components/calendar-dialog";
@@ -10,6 +10,7 @@ import { ManagePasswordDialog } from "@/components/manage-password-dialog";
import { DeleteCalendarDialog } from "@/components/delete-calendar-dialog";
import { ICloudSyncManageDialog } from "@/components/icloud-sync-manage-dialog";
import { DayShiftsDialog } from "@/components/day-shifts-dialog";
+import { SyncedShiftsDialog } from "@/components/synced-shifts-dialog";
import { LanguageSwitcher } from "@/components/language-switcher";
import { ShiftStats } from "@/components/shift-stats";
import { NoteDialog } from "@/components/note-dialog";
@@ -36,7 +37,7 @@ import {
endOfWeek,
} from "date-fns";
import { de, enUS } from "date-fns/locale";
-import { CalendarNote, ShiftPreset } from "@/lib/db/schema";
+import { CalendarNote, ShiftPreset, ICloudSync } from "@/lib/db/schema";
import { ShiftWithCalendar } from "@/lib/types";
import { formatDateToLocal } from "@/lib/date-utils";
import { toast } from "sonner";
@@ -84,6 +85,33 @@ function HomeContent() {
refetchNotes,
} = useNotes(selectedCalendar);
+ // iCloud Syncs state
+ const [icloudSyncs, setIcloudSyncs] = useState<ICloudSync[]>([]);
+
+ // Fetch iCloud syncs for the calendar
+ const fetchICloudSyncs = useCallback(async () => {
+ if (!selectedCalendar) {
+ setIcloudSyncs([]);
+ return;
+ }
+
+ try {
+ const response = await fetch(
+ `/api/icloud-syncs?calendarId=${selectedCalendar}`
+ );
+ if (response.ok) {
+ const data = await response.json();
+ setIcloudSyncs(data);
+ }
+ } catch (error) {
+ console.error("Failed to fetch iCloud syncs:", error);
+ }
+ }, [selectedCalendar]);
+
+ useEffect(() => {
+ fetchICloudSyncs();
+ }, [fetchICloudSyncs]);
+
// Local state
const [selectedPresetId, setSelectedPresetId] = useState<
string | undefined
@@ -102,10 +130,14 @@ function HomeContent() {
useState(false);
const [showICloudSyncDialog, setShowICloudSyncDialog] = useState(false);
const [showDayShiftsDialog, setShowDayShiftsDialog] = useState(false);
+ const [showSyncedShiftsDialog, setShowSyncedShiftsDialog] = useState(false);
const [selectedDayDate, setSelectedDayDate] = useState<Date | null>(null);
const [selectedDayShifts, setSelectedDayShifts] = useState<
ShiftWithCalendar[]
>([]);
+ const [selectedSyncedShifts, setSelectedSyncedShifts] = useState<
+ ShiftWithCalendar[]
+ >([]);
const [calendarToDelete, setCalendarToDelete] = useState<
string | undefined
>();
@@ -449,6 +481,15 @@ function HomeContent() {
setShowDayShiftsDialog(true);
};
+ const handleShowSyncedShifts = (
+ date: Date,
+ syncedShifts: ShiftWithCalendar[]
+ ) => {
+ setSelectedDayDate(date);
+ setSelectedSyncedShifts(syncedShifts);
+ setShowSyncedShiftsDialog(true);
+ };
+
const handleDeleteShiftFromDayDialog = async (shiftId: string) => {
setShowDayShiftsDialog(false);
await handleDeleteShift(shiftId);
@@ -719,11 +760,13 @@ function HomeContent() {
notes={notes}
selectedPresetId={selectedPresetId}
togglingDates={togglingDates}
+ icloudSyncs={icloudSyncs}
onDayClick={handleDayClick}
onDayRightClick={handleDayRightClick}
onNoteIconClick={handleNoteIconClick}
onLongPress={handleLongPressDay}
onShowAllShifts={handleShowAllShifts}
+ onShowSyncedShifts={handleShowSyncedShifts}
/>
{/* Note Hint */}
@@ -859,6 +902,8 @@ function HomeContent() {
refetchShifts();
refetchCalendars();
setStatsRefreshTrigger((prev) => prev + 1);
+ // Refetch iCloud syncs to get updated displayMode
+ fetchICloudSyncs();
}}
/>
)}
@@ -873,6 +918,14 @@ function HomeContent() {
onDeleteShift={handleDeleteShiftFromDayDialog}
/>
+ {/* Synced Shifts Dialog */}
+ <SyncedShiftsDialog
+ open={showSyncedShiftsDialog}
+ onOpenChange={setShowSyncedShiftsDialog}
+ date={selectedDayDate}
+ shifts={selectedSyncedShifts}
+ />
+
{/* Footer */}
<div className="border-t bg-background mt-auto">
<div className="container max-w-4xl mx-auto p-3 sm:p-4 flex justify-between items-center">
diff --git a/components/calendar-grid.tsx b/components/calendar-grid.tsx
index cc63a8f..82bc300 100644
--- a/components/calendar-grid.tsx
+++ b/components/calendar-grid.tsx
@@ -1,7 +1,7 @@
import { motion } from "motion/react";
import { StickyNote } from "lucide-react";
import { ShiftWithCalendar } from "@/lib/types";
-import { CalendarNote } from "@/lib/db/schema";
+import { CalendarNote, ICloudSync } from "@/lib/db/schema";
import { isToday } from "date-fns";
import { useTranslations } from "next-intl";
import { useRef, useEffect } from "react";
@@ -14,11 +14,13 @@ interface CalendarGridProps {
notes: CalendarNote[];
selectedPresetId: string | undefined;
togglingDates: Set<string>;
+ icloudSyncs: ICloudSync[];
onDayClick: (date: Date) => void;
onDayRightClick: (e: React.MouseEvent, date: Date) => void;
onNoteIconClick: (e: React.MouseEvent, date: Date) => void;
onLongPress: (date: Date) => void;
onShowAllShifts?: (date: Date, shifts: ShiftWithCalendar[]) => void;
+ onShowSyncedShifts?: (date: Date, shifts: ShiftWithCalendar[]) => void;
}
export function CalendarGrid({
@@ -28,11 +30,13 @@ export function CalendarGrid({
notes,
selectedPresetId,
togglingDates,
+ icloudSyncs,
onDayClick,
onDayRightClick,
onNoteIconClick,
onLongPress,
onShowAllShifts,
+ onShowSyncedShifts,
}: CalendarGridProps) {
const t = useTranslations();
const pressTimerRef = useRef<Record<string, NodeJS.Timeout>>({});
@@ -166,53 +170,130 @@ export function CalendarGrid({
)}
</div>
<div className="flex-1 space-y-0.5 sm:space-y-1 overflow-hidden">
- {dayShifts.slice(0, 2).map((shift) => (
- <div
- key={shift.id}
- className="text-[10px] sm:text-xs px-0.5 py-0.5 sm:px-1.5 sm:py-1 rounded"
- style={{
- backgroundColor: shift.color
- ? `${shift.color}20`
- : "#3b82f620",
- borderLeft: `2px solid ${shift.color || "#3b82f6"}`,
- }}
- title={`${shift.title} ${
- shift.isAllDay
- ? `(${t("shift.allDay")})`
- : `(${shift.startTime} - ${shift.endTime})`
- }`}
- >
- <div className="font-semibold line-clamp-2 leading-[1.1] sm:leading-tight">
- {shift.title}
- </div>
- <div className="text-[9px] sm:text-[10px] opacity-70 leading-tight">
- {shift.isAllDay ? (
- t("shift.allDay")
- ) : (
- <>
- <span className="sm:hidden">
- {shift.startTime.substring(0, 5)}
- </span>
- <span className="hidden sm:inline">
- {shift.startTime.substring(0, 5)} -{" "}
- {shift.endTime.substring(0, 5)}
- </span>
- </>
+ {(() => {
+ // Separate shifts by sync displayMode
+ const syncedShiftsByMode: {
+ [key: string]: ShiftWithCalendar[];
+ } = {};
+
+ dayShifts.forEach((shift) => {
+ if (shift.syncedFromIcloud && shift.icloudSyncId) {
+ const sync = icloudSyncs.find(
+ (s) => s.id === shift.icloudSyncId
+ );
+ const displayMode = sync?.displayMode || "normal";
+
+ if (displayMode === "minimal") {
+ if (!syncedShiftsByMode[shift.icloudSyncId]) {
+ syncedShiftsByMode[shift.icloudSyncId] = [];
+ }
+ syncedShiftsByMode[shift.icloudSyncId].push(shift);
+ }
+ }
+ });
+
+ // Get shifts to display normally (regular + synced with normal mode)
+ const normalDisplayShifts = dayShifts.filter((s) => {
+ if (!s.syncedFromIcloud) return true;
+ if (!s.icloudSyncId) return true;
+ const sync = icloudSyncs.find(
+ (sync) => sync.id === s.icloudSyncId
+ );
+ return !sync || sync.displayMode === "normal";
+ });
+
+ return (
+ <>
+ {/* Display normal shifts (first 2) */}
+ {normalDisplayShifts.slice(0, 2).map((shift) => (
+ <div
+ key={shift.id}
+ className="text-[10px] sm:text-xs px-0.5 py-0.5 sm:px-1.5 sm:py-1 rounded"
+ style={{
+ backgroundColor: shift.color
+ ? `${shift.color}20`
+ : "#3b82f620",
+ borderLeft: `2px solid ${shift.color || "#3b82f6"}`,
+ }}
+ title={`${shift.title} ${
+ shift.isAllDay
+ ? `(${t("shift.allDay")})`
+ : `(${shift.startTime} - ${shift.endTime})`
+ }`}
+ >
+ <div className="font-semibold line-clamp-2 leading-[1.1] sm:leading-tight">
+ {shift.title}
+ </div>
+ <div className="text-[9px] sm:text-[10px] opacity-70 leading-tight">
+ {shift.isAllDay ? (
+ t("shift.allDay")
+ ) : (
+ <>
+ <span className="sm:hidden">
+ {shift.startTime.substring(0, 5)}
+ </span>
+ <span className="hidden sm:inline">
+ {shift.startTime.substring(0, 5)} -{" "}
+ {shift.endTime.substring(0, 5)}
+ </span>
+ </>
+ )}
+ </div>
+ </div>
+ ))}
+
+ {/* Show "+X more" for normal display shifts if more than 2 */}
+ {normalDisplayShifts.length > 2 && (
+ <div
+ onClick={(e) => {
+ if (selectedPresetId) return;
+ e.stopPropagation();
+ onShowAllShifts?.(day, normalDisplayShifts);
+ }}
+ className={`text-[10px] sm:text-xs text-primary font-semibold text-center pt-0.5 transition-colors ${
+ selectedPresetId
+ ? "cursor-not-allowed opacity-50"
+ : "hover:text-primary/80 hover:underline cursor-pointer"
+ }`}
+ >
+ +{normalDisplayShifts.length - 2}
+ </div>
)}
- </div>
- </div>
- ))}
- {dayShifts.length > 2 && (
- <div
- onClick={(e) => {
- e.stopPropagation();
- onShowAllShifts?.(day, dayShifts);
- }}
- className="text-[10px] sm:text-xs text-primary hover:text-primary/80 font-semibold text-center pt-0.5 hover:underline transition-colors cursor-pointer"
- >
- +{dayShifts.length - 2}
- </div>
- )}
+
+ {/* Show minimal badges for each sync with minimal display mode */}
+ {Object.entries(syncedShiftsByMode).map(
+ ([syncId, syncShifts]) => {
+ const sync = icloudSyncs.find((s) => s.id === syncId);
+ if (!sync || syncShifts.length === 0) return null;
+
+ return (
+ <div
+ key={syncId}
+ onClick={(e) => {
+ if (selectedPresetId) return;
+ e.stopPropagation();
+ onShowSyncedShifts?.(day, syncShifts);
+ }}
+ className={`text-[10px] sm:text-xs px-1 py-0.5 sm:px-1.5 sm:py-1 rounded bg-muted/50 border border-border/50 text-muted-foreground transition-colors text-center ${
+ selectedPresetId
+ ? "cursor-not-allowed opacity-50"
+ : "hover:bg-muted hover:text-foreground cursor-pointer"
+ }`}
+ style={{
+ borderLeftColor: sync.color,
+ borderLeftWidth: "2px",
+ }}
+ >
+ {t("icloud.syncedShiftsCount", {
+ count: syncShifts.length,
+ })}
+ </div>
+ );
+ }
+ )}
+ </>
+ );
+ })()}
</div>
</motion.button>
);
diff --git a/components/icloud-sync-manage-dialog.tsx b/components/icloud-sync-manage-dialog.tsx
index 662f0cc..b78f527 100644
--- a/components/icloud-sync-manage-dialog.tsx
+++ b/components/icloud-sync-manage-dialog.tsx
@@ -11,6 +11,14 @@ import {
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
+import { Checkbox } from "@/components/ui/checkbox";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
import { ColorPicker } from "@/components/ui/color-picker";
import { useTranslations } from "next-intl";
import { ICloudSync } from "@/lib/db/schema";
@@ -44,6 +52,7 @@ export function ICloudSyncManageDialog({
const [formName, setFormName] = useState("");
const [formUrl, setFormUrl] = useState("");
const [formColor, setFormColor] = useState("#3b82f6");
+ const [formDisplayMode, setFormDisplayMode] = useState("normal");
const fetchSyncs = useCallback(async () => {
if (!calendarId) return;
@@ -79,6 +88,7 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
}
}, [open, calendarId, fetchSyncs]);
@@ -112,6 +122,7 @@ export function ICloudSyncManageDialog({
name: formName.trim(),
icloudUrl: formUrl.trim(),
color: formColor,
+ displayMode: formDisplayMode,
}),
});
@@ -120,8 +131,10 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
setShowAddForm(false);
await fetchSyncs();
+ onSyncComplete?.(); // Trigger refresh to update parent state
toast.success(t("icloud.createSuccess"));
// Auto-sync the newly created sync
await handleSync(newSync.id);
@@ -149,6 +162,7 @@ export function ICloudSyncManageDialog({
name: formName.trim(),
icloudUrl: formUrl.trim() || undefined,
color: formColor,
+ displayMode: formDisplayMode,
}),
});
@@ -157,8 +171,9 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
await fetchSyncs();
- onSyncComplete?.(); // Trigger refresh of shifts if color was updated
+ onSyncComplete?.(); // Trigger refresh of shifts and iCloudSyncs
toast.success(t("icloud.updateSuccess"));
} else {
const data = await response.json();
@@ -237,6 +252,7 @@ export function ICloudSyncManageDialog({
setFormName(sync.name);
setFormUrl(sync.icloudUrl);
setFormColor(sync.color);
+ setFormDisplayMode(sync.displayMode || "normal");
setShowAddForm(false);
};
@@ -245,6 +261,35 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
+ };
+
+ const handleToggleVisibility = async (
+ syncId: string,
+ field: "isHidden" | "hideFromStats",
+ currentValue: boolean
+ ) => {
+ try {
+ const response = await fetch(`/api/icloud-syncs/${syncId}`, {
+ method: "PATCH",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ [field]: !currentValue,
+ }),
+ });
+
+ if (response.ok) {
+ await fetchSyncs();
+ onSyncComplete?.(); // Trigger refresh
+ toast.success(t("icloud.updateSuccess"));
+ } else {
+ const data = await response.json();
+ toast.error(data.error || t("icloud.updateError"));
+ }
+ } catch (error) {
+ console.error("Failed to update visibility:", error);
+ toast.error(t("icloud.updateError"));
+ }
};
const startAdd = () => {
@@ -253,6 +298,7 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
};
return (
@@ -274,60 +320,117 @@ export function ICloudSyncManageDialog({
{syncs.map((sync) => (
<div
key={sync.id}
- className="flex items-center justify-between p-4 rounded-xl border border-border/50 bg-muted/20 hover:bg-muted/30 transition-all"
+ className="flex flex-col gap-3 p-4 rounded-xl border border-border/50 bg-muted/20 hover:bg-muted/30 transition-all"
style={{ borderLeftColor: sync.color, borderLeftWidth: 4 }}
>
- <div className="flex-1 min-w-0">
- <div className="font-semibold flex items-center gap-2">
- <div
- className="w-1 h-4 rounded-full"
- style={{ backgroundColor: sync.color }}
- />
- <span className="truncate">{sync.name}</span>
+ <div className="flex items-center justify-between">
+ <div className="flex-1 min-w-0">
+ <div className="font-semibold flex items-center gap-2">
+ <div
+ className="w-1 h-4 rounded-full"
+ style={{ backgroundColor: sync.color }}
+ />
+ <span className="truncate">{sync.name}</span>
+ </div>
+ {sync.lastSyncedAt && (
+ <p className="text-xs text-muted-foreground mt-1">
+ {t("icloud.lastSynced")}:{" "}
+ {new Date(sync.lastSyncedAt).toLocaleString()}
+ </p>
+ )}
+ </div>
+ <div className="flex gap-1 shrink-0">
+ <Button
+ size="icon"
+ variant="ghost"
+ className="h-8 w-8"
+ onClick={() => startEdit(sync)}
+ disabled={!!isSyncing || !!isDeleting}
+ >
+ <Edit2 className="h-4 w-4" />
+ </Button>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="h-8 w-8"
+ onClick={() => handleSync(sync.id)}
+ disabled={!!isSyncing || !!isDeleting}
+ >
+ {isSyncing === sync.id ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : (
+ <RefreshCw className="h-4 w-4" />
+ )}
+ </Button>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
+ onClick={() => handleDelete(sync.id)}
+ disabled={!!isSyncing || !!isDeleting}
+ >
+ {isDeleting === sync.id ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : (
+ <Trash2 className="h-4 w-4" />
+ )}
+ </Button>
</div>
- {sync.lastSyncedAt && (
- <p className="text-xs text-muted-foreground mt-1">
- {t("icloud.lastSynced")}:{" "}
- {new Date(sync.lastSyncedAt).toLocaleString()}
- </p>
- )}
</div>
- <div className="flex gap-1 shrink-0">
- <Button
- size="icon"
- variant="ghost"
- className="h-8 w-8"
- onClick={() => startEdit(sync)}
- disabled={!!isSyncing || !!isDeleting}
- >
- <Edit2 className="h-4 w-4" />
- </Button>
- <Button
- size="icon"
- variant="ghost"
- className="h-8 w-8"
- onClick={() => handleSync(sync.id)}
- disabled={!!isSyncing || !!isDeleting}
- >
- {isSyncing === sync.id ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <RefreshCw className="h-4 w-4" />
- )}
- </Button>
- <Button
- size="icon"
- variant="ghost"
- className="h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10"
- onClick={() => handleDelete(sync.id)}
- disabled={!!isSyncing || !!isDeleting}
- >
- {isDeleting === sync.id ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Trash2 className="h-4 w-4" />
- )}
- </Button>
+
+ {/* Visibility Toggles */}
+ <div className="flex flex-col gap-2 pl-3 border-t border-border/30 pt-3">
+ <div className="flex items-center gap-2">
+ <Checkbox
+ id={`hide-${sync.id}`}
+ checked={sync.isHidden || false}
+ onCheckedChange={() =>
+ handleToggleVisibility(
+ sync.id,
+ "isHidden",
+ sync.isHidden || false
+ )
+ }
+ disabled={!!isSyncing || !!isDeleting}
+ />
+ <Label
+ htmlFor={`hide-${sync.id}`}
+ className="text-sm font-normal cursor-pointer"
+ >
+ {t("icloud.hideCalendar")}
+ </Label>
+ </div>
+ <p className="text-xs text-muted-foreground pl-6">
+ {t("icloud.hideCalendarHint")}
+ </p>
+
+ <div className="flex items-center gap-2 mt-1">
+ <Checkbox
+ id={`hide-stats-${sync.id}`}
+ checked={sync.isHidden || sync.hideFromStats || false}
+ onCheckedChange={() =>
+ handleToggleVisibility(
+ sync.id,
+ "hideFromStats",
+ sync.hideFromStats || false
+ )
+ }
+ disabled={!!isSyncing || !!isDeleting || sync.isHidden}
+ />
+ <Label
+ htmlFor={`hide-stats-${sync.id}`}
+ className={`text-sm font-normal ${
+ sync.isHidden
+ ? "cursor-not-allowed opacity-50"
+ : "cursor-pointer"
+ }`}
+ >
+ {t("icloud.hideFromStats")}
+ </Label>
+ </div>
+ <p className="text-xs text-muted-foreground pl-6">
+ {t("icloud.hideFromStatsHint")}
+ </p>
</div>
</div>
))}
@@ -382,6 +485,34 @@ export function ICloudSyncManageDialog({
</p>
</div>
+ <div className="space-y-2">
+ <Label htmlFor="sync-display-mode">
+ {t("icloud.displayMode")}
+ </Label>
+ <Select
+ value={formDisplayMode}
+ onValueChange={setFormDisplayMode}
+ >
+ <SelectTrigger
+ id="sync-display-mode"
+ className="bg-background/50"
+ >
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="normal">
+ {t("icloud.displayModeNormal")}
+ </SelectItem>
+ <SelectItem value="minimal">
+ {t("icloud.displayModeMinimal")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ <p className="text-xs text-muted-foreground">
+ {t("icloud.displayModeHint")}
+ </p>
+ </div>
+
<div className="flex gap-2">
<Button
variant="outline"
@@ -393,6 +524,7 @@ export function ICloudSyncManageDialog({
setFormName("");
setFormUrl("");
setFormColor("#3b82f6");
+ setFormDisplayMode("normal");
}
}}
disabled={isLoading}
diff --git a/components/synced-shifts-dialog.tsx b/components/synced-shifts-dialog.tsx
new file mode 100644
index 0000000..1153e18
--- /dev/null
+++ b/components/synced-shifts-dialog.tsx
@@ -0,0 +1,98 @@
+"use client";
+
+import { useTranslations } from "next-intl";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+} from "@/components/ui/dialog";
+import { ShiftWithCalendar } from "@/lib/types";
+import { format } from "date-fns";
+import { de, enUS } from "date-fns/locale";
+import { useLocale } from "next-intl";
+import { Clock } from "lucide-react";
+
+interface SyncedShiftsDialogProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ date: Date | null;
+ shifts: ShiftWithCalendar[];
+}
+
+export function SyncedShiftsDialog({
+ open,
+ onOpenChange,
+ date,
+ shifts,
+}: SyncedShiftsDialogProps) {
+ const t = useTranslations();
+ const locale = useLocale();
+ const dateLocale = locale === "de" ? de : enUS;
+
+ const formattedDate = date
+ ? format(date, "EEEE, dd. MMMM yyyy", { locale: dateLocale })
+ : "";
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="sm:max-w-[500px]">
+ <DialogHeader>
+ <DialogTitle>
+ {t("icloud.syncedShiftsTitle", { date: formattedDate })}
+ </DialogTitle>
+ <DialogDescription className="sr-only">
+ {t("icloud.viewSyncedShifts")}
+ </DialogDescription>
+ </DialogHeader>
+ <div className="space-y-3 max-h-[60vh] overflow-y-auto">
+ {shifts.length === 0 ? (
+ <p className="text-center text-muted-foreground py-8">
+ {t("shift.noShiftsInMonth")}
+ </p>
+ ) : (
+ shifts.map((shift) => (
+ <div
+ key={shift.id}
+ className="p-4 rounded-lg border transition-colors"
+ style={{
+ backgroundColor: shift.color
+ ? `${shift.color}10`
+ : "#3b82f610",
+ borderLeft: `3px solid ${shift.color || "#3b82f6"}`,
+ }}
+ >
+ <div className="flex items-start justify-between gap-3">
+ <div className="flex-1 min-w-0">
+ <h4
+ className="font-semibold text-base mb-1 truncate"
+ style={{ color: shift.color || "#3b82f6" }}
+ >
+ {shift.title}
+ </h4>
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <Clock className="h-3.5 w-3.5" />
+ {shift.isAllDay ? (
+ <span>{t("shift.allDay")}</span>
+ ) : (
+ <span>
+ {shift.startTime} - {shift.endTime}
+ </span>
+ )}
+ </div>
+ {shift.notes && (
+ <p className="text-sm text-muted-foreground mt-2 line-clamp-2">
+ {shift.notes}
+ </p>
+ )}
+ </div>
+ </div>
+ </div>
+ ))
+ )}
+ </div>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/drizzle/0005_silky_smiling_tiger.sql b/drizzle/0005_silky_smiling_tiger.sql
new file mode 100644
index 0000000..7872fc0
--- /dev/null
+++ b/drizzle/0005_silky_smiling_tiger.sql
@@ -0,0 +1,3 @@
+ALTER TABLE `icloud_syncs` ADD `display_mode` text DEFAULT 'normal' NOT NULL;--> statement-breakpoint
+ALTER TABLE `icloud_syncs` ADD `is_hidden` integer DEFAULT false NOT NULL;--> statement-breakpoint
+ALTER TABLE `icloud_syncs` ADD `hide_from_stats` integer DEFAULT false NOT NULL;
\ No newline at end of file
diff --git a/drizzle/meta/0005_snapshot.json b/drizzle/meta/0005_snapshot.json
new file mode 100644
index 0000000..005272d
--- /dev/null
+++ b/drizzle/meta/0005_snapshot.json
@@ -0,0 +1,522 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "d404c066-ecc7-4b20-859f-526d891db67c",
+ "prevId": "3aedc83b-9240-434e-ba61-b4de693ca043",
+ "tables": {
+ "calendar_notes": {
+ "name": "calendar_notes",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "calendar_id": {
+ "name": "calendar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "date": {
+ "name": "date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "calendar_notes_calendar_id_calendars_id_fk": {
+ "name": "calendar_notes_calendar_id_calendars_id_fk",
+ "tableFrom": "calendar_notes",
+ "tableTo": "calendars",
+ "columnsFrom": [
+ "calendar_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "calendars": {
+ "name": "calendars",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#3b82f6'"
+ },
+ "password_hash": {
+ "name": "password_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "icloud_syncs": {
+ "name": "icloud_syncs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "calendar_id": {
+ "name": "calendar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icloud_url": {
+ "name": "icloud_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#3b82f6'"
+ },
+ "display_mode": {
+ "name": "display_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'normal'"
+ },
+ "is_hidden": {
+ "name": "is_hidden",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "hide_from_stats": {
+ "name": "hide_from_stats",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "last_synced_at": {
+ "name": "last_synced_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "icloud_syncs_calendar_id_calendars_id_fk": {
+ "name": "icloud_syncs_calendar_id_calendars_id_fk",
+ "tableFrom": "icloud_syncs",
+ "tableTo": "calendars",
+ "columnsFrom": [
+ "calendar_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "shift_presets": {
+ "name": "shift_presets",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "calendar_id": {
+ "name": "calendar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#3b82f6'"
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_secondary": {
+ "name": "is_secondary",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "is_all_day": {
+ "name": "is_all_day",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "shift_presets_calendar_id_calendars_id_fk": {
+ "name": "shift_presets_calendar_id_calendars_id_fk",
+ "tableFrom": "shift_presets",
+ "tableTo": "calendars",
+ "columnsFrom": [
+ "calendar_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "shifts": {
+ "name": "shifts",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "calendar_id": {
+ "name": "calendar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "preset_id": {
+ "name": "preset_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "date": {
+ "name": "date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#3b82f6'"
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_all_day": {
+ "name": "is_all_day",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "is_secondary": {
+ "name": "is_secondary",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "icloud_event_id": {
+ "name": "icloud_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icloud_sync_id": {
+ "name": "icloud_sync_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "synced_from_icloud": {
+ "name": "synced_from_icloud",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "CURRENT_TIMESTAMP"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "shifts_calendar_id_calendars_id_fk": {
+ "name": "shifts_calendar_id_calendars_id_fk",
+ "tableFrom": "shifts",
+ "tableTo": "calendars",
+ "columnsFrom": [
+ "calendar_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "shifts_preset_id_shift_presets_id_fk": {
+ "name": "shifts_preset_id_shift_presets_id_fk",
+ "tableFrom": "shifts",
+ "tableTo": "shift_presets",
+ "columnsFrom": [
+ "preset_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "shifts_icloud_sync_id_icloud_syncs_id_fk": {
+ "name": "shifts_icloud_sync_id_icloud_syncs_id_fk",
+ "tableFrom": "shifts",
+ "tableTo": "icloud_syncs",
+ "columnsFrom": [
+ "icloud_sync_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 9db361e..bdecc6c 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -36,6 +36,13 @@
"when": 1764709080826,
"tag": "0004_modern_swarm",
"breakpoints": true
+ },
+ {
+ "idx": 5,
+ "version": "6",
+ "when": 1764770255988,
+ "tag": "0005_silky_smiling_tiger",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/hooks/useCalendars.ts b/hooks/useCalendars.ts
index 1d18854..6bf613b 100644
--- a/hooks/useCalendars.ts
+++ b/hooks/useCalendars.ts
@@ -41,7 +41,11 @@ export function useCalendars(initialCalendarId?: string | null) {
const response = await fetch("/api/calendars", {
method: "POST",
headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ name, color, password }),
+ body: JSON.stringify({
+ name,
+ color,
+ password,
+ }),
});
if (!response.ok) {
diff --git a/lib/db/schema.ts b/lib/db/schema.ts
index 15d7bb8..84d3020 100644
--- a/lib/db/schema.ts
+++ b/lib/db/schema.ts
@@ -26,6 +26,11 @@ export const icloudSyncs = sqliteTable("icloud_syncs", {
name: text("name").notNull(),
icloudUrl: text("icloud_url").notNull(),
color: text("color").notNull().default("#3b82f6"),
+ displayMode: text("display_mode").notNull().default("normal"),
+ isHidden: integer("is_hidden", { mode: "boolean" }).notNull().default(false),
+ hideFromStats: integer("hide_from_stats", { mode: "boolean" })
+ .notNull()
+ .default(false),
lastSyncedAt: integer("last_synced_at", { mode: "timestamp" }),
createdAt: integer("created_at", { mode: "timestamp" })
.notNull()
diff --git a/lib/types.ts b/lib/types.ts
index 876ee29..e83ea2a 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -26,6 +26,7 @@ export interface ShiftWithCalendar {
color: string;
notes?: string | null;
isAllDay?: boolean;
+ syncedFromIcloud?: boolean;
icloudSyncId?: string | null;
createdAt: Date | null;
updatedAt: Date | null;
diff --git a/messages/de.json b/messages/de.json
index ce68b05..8563d72 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -161,6 +161,13 @@
"icloud": {
"manageTitle": "iCloud-Synchronisierungen verwalten",
"manageDescription": "Füge mehrere iCloud-Kalendersynchronisierungen für diesen Kalender hinzu und verwalte sie",
+ "displayMode": "Synchronisierte Schichten anzeigen",
+ "displayModeNormal": "Normal (alle Schichten anzeigen)",
+ "displayModeMinimal": "Minimalistisch (nur Anzahl anzeigen)",
+ "displayModeHint": "Wähle, wie synchronisierte iCloud-Schichten im Kalender angezeigt werden sollen",
+ "syncedShiftsCount": "+{count} 🗘",
+ "viewSyncedShifts": "Synchronisierte Schichten anzeigen",
+ "syncedShiftsTitle": "Synchronisierte Schichten - {date}",
"addSync": "Synchronisierung hinzufügen",
"addNewSync": "Neue iCloud-Synchronisierung hinzufügen",
"editSync": "iCloud-Synchronisierung bearbeiten",
@@ -173,6 +180,10 @@
"invalidUrlFormat": "Ungültiges iCloud URL-Format. URL muss mit webcal:// oder https:// beginnen und von icloud.com stammen",
"colorLabel": "Schichten-Farbe",
"colorHint": "Wähle die Farbe für alle importierten Schichten",
+ "hideCalendar": "Kalender ausblenden",
+ "hideCalendarHint": "Schichten dieses Kalenders ausblenden",
+ "hideFromStats": "Aus Statistik ausblenden",
+ "hideFromStatsHint": "Schichten dieses Kalenders aus der Statistik ausschließen",
"lastSynced": "Zuletzt synchronisiert",
"syncError": "Kalender konnte nicht synchronisiert werden",
"createError": "Synchronisierung konnte nicht erstellt werden",
diff --git a/messages/en.json b/messages/en.json
index 3f2dd84..0d669ef 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -161,6 +161,13 @@
"icloud": {
"manageTitle": "Manage iCloud Syncs",
"manageDescription": "Add and manage multiple iCloud calendar syncs for this calendar",
+ "displayMode": "Display synced shifts",
+ "displayModeNormal": "Normal (show all shifts)",
+ "displayModeMinimal": "Minimal (show count only)",
+ "displayModeHint": "Choose how synced iCloud shifts should be displayed in the calendar",
+ "syncedShiftsCount": "+{count} 🗘",
+ "viewSyncedShifts": "View synced shifts",
+ "syncedShiftsTitle": "Synced Shifts - {date}",
"addSync": "Add Sync",
"addNewSync": "Add New iCloud Sync",
"editSync": "Edit iCloud Sync",
@@ -173,6 +180,10 @@
"invalidUrlFormat": "Invalid iCloud URL format. URL must start with webcal:// or https:// and be from icloud.com",
"colorLabel": "Shift Color",
"colorHint": "Choose the color for all imported shifts",
+ "hideCalendar": "Hide calendar",
+ "hideCalendarHint": "Hide shifts from this calendar",
+ "hideFromStats": "Hide from statistics",
+ "hideFromStatsHint": "Exclude shifts from this calendar from statistics",
"lastSynced": "Last synced",
"syncError": "Failed to sync calendar",
"createError": "Failed to create sync",