Skip to content

Your favorite shift management application!

feat: customize sort order of shifts; Refactor calendar UI (#53)

panteL9a4fd878a116
diff --git a/app/api/shifts/route.ts b/app/api/shifts/route.ts
index 9e946d2..3bd596f 100644
--- a/app/api/shifts/route.ts
+++ b/app/api/shifts/route.ts
@@ -165,6 +165,8 @@ export async function POST(request: Request) {
notes: notes || null,
isAllDay: isAllDay || false,
isSecondary: isSecondary || false,
+ createdAt: new Date(),
+ updatedAt: new Date(),
})
.returning();
diff --git a/app/page.tsx b/app/page.tsx
index b978bbe..4d2245a 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,61 +1,34 @@
"use client";
-import { useState, useEffect, useCallback, useMemo, Suspense } from "react";
+import { useState, useEffect, Suspense } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useTranslations, useLocale } from "next-intl";
-import { toast } from "sonner";
-import { CalendarDialog } from "@/components/calendar-dialog";
-import { ShiftDialog, ShiftFormData } from "@/components/shift-dialog";
-import { PasswordDialog } from "@/components/password-dialog";
-import { ManagePasswordDialog } from "@/components/manage-password-dialog";
-import { DeleteCalendarDialog } from "@/components/delete-calendar-dialog";
-import { ExternalSyncManageDialog } from "@/components/external-sync-manage-dialog";
-import { SyncNotificationDialog } from "@/components/sync-notification-dialog";
-import { DayShiftsDialog } from "@/components/day-shifts-dialog";
-import { SyncedShiftsDialog } from "@/components/synced-shifts-dialog";
-import { ViewSettingsDialog } from "@/components/view-settings-dialog";
-import { LanguageSwitcher } from "@/components/language-switcher";
-import { AppFooter } from "@/components/app-footer";
-import { ShiftStats } from "@/components/shift-stats";
-import { NoteDialog } from "@/components/note-dialog";
-import { AppHeader } from "@/components/app-header";
-import { CalendarGrid } from "@/components/calendar-grid";
-import { ShiftsList } from "@/components/shifts-list";
+import { isSameDay } from "date-fns";
import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
-import { Label } from "@/components/ui/label";
-import {
- Plus,
- ChevronLeft,
- ChevronRight,
- Calendar as CalendarIcon,
- StickyNote,
-} from "lucide-react";
-import {
- format,
- startOfMonth,
- endOfMonth,
- eachDayOfInterval,
- isSameDay,
- addMonths,
- subMonths,
- startOfWeek,
- endOfWeek,
-} from "date-fns";
+import { Plus } from "lucide-react";
import { getDateLocale } from "@/lib/locales";
-import { CalendarNote, ExternalSync } from "@/lib/db/schema";
-import { ShiftWithCalendar } from "@/lib/types";
-import { formatDateToLocal } from "@/lib/date-utils";
-import {
- getCachedPassword,
- verifyAndCachePassword,
-} from "@/lib/password-cache";
import { motion } from "motion/react";
import { useCalendars } from "@/hooks/useCalendars";
import { useShifts } from "@/hooks/useShifts";
import { usePresets } from "@/hooks/usePresets";
import { useNotes } from "@/hooks/useNotes";
import { useSSEConnection } from "@/hooks/useSSEConnection";
+import { usePasswordManagement } from "@/hooks/usePasswordManagement";
+import { useViewSettings } from "@/hooks/useViewSettings";
+import { useShiftActions } from "@/hooks/useShiftActions";
+import { useNoteActions } from "@/hooks/useNoteActions";
+import { useExternalSync } from "@/hooks/useExternalSync";
+import { useDialogStates } from "@/hooks/useDialogStates";
+import { useVersionInfo } from "@/hooks/useVersionInfo";
+import { EmptyCalendarState } from "@/components/empty-calendar-state";
+import { LockedCalendarView } from "@/components/locked-calendar-view";
+import { LoadingState } from "@/components/loading-state";
+import { CalendarContent } from "@/components/calendar-content";
+import { AppFooter } from "@/components/app-footer";
+import { AppHeader } from "@/components/app-header";
+import { DialogManager } from "@/components/dialog-manager";
+import { CalendarDialog } from "@/components/calendar-dialog";
+import { getCalendarDays } from "@/lib/calendar-utils";
function HomeContent() {
const router = useRouter();
@@ -64,7 +37,7 @@ function HomeContent() {
const locale = useLocale();
const dateLocale = getDateLocale(locale);
- // Custom hooks for data management
+ // Data hooks
const {
calendars,
selectedCalendar,
@@ -98,70 +71,44 @@ function HomeContent() {
refetchNotes,
} = useNotes(selectedCalendar);
- // External Calendar Syncs state
- const [externalSyncs, setExternalSyncs] = useState<ExternalSync[]>([]);
- const [hasSyncErrors, setHasSyncErrors] = useState(false);
-
- // Fetch external syncs for the calendar
- const fetchExternalSyncs = useCallback(async () => {
- if (!selectedCalendar) {
- setExternalSyncs([]);
- setHasSyncErrors(false);
- return;
- }
-
- try {
- const password = getCachedPassword(selectedCalendar);
- const params = new URLSearchParams({ calendarId: selectedCalendar });
- if (password) {
- params.append("password", password);
- }
-
- const response = await fetch(`/api/external-syncs?${params}`);
- if (response.ok) {
- const data = await response.json();
- setExternalSyncs(data);
- }
- } catch (error) {
- console.error("Failed to fetch external syncs:", error);
- }
- }, [selectedCalendar]);
-
- // Fetch sync logs to check for errors
- const fetchSyncErrorStatus = useCallback(async () => {
- if (!selectedCalendar) {
- setHasSyncErrors(false);
- return;
- }
-
- try {
- const password = getCachedPassword(selectedCalendar);
- const params = new URLSearchParams({
- calendarId: selectedCalendar,
- limit: "50",
- });
- if (password) {
- params.append("password", password);
- }
-
- const response = await fetch(`/api/sync-logs?${params}`);
- if (response.ok) {
- const logs = await response.json();
- // Only show errors that are not read
- const hasErrors = logs.some(
- (log: any) => log.status === "error" && !log.isRead
- );
- setHasSyncErrors(hasErrors);
- }
- } catch (error) {
- console.error("Failed to fetch sync logs:", error);
- }
- }, [selectedCalendar]);
-
- useEffect(() => {
- fetchExternalSyncs();
- fetchSyncErrorStatus();
- }, [fetchExternalSyncs, fetchSyncErrorStatus]);
+ // External sync management
+ const {
+ externalSyncs,
+ hasSyncErrors,
+ syncLogRefreshTrigger,
+ setSyncLogRefreshTrigger,
+ fetchExternalSyncs,
+ fetchSyncErrorStatus,
+ } = useExternalSync(selectedCalendar || null);
+
+ // Password management
+ const {
+ pendingAction,
+ setPendingAction,
+ isCalendarUnlocked,
+ setIsCalendarUnlocked,
+ isVerifyingCalendarPassword,
+ shouldHideUIElements,
+ handlePasswordSuccess: baseHandlePasswordSuccess,
+ verifyPasswordForAction,
+ } = usePasswordManagement(selectedCalendar || null, calendars);
+
+ // View settings
+ const viewSettings = useViewSettings();
+
+ // Dialog states
+ const dialogStates = useDialogStates();
+
+ // Note actions
+ const noteActions = useNoteActions({
+ createNote: createNoteHook,
+ updateNote: updateNoteHook,
+ deleteNote: deleteNoteHook,
+ onPasswordRequired: (action) => {
+ setPendingAction({ type: "edit", action });
+ dialogStates.setShowPasswordDialog(true);
+ },
+ });
// Local state
const [selectedPresetId, setSelectedPresetId] = useState<
@@ -169,148 +116,29 @@ function HomeContent() {
>();
const [currentDate, setCurrentDate] = useState(new Date());
const [selectedDate, setSelectedDate] = useState<Date | undefined>();
- const [showCalendarDialog, setShowCalendarDialog] = useState(false);
- const [showShiftDialog, setShowShiftDialog] = useState(false);
- const [showPasswordDialog, setShowPasswordDialog] = useState(false);
- const [showManagePasswordDialog, setShowManagePasswordDialog] =
- useState(false);
- const [showMobileCalendarDialog, setShowMobileCalendarDialog] =
- useState(false);
- const [showNoteDialog, setShowNoteDialog] = useState(false);
- const [showDeleteCalendarDialog, setShowDeleteCalendarDialog] =
- useState(false);
- const [showExternalSyncDialog, setShowExternalSyncDialog] = useState(false);
- const [showSyncNotificationDialog, setShowSyncNotificationDialog] =
- useState(false);
- const [syncLogRefreshTrigger, setSyncLogRefreshTrigger] = useState(0);
- const [showDayShiftsDialog, setShowDayShiftsDialog] = useState(false);
- const [showSyncedShiftsDialog, setShowSyncedShiftsDialog] = useState(false);
- const [showViewSettingsDialog, setShowViewSettingsDialog] = 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
- >();
- const [selectedNote, setSelectedNote] = useState<CalendarNote | undefined>();
- const [pendingAction, setPendingAction] = useState<{
- type: "delete" | "edit" | "syncNotifications";
- shiftId?: string;
- formData?: ShiftFormData;
- presetAction?: () => Promise<void>;
- noteAction?: () => Promise<void>;
- action?: () => Promise<void>;
- } | null>(null);
const [statsRefreshTrigger, setStatsRefreshTrigger] = useState(0);
- const [togglingDates, setTogglingDates] = useState<Set<string>>(new Set());
const [isConnected, setIsConnected] = useState(true);
- const [isCalendarUnlocked, setIsCalendarUnlocked] = useState(true);
- const [isVerifyingCalendarPassword, setIsVerifyingCalendarPassword] =
- useState(false);
- const [passwordCacheTrigger, setPasswordCacheTrigger] = useState(0);
- const [versionInfo, setVersionInfo] = useState<{
- version: string;
- githubUrl: string;
- commitHash?: string;
- } | null>(null);
-
- // View density state with localStorage persistence
- const [shiftsPerDay, setShiftsPerDay] = useState<number | null>(() => {
- if (typeof window !== "undefined") {
- const stored = localStorage.getItem("shifts-per-day");
- if (stored === "null") return null;
- if (stored) {
- const parsed = parseInt(stored);
- return isNaN(parsed) ? 3 : parsed;
- }
- }
- return 3;
- });
-
- const [externalShiftsPerDay, setExternalShiftsPerDay] = useState<
- number | null
- >(() => {
- if (typeof window !== "undefined") {
- const stored = localStorage.getItem("external-shifts-per-day");
- if (stored === "null") return null;
- if (stored) {
- const parsed = parseInt(stored);
- return isNaN(parsed) ? 3 : parsed;
- }
- }
- return 3;
- });
-
- const [showShiftNotes, setShowShiftNotes] = useState<boolean>(() => {
- if (typeof window !== "undefined") {
- const stored = localStorage.getItem("show-shift-notes");
- return stored === "true";
- }
- return false;
- });
- const [showFullTitles, setShowFullTitles] = useState<boolean>(() => {
- if (typeof window !== "undefined") {
- const stored = localStorage.getItem("show-full-titles");
- return stored === "true";
- }
- return false;
- });
+ // Version info
+ const versionInfo = useVersionInfo();
- const handleShiftsPerDayChange = useCallback((count: number | null) => {
- setShiftsPerDay(count);
- if (typeof window !== "undefined") {
- localStorage.setItem(
- "shifts-per-day",
- count === null ? "null" : count.toString()
- );
- }
- }, []);
-
- const handleExternalShiftsPerDayChange = useCallback(
- (count: number | null) => {
- setExternalShiftsPerDay(count);
- if (typeof window !== "undefined") {
- localStorage.setItem(
- "external-shifts-per-day",
- count === null ? "null" : count.toString()
- );
- }
+ // Shift actions
+ const shiftActions = useShiftActions({
+ selectedCalendar: selectedCalendar || null,
+ shifts,
+ setShifts,
+ presets,
+ createShift: createShiftHook,
+ updateShift: updateShiftHook,
+ deleteShift: deleteShiftHook,
+ onStatsRefresh: () => setStatsRefreshTrigger((prev) => prev + 1),
+ onPasswordRequired: (action) => {
+ setPendingAction({ type: "edit", action });
+ dialogStates.setShowPasswordDialog(true);
},
- []
- );
-
- const handleShowShiftNotesChange = useCallback((show: boolean) => {
- setShowShiftNotes(show);
- if (typeof window !== "undefined") {
- localStorage.setItem("show-shift-notes", show.toString());
- }
- }, []);
-
- const handleShowFullTitlesChange = useCallback((show: boolean) => {
- setShowFullTitles(show);
- if (typeof window !== "undefined") {
- localStorage.setItem("show-full-titles", show.toString());
- }
- }, []);
-
- // Check if UI elements should be hidden (password required but not cached)
- const selectedCalendarData = useMemo(() => {
- return calendars.find((c) => c.id === selectedCalendar);
- }, [calendars, selectedCalendar]);
-
- const shouldHideUIElements = useMemo(() => {
- if (!selectedCalendar || !selectedCalendarData) return false;
- const requiresPassword = !!selectedCalendarData.passwordHash;
- const hasPassword = !!getCachedPassword(selectedCalendar);
- return requiresPassword && !hasPassword;
- }, [selectedCalendar, selectedCalendarData, passwordCacheTrigger]);
+ });
- // SSE Connection for real-time updates
+ // SSE Connection
useSSEConnection({
calendarId: selectedCalendar,
onShiftUpdate: refetchShifts,
@@ -325,133 +153,15 @@ function HomeContent() {
setIsConnected,
});
- // Fetch version information
- const fetchVersion = async () => {
- try {
- const response = await fetch("/api/version");
- const data = await response.json();
- setVersionInfo({
- version: data.version,
- githubUrl: data.githubUrl,
- commitHash: data.commitHash,
- });
- } catch (error) {
- console.error("Failed to fetch version:", error);
- }
- };
-
- useEffect(() => {
- fetchVersion();
- }, []);
-
- // Memoize only the isLocked property of the selected calendar to avoid unnecessary re-verification
- const selectedCalendarIsLocked = useMemo(() => {
- if (!selectedCalendar) return false;
- const currentCalendar = calendars.find((c) => c.id === selectedCalendar);
- return currentCalendar?.isLocked ?? false;
- }, [selectedCalendar, calendars]);
-
- // Update URL when selected calendar changes
+ // Update URL when calendar changes
useEffect(() => {
if (selectedCalendar) {
router.replace(`/?id=${selectedCalendar}`, { scroll: false });
-
- // Check if calendar is locked
- if (selectedCalendarIsLocked) {
- const cachedPassword = getCachedPassword(selectedCalendar);
-
- if (cachedPassword) {
- // Set loading state and verify password before unlocking
- setIsVerifyingCalendarPassword(true);
- setIsCalendarUnlocked(false);
-
- // Verify the cached password
- verifyAndCachePassword(selectedCalendar, cachedPassword)
- .then((result) => {
- setIsCalendarUnlocked(result.valid);
- if (result.valid) {
- // Password is valid, refetch all data
- handlePasswordSuccess(cachedPassword);
- }
- })
- .catch(() => {
- // On error, keep calendar locked
- setIsCalendarUnlocked(false);
- })
- .finally(() => {
- // Clear loading state
- setIsVerifyingCalendarPassword(false);
- });
- } else {
- // No cached password, set unlocked to false
- setIsCalendarUnlocked(false);
- setIsVerifyingCalendarPassword(false);
- }
- } else {
- // Calendar not locked, allow access
- setIsCalendarUnlocked(true);
- setIsVerifyingCalendarPassword(false);
- }
- } else {
- setIsCalendarUnlocked(true);
- setIsVerifyingCalendarPassword(false);
- }
- }, [selectedCalendar, selectedCalendarIsLocked, router]);
-
- const initiateDeleteCalendar = (id: string) => {
- setCalendarToDelete(id);
- setShowDeleteCalendarDialog(true);
- };
-
- const handleExternalSyncClick = async () => {
- if (!selectedCalendar) return;
-
- const calendar = calendars.find((c) => c.id === selectedCalendar);
- if (!calendar) return;
-
- // Check if calendar is password protected
- if (calendar.passwordHash) {
- const cachedPassword = getCachedPassword(selectedCalendar);
-
- if (cachedPassword) {
- // Verify cached password
- const result = await verifyAndCachePassword(
- selectedCalendar,
- cachedPassword
- );
-
- if (result.valid) {
- setShowExternalSyncDialog(true);
- return;
- }
- }
-
- // Show password dialog if no valid cached password
- setPendingAction({
- type: "edit",
- presetAction: async () => {
- setShowExternalSyncDialog(true);
- },
- });
- setShowPasswordDialog(true);
- } else {
- // No password protection
- setShowExternalSyncDialog(true);
- }
- };
-
- const handleDeleteCalendar = async (password?: string) => {
- if (!calendarToDelete) return;
-
- const success = await deleteCalendarHook(calendarToDelete, password);
- if (success) {
- setShowDeleteCalendarDialog(false);
- setCalendarToDelete(undefined);
}
- };
+ }, [selectedCalendar, router]);
+ // Handle password success with data refresh
const handlePasswordSuccess = async (password: string) => {
- // Refetch all data now that password is available
await Promise.all([
refetchShifts(),
refetchPresets(),
@@ -459,699 +169,228 @@ function HomeContent() {
fetchExternalSyncs(),
fetchSyncErrorStatus(),
]);
-
setStatsRefreshTrigger((prev) => prev + 1);
- setPasswordCacheTrigger((prev) => prev + 1);
-
- if (!pendingAction) return;
+ baseHandlePasswordSuccess();
- try {
- if (pendingAction.type === "delete" && pendingAction.shiftId) {
- const response = await fetch(`/api/shifts/${pendingAction.shiftId}`, {
- method: "DELETE",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ password }),
- });
- if (response.ok) {
- setShifts(shifts.filter((s) => s.id !== pendingAction.shiftId));
- setStatsRefreshTrigger((prev) => prev + 1);
- }
- } else if (
- pendingAction.type === "edit" &&
- pendingAction.shiftId &&
- pendingAction.formData
- ) {
- const response = await fetch(`/api/shifts/${pendingAction.shiftId}`, {
- method: "PATCH",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ ...pendingAction.formData, password }),
- });
- if (response.ok) {
- const updatedShift = await response.json();
- setShifts(
- shifts.map((s) =>
- s.id === pendingAction.shiftId ? updatedShift : s
- )
- );
- setStatsRefreshTrigger((prev) => prev + 1);
- }
- } else if (pendingAction.presetAction) {
- await pendingAction.presetAction();
- } else if (pendingAction.noteAction) {
- await pendingAction.noteAction();
- setShowNoteDialog(false);
- } else if (pendingAction.action) {
- await pendingAction.action();
- }
- } catch (error) {
- console.error("Failed to execute pending action:", error);
- } finally {
+ // Execute pending action if exists
+ if (pendingAction?.action) {
+ await pendingAction.action();
setPendingAction(null);
}
};
- const handlePresetPasswordRequired = async (action: () => Promise<void>) => {
- setPendingAction({ type: "edit", presetAction: action });
- setShowPasswordDialog(true);
+ // Calendar operations
+ const initiateDeleteCalendar = (id: string) => {
+ dialogStates.setCalendarToDelete(id);
+ dialogStates.setShowDeleteCalendarDialog(true);
};
- const handleNoteSubmit = async (noteText: string) => {
- const handlePasswordRequired = () => {
- setPendingAction({
- type: "edit",
- noteAction: async () => {
- if (selectedNote) {
- await updateNoteHook(
- selectedNote.id,
- noteText,
- handlePasswordRequired
- );
- } else if (selectedDate) {
- await createNoteHook(
- noteText,
- selectedDate,
- handlePasswordRequired
- );
- }
- },
- });
- setShowPasswordDialog(true);
- };
+ const handleDeleteCalendar = async (password?: string) => {
+ if (!dialogStates.calendarToDelete) return;
+ const success = await deleteCalendarHook(
+ dialogStates.calendarToDelete,
+ password
+ );
+ if (success) {
+ dialogStates.setShowDeleteCalendarDialog(false);
+ dialogStates.setCalendarToDelete(undefined);
+ }
+ };
- if (selectedNote) {
- const success = await updateNoteHook(
- selectedNote.id,
- noteText,
- handlePasswordRequired
- );
- // Dialog stays open for Auto-Save
- } else if (selectedDate) {
- const success = await createNoteHook(
- noteText,
- selectedDate,
- handlePasswordRequired
- );
- // Dialog stays open for Auto-Save
+ // External sync operations
+ const handleExternalSyncClick = async () => {
+ const executed = await verifyPasswordForAction(async () => {
+ dialogStates.setShowExternalSyncDialog(true);
+ });
+ if (!executed) {
+ dialogStates.setShowPasswordDialog(true);
}
};
- const handleNoteDelete = async () => {
- if (!selectedNote) return;
+ const handleSyncNotifications = async () => {
+ const executed = await verifyPasswordForAction(async () => {
+ dialogStates.setShowSyncNotificationDialog(true);
+ });
+ if (!executed) {
+ dialogStates.setShowPasswordDialog(true);
+ }
+ };
- const handlePasswordRequired = () => {
- setPendingAction({
- type: "delete",
- noteAction: async () => {
- if (selectedNote) {
- await deleteNoteHook(selectedNote.id, handlePasswordRequired);
- }
- },
- });
- setShowPasswordDialog(true);
- };
+ const handleSyncComplete = () => {
+ refetchShifts();
+ refetchCalendars();
+ setStatsRefreshTrigger((prev) => prev + 1);
+ fetchExternalSyncs();
+ fetchSyncErrorStatus();
+ };
- const success = await deleteNoteHook(
- selectedNote.id,
- handlePasswordRequired
- );
- if (success) {
- setShowNoteDialog(false); // Close dialog after deletion
+ // Manual shift creation
+ const handleManualShiftCreation = async () => {
+ const executed = await verifyPasswordForAction(async () => {
+ setSelectedDate(new Date());
+ dialogStates.setShowShiftDialog(true);
+ });
+ if (!executed) {
+ dialogStates.setShowPasswordDialog(true);
}
};
+ // Day interaction handlers
+ const handleDayClick = (date: Date) => {
+ shiftActions.handleAddShift(date, selectedPresetId);
+ };
+
const handleDayRightClick = (e: React.MouseEvent, date: Date) => {
e.preventDefault();
- setSelectedDate(date);
const existingNote = notes.find(
(note) => note.date && isSameDay(new Date(note.date), date)
);
- setSelectedNote(existingNote);
- setShowNoteDialog(true);
+ noteActions.openNoteDialog(date, existingNote);
};
const handleNoteIconClick = (e: React.MouseEvent, date: Date) => {
e.stopPropagation();
- setSelectedDate(date);
const existingNote = notes.find(
(note) => note.date && isSameDay(new Date(note.date), date)
);
- setSelectedNote(existingNote);
- setShowNoteDialog(true);
- };
-
- const handleDayClick = (date: Date) => {
- handleAddShift(date);
+ noteActions.openNoteDialog(date, existingNote);
};
const handleLongPressDay = (date: Date) => {
- setSelectedDate(date);
const existingNote = notes.find(
(note) => note.date && isSameDay(new Date(note.date), date)
);
- setSelectedNote(existingNote);
- setShowNoteDialog(true);
- };
-
- const handleNoteDialogChange = (open: boolean) => {
- setShowNoteDialog(open);
- if (!open) {
- setSelectedNote(undefined);
- }
- };
-
- const handleShiftSubmit = (formData: ShiftFormData) => {
- createShiftHook(formData);
- setStatsRefreshTrigger((prev) => prev + 1);
- };
-
- const handleUpdateShift = async (id: string, formData: ShiftFormData) => {
- const success = await updateShiftHook(id, formData, () => {
- setPendingAction({ type: "edit", shiftId: id, formData });
- setShowPasswordDialog(true);
- });
- if (success) {
- setStatsRefreshTrigger((prev) => prev + 1);
- }
- };
-
- const handleDeleteShift = async (id: string) => {
- const success = await deleteShiftHook(id, () => {
- setPendingAction({ type: "delete", shiftId: id });
- setShowPasswordDialog(true);
- });
- if (success) {
- setStatsRefreshTrigger((prev) => prev + 1);
- }
- };
-
- const handleManualShiftCreation = async () => {
- if (!selectedCalendar) return;
-
- const cachedPassword = getCachedPassword(selectedCalendar);
- const result = await verifyAndCachePassword(
- selectedCalendar,
- cachedPassword
- );
-
- if (result.protected && !result.valid) {
- setPendingAction({
- type: "edit",
- presetAction: handleManualShiftCreation,
- });
- setShowPasswordDialog(true);
- return;
- }
-
- setSelectedDate(new Date());
- setShowShiftDialog(true);
+ noteActions.openNoteDialog(date, existingNote);
};
- const handleShowAllShifts = (date: Date, dayShifts: ShiftWithCalendar[]) => {
- setSelectedDayDate(date);
- setSelectedDayShifts(dayShifts);
- setShowDayShiftsDialog(true);
+ const handleShowAllShifts = (date: Date, dayShifts: any[]) => {
+ dialogStates.setSelectedDayDate(date);
+ dialogStates.setSelectedDayShifts(dayShifts);
+ dialogStates.setShowDayShiftsDialog(true);
};
- const handleShowSyncedShifts = (
- date: Date,
- syncedShifts: ShiftWithCalendar[]
- ) => {
- setSelectedDayDate(date);
- setSelectedSyncedShifts(syncedShifts);
- setShowSyncedShiftsDialog(true);
+ const handleShowSyncedShifts = (date: Date, syncedShifts: any[]) => {
+ dialogStates.setSelectedDayDate(date);
+ dialogStates.setSelectedSyncedShifts(syncedShifts);
+ dialogStates.setShowSyncedShiftsDialog(true);
};
const handleDeleteShiftFromDayDialog = async (shiftId: string) => {
- setShowDayShiftsDialog(false);
- await handleDeleteShift(shiftId);
- // Refresh the shifts after deletion
+ dialogStates.setShowDayShiftsDialog(false);
+ await shiftActions.handleDeleteShift(shiftId);
refetchShifts();
};
- const handleAddShift = async (date: Date) => {
- if (!selectedPresetId) return;
-
- const preset = presets.find((p) => p.id === selectedPresetId);
- if (!preset) return;
-
- // Capture date immediately to prevent wrong date assignment
- const targetDate = new Date(date);
- const dateKey = formatDateToLocal(targetDate);
-
- // Check if this date is already being toggled
- if (togglingDates.has(dateKey)) return;
-
- // Add date to toggling set
- setTogglingDates((prev) => new Set(prev).add(dateKey));
-
- try {
- const password = selectedCalendar
- ? getCachedPassword(selectedCalendar)
- : null;
-
- if (selectedCalendar) {
- const result = await verifyAndCachePassword(selectedCalendar, password);
-
- if (result.protected && !result.valid) {
- setPendingAction({
- type: "edit",
- presetAction: () => handleAddShift(targetDate),
- });
- setShowPasswordDialog(true);
- setTogglingDates((prev) => {
- const next = new Set(prev);
- next.delete(dateKey);
- return next;
- });
- return;
- }
- }
-
- const existingShift = shifts.find(
- (shift) =>
- shift.date &&
- isSameDay(new Date(shift.date), targetDate) &&
- shift.title === preset.title &&
- shift.startTime === preset.startTime &&
- shift.endTime === preset.endTime
- );
-
- if (existingShift) {
- // Optimistic UI update - remove shift immediately
- const previousShifts = [...shifts];
- setShifts(shifts.filter((s) => s.id !== existingShift.id));
- setStatsRefreshTrigger((prev) => prev + 1);
-
- try {
- const response = await fetch(`/api/shifts/${existingShift.id}`, {
- method: "DELETE",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({ password }),
- });
-
- if (!response.ok) {
- // Revert on error
- setShifts(previousShifts);
- setStatsRefreshTrigger((prev) => prev + 1);
- toast.error(t("shift.deleteError"));
- } else {
- toast.success(t("shift.deleted"));
- }
- } catch (error) {
- console.error("Failed to delete shift:", error);
- // Revert on error
- setShifts(previousShifts);
- setStatsRefreshTrigger((prev) => prev + 1);
- toast.error(t("shift.deleteError"));
- }
- } else {
- const shiftData: ShiftFormData = {
- date: dateKey,
- startTime: preset.startTime,
- endTime: preset.endTime,
- title: preset.title,
- color: preset.color,
- notes: preset.notes || "",
- presetId: preset.id,
- isAllDay: preset.isAllDay || false,
- };
-
- const newShift = await createShiftHook(shiftData);
- if (newShift) {
- setStatsRefreshTrigger((prev) => prev + 1);
- }
- }
- } finally {
- // Remove date from toggling set
- setTogglingDates((prev) => {
- const next = new Set(prev);
- next.delete(dateKey);
- return next;
- });
- }
- };
-
// Calendar grid calculations
- const monthStart = startOfMonth(currentDate);
- const monthEnd = endOfMonth(currentDate);
- const calendarStart = startOfWeek(monthStart, { weekStartsOn: 1 });
- const calendarEnd = endOfWeek(monthEnd, { weekStartsOn: 1 });
- const calendarDays = eachDayOfInterval({
- start: calendarStart,
- end: calendarEnd,
- });
+ const calendarDays = getCalendarDays(currentDate);
+ // Loading state
if (loading) {
- return (
- <div className="min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-muted/20">
- <motion.div
- className="text-center space-y-4"
- initial={{ opacity: 0, scale: 0.9 }}
- animate={{ opacity: 1, scale: 1 }}
- >
- <motion.div
- animate={{ rotate: 360 }}
- transition={{ duration: 2, repeat: Infinity, ease: "linear" }}
- >
- <CalendarIcon className="h-12 w-12 sm:h-16 sm:w-16 mx-auto text-primary" />
- </motion.div>
- <p className="text-sm sm:text-base text-muted-foreground font-medium">
- {t("common.loading")}
- </p>
- </motion.div>
- </div>
- );
+ return <LoadingState />;
}
+ // Empty state
if (calendars.length === 0) {
return (
- <div className="min-h-screen flex flex-col">
- <div className="flex-1 flex items-center justify-center p-4">
- <motion.div
- className="text-center space-y-6 max-w-md"
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- >
- <motion.div
- initial={{ scale: 0 }}
- animate={{ scale: 1 }}
- transition={{ delay: 0.1, type: "spring", stiffness: 200 }}
- className="w-20 h-20 mx-auto rounded-full bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center"
- >
- <CalendarIcon className="h-10 w-10 text-primary" />
- </motion.div>
- <div className="space-y-3">
- <h1 className="text-2xl sm:text-3xl font-bold">
- {t("onboarding.welcome")}
- </h1>
- <p className="text-muted-foreground text-sm sm:text-base leading-relaxed">
- {t("onboarding.description")}
- </p>
- </div>
- <motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}>
- <Button
- onClick={() => setShowCalendarDialog(true)}
- size="lg"
- className="h-12 px-8 text-base font-semibold shadow-lg shadow-primary/20"
- >
- <Plus className="mr-2 h-5 w-5" />
- {t("onboarding.createCalendar")}
- </Button>
- </motion.div>
- </motion.div>
- </div>
- <div className="border-t bg-background">
- <div className="container max-w-4xl mx-auto p-3 sm:p-4 flex justify-center">
- <LanguageSwitcher />
- </div>
- </div>
+ <>
+ <EmptyCalendarState
+ onCreateCalendar={() => dialogStates.setShowCalendarDialog(true)}
+ />
<CalendarDialog
- open={showCalendarDialog}
- onOpenChange={setShowCalendarDialog}
+ open={dialogStates.showCalendarDialog}
+ onOpenChange={dialogStates.setShowCalendarDialog}
onSubmit={createCalendarHook}
/>
- </div>
+ </>
);
}
return (
<div className="min-h-screen flex flex-col">
- {/* Always show AppHeader - allows calendar switching even when locked */}
<AppHeader
calendars={calendars}
selectedCalendar={selectedCalendar}
presets={presets}
selectedPresetId={selectedPresetId}
isConnected={isConnected}
- showMobileCalendarDialog={showMobileCalendarDialog}
+ showMobileCalendarDialog={dialogStates.showMobileCalendarDialog}
hasSyncErrors={hasSyncErrors}
onSelectCalendar={setSelectedCalendar}
onSelectPreset={setSelectedPresetId}
- onCreateCalendar={() => setShowCalendarDialog(true)}
- onManagePassword={() => setShowManagePasswordDialog(true)}
+ onCreateCalendar={() => dialogStates.setShowCalendarDialog(true)}
+ onManagePassword={() => dialogStates.setShowManagePasswordDialog(true)}
onDeleteCalendar={initiateDeleteCalendar}
onExternalSync={handleExternalSyncClick}
- onSyncNotifications={async () => {
- if (!selectedCalendar) return;
-
- const calendar = calendars.find((c) => c.id === selectedCalendar);
- if (!calendar) return;
-
- // Check if calendar is password protected
- if (calendar.passwordHash) {
- const cachedPassword = getCachedPassword(selectedCalendar);
-
- if (cachedPassword) {
- // Verify cached password
- const result = await verifyAndCachePassword(
- selectedCalendar,
- cachedPassword
- );
-
- if (result.valid) {
- setShowSyncNotificationDialog(true);
- return;
- }
- }
-
- // Show password dialog if no valid cached password
- setPendingAction({
- type: "syncNotifications",
- action: async () => {
- setShowSyncNotificationDialog(true);
- },
- });
- setShowPasswordDialog(true);
- } else {
- // No password protection
- setShowSyncNotificationDialog(true);
- }
- }}
+ onSyncNotifications={handleSyncNotifications}
onPresetsChange={refetchPresets}
onShiftsChange={refetchShifts}
onStatsRefresh={() => setStatsRefreshTrigger((prev) => prev + 1)}
- onPasswordRequired={handlePresetPasswordRequired}
+ onPasswordRequired={(action) => {
+ setPendingAction({ type: "edit", presetAction: action });
+ dialogStates.setShowPasswordDialog(true);
+ }}
onManualShiftCreation={handleManualShiftCreation}
- onMobileCalendarDialogChange={setShowMobileCalendarDialog}
- onViewSettingsClick={() => setShowViewSettingsDialog(true)}
+ onMobileCalendarDialogChange={dialogStates.setShowMobileCalendarDialog}
+ onViewSettingsClick={() => dialogStates.setShowViewSettingsDialog(true)}
presetsLoading={presetsLoading}
/>
<div className="container max-w-4xl mx-auto px-1 py-3 sm:p-4 flex-1">
- {/* Show loading state while verifying password */}
{isVerifyingCalendarPassword ? (
- <div className="flex flex-col items-center justify-center py-20">
- <motion.div
- initial={{ opacity: 0, scale: 0.9 }}
- animate={{ opacity: 1, scale: 1 }}
- className="text-center"
- >
- <div className="w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mb-6 mx-auto">
- <div className="h-10 w-10 border-4 border-primary border-t-transparent rounded-full animate-spin" />
- </div>
- <p className="text-muted-foreground">{t("common.loading")}</p>
- </motion.div>
- </div>
+ <LoadingState />
) : selectedCalendar && !isCalendarUnlocked ? (
- <div className="flex flex-col items-center justify-center py-20">
- <motion.div
- initial={{ opacity: 0, y: 20 }}
- animate={{ opacity: 1, y: 0 }}
- className="w-full max-w-md"
- >
- <div className="bg-gradient-to-b from-background via-background to-muted/30 backdrop-blur-xl shadow-2xl border border-border/50 rounded-2xl p-8">
- <div className="w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mb-6 mx-auto">
- <CalendarIcon className="h-10 w-10 text-primary" />
- </div>
- <h3 className="text-2xl font-semibold mb-2 text-center">
- {t("password.currentlyLocked")}
- </h3>
- <p className="text-muted-foreground text-center mb-8">
- {t("password.enterCalendarPassword")}
- </p>
- <form
- onSubmit={(e) => {
- e.preventDefault();
- const formData = new FormData(e.currentTarget);
- const password = formData.get("password") as string;
- if (password && selectedCalendar) {
- fetch(
- `/api/calendars/${selectedCalendar}/verify-password`,
- {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ password }),
- }
- )
- .then((response) => response.json())
- .then((data) => {
- if (data.valid) {
- localStorage.setItem(
- `calendar_password_${selectedCalendar}`,
- password
- );
- setIsCalendarUnlocked(true);
- // Trigger data refetch after successful password entry
- handlePasswordSuccess(password);
- } else {
- toast.error(t("validation.passwordIncorrect"));
- }
- })
- .catch(() => {
- toast.error(t("validation.passwordIncorrect"));
- });
- }
- }}
- className="space-y-4"
- >
- <div className="space-y-2">
- <Label
- htmlFor="unlock-password"
- className="text-sm font-medium"
- >
- {t("form.passwordLabel")}
- </Label>
- <Input
- id="unlock-password"
- name="password"
- type="password"
- placeholder={t("form.passwordPlaceholder")}
- className="h-11 border-primary/30 focus:border-primary/50 focus:ring-primary/20"
- autoFocus
- />
- </div>
- <Button
- type="submit"
- className="w-full h-11 bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg shadow-primary/25"
- >
- {t("common.unlock", { default: "Unlock" })}
- </Button>
- </form>
- </div>
- </motion.div>
- </div>
+ <LockedCalendarView
+ calendarId={selectedCalendar}
+ onUnlock={(password) => {
+ setIsCalendarUnlocked(true);
+ handlePasswordSuccess(password);
+ }}
+ />
) : (
- <>
- {/* Month Navigation */}
- <motion.div
- className="flex items-center justify-between mb-4 sm:mb-5 px-2 sm:px-0"
- initial={{ opacity: 0, y: -10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.3 }}
- >
- <Button
- variant="outline"
- size="icon"
- className="h-10 w-10 sm:h-11 sm:w-11 rounded-full active:scale-95 transition-transform"
- onClick={() => setCurrentDate(subMonths(currentDate, 1))}
- >
- <ChevronLeft className="h-5 w-5" />
- </Button>
- <motion.h2
- className="text-lg sm:text-xl font-bold"
- key={format(currentDate, "MMMM yyyy")}
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.2 }}
- >
- {format(currentDate, "MMMM yyyy", { locale: dateLocale })}
- </motion.h2>
- <Button
- variant="outline"
- size="icon"
- className="h-10 w-10 sm:h-11 sm:w-11 rounded-full active:scale-95 transition-transform"
- onClick={() => setCurrentDate(addMonths(currentDate, 1))}
- >
- <ChevronRight className="h-5 w-5" />
- </Button>
- </motion.div>
-
- {/* Calendar Grid */}
- <CalendarGrid
- calendarDays={calendarDays}
- currentDate={currentDate}
- shifts={shifts}
- notes={notes}
- selectedPresetId={selectedPresetId}
- togglingDates={togglingDates}
- externalSyncs={externalSyncs}
- maxShiftsToShow={shiftsPerDay === null ? undefined : shiftsPerDay}
- maxExternalShiftsToShow={
- externalShiftsPerDay === null ? undefined : externalShiftsPerDay
- }
- showShiftNotes={showShiftNotes}
- showFullTitles={showFullTitles}
- onDayClick={handleDayClick}
- onDayRightClick={
- shouldHideUIElements ? undefined : handleDayRightClick
- }
- onNoteIconClick={
- shouldHideUIElements ? undefined : handleNoteIconClick
- }
- onLongPress={
- shouldHideUIElements ? undefined : handleLongPressDay
- }
- onShowAllShifts={handleShowAllShifts}
- onShowSyncedShifts={handleShowSyncedShifts}
- />
-
- {/* Note Hint */}
- {!shouldHideUIElements && (
- <motion.div
- className="px-2 sm:px-0 mb-4"
- initial={{ opacity: 0, y: 10 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ delay: 0.3 }}
- >
- <div className="bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-xl p-3 sm:p-3.5 backdrop-blur-sm">
- <div className="flex items-center gap-2.5">
- <div className="shrink-0 w-8 h-8 rounded-lg bg-primary/20 flex items-center justify-center">
- <StickyNote className="h-4 w-4 text-orange-500" />
- </div>
- <div className="flex-1">
- <p className="text-xs sm:hidden text-foreground/80 leading-relaxed">
- {t("note.hintMobile", {
- default:
- "Long press on a day to open notes. The note icon shows existing notes.",
- })}
- </p>
- <p className="hidden sm:block text-sm text-foreground/80 leading-relaxed">
- {t("note.hintDesktop", {
- default:
- "Right-click on a day to open notes. The note icon shows existing notes.",
- })}
- </p>
- </div>
- </div>
- </div>
- </motion.div>
- )}
-
- {/* Shifts List */}
- <div className="space-y-3 sm:space-y-4 px-2 sm:px-0">
- <ShiftStats
- calendarId={selectedCalendar}
- currentDate={currentDate}
- refreshTrigger={statsRefreshTrigger}
- />
-
- <ShiftsList
- shifts={shifts}
- currentDate={currentDate}
- onDeleteShift={
- shouldHideUIElements ? undefined : handleDeleteShift
- }
- />
- </div>
- </>
+ <CalendarContent
+ calendarDays={calendarDays}
+ currentDate={currentDate}
+ onDateChange={setCurrentDate}
+ shifts={shifts}
+ notes={notes}
+ selectedPresetId={selectedPresetId}
+ togglingDates={shiftActions.togglingDates}
+ externalSyncs={externalSyncs}
+ maxShiftsToShow={
+ viewSettings.shiftsPerDay === null
+ ? undefined
+ : viewSettings.shiftsPerDay
+ }
+ maxExternalShiftsToShow={
+ viewSettings.externalShiftsPerDay === null
+ ? undefined
+ : viewSettings.externalShiftsPerDay
+ }
+ showShiftNotes={viewSettings.showShiftNotes}
+ showFullTitles={viewSettings.showFullTitles}
+ shiftSortType={viewSettings.shiftSortType}
+ shiftSortOrder={viewSettings.shiftSortOrder}
+ combinedSortMode={viewSettings.combinedSortMode}
+ selectedCalendar={selectedCalendar || null}
+ statsRefreshTrigger={statsRefreshTrigger}
+ shouldHideUIElements={shouldHideUIElements}
+ locale={dateLocale}
+ onDayClick={handleDayClick}
+ onDayRightClick={
+ shouldHideUIElements ? undefined : handleDayRightClick
+ }
+ onNoteIconClick={
+ shouldHideUIElements ? undefined : handleNoteIconClick
+ }
+ onLongPress={shouldHideUIElements ? undefined : handleLongPressDay}
+ onShowAllShifts={handleShowAllShifts}
+ onShowSyncedShifts={handleShowSyncedShifts}
+ onDeleteShift={shiftActions.handleDeleteShift}
+ />
)}
</div>
- {/* Floating Action Button for Manual Shift Creation - Desktop Only */}
+ {/* Floating Action Button */}
{selectedCalendar && !shouldHideUIElements && (
<motion.div
className="hidden sm:block fixed bottom-6 right-6 z-50"
@@ -1170,131 +409,70 @@ function HomeContent() {
)}
{/* Dialogs */}
- <CalendarDialog
- open={showCalendarDialog}
- onOpenChange={setShowCalendarDialog}
- onSubmit={createCalendarHook}
- />
- <ShiftDialog
- open={showShiftDialog}
- onOpenChange={setShowShiftDialog}
- onSubmit={handleShiftSubmit}
+ <DialogManager
+ showCalendarDialog={dialogStates.showCalendarDialog}
+ onCalendarDialogChange={dialogStates.setShowCalendarDialog}
+ onCreateCalendar={createCalendarHook}
+ showShiftDialog={dialogStates.showShiftDialog}
+ onShiftDialogChange={dialogStates.setShowShiftDialog}
+ onShiftSubmit={shiftActions.handleShiftSubmit}
selectedDate={selectedDate}
+ selectedCalendar={selectedCalendar || null}
onPresetsChange={refetchPresets}
- calendarId={selectedCalendar}
- />
- {selectedCalendar && (
- <PasswordDialog
- open={showPasswordDialog}
- onOpenChange={setShowPasswordDialog}
- calendarId={selectedCalendar}
- calendarName={
- calendars.find((c) => c.id === selectedCalendar)?.name || ""
- }
- onSuccess={handlePasswordSuccess}
- />
- )}
- {selectedCalendar && (
- <ManagePasswordDialog
- open={showManagePasswordDialog}
- onOpenChange={setShowManagePasswordDialog}
- calendarId={selectedCalendar}
- calendarName={
- calendars.find((c) => c.id === selectedCalendar)?.name || ""
- }
- hasPassword={
- !!calendars.find((c) => c.id === selectedCalendar)?.passwordHash
- }
- isLocked={
- calendars.find((c) => c.id === selectedCalendar)?.isLocked || false
- }
- onSuccess={refetchCalendars}
- />
- )}
- <NoteDialog
- open={showNoteDialog}
- onOpenChange={handleNoteDialogChange}
- onSubmit={handleNoteSubmit}
- onDelete={selectedNote ? handleNoteDelete : undefined}
- selectedDate={selectedDate}
- note={selectedNote}
- />
- {calendarToDelete && (
- <DeleteCalendarDialog
- open={showDeleteCalendarDialog}
- onOpenChange={setShowDeleteCalendarDialog}
- calendarName={
- calendars.find((c) => c.id === calendarToDelete)?.name || ""
- }
- hasPassword={
- !!calendars.find((c) => c.id === calendarToDelete)?.passwordHash
- }
- onConfirm={handleDeleteCalendar}
- />
- )}
- {selectedCalendar && (
- <ExternalSyncManageDialog
- open={showExternalSyncDialog}
- onOpenChange={setShowExternalSyncDialog}
- calendarId={selectedCalendar}
- syncErrorRefreshTrigger={syncLogRefreshTrigger}
- onSyncComplete={() => {
- refetchShifts();
- refetchCalendars();
- setStatsRefreshTrigger((prev) => prev + 1);
- // Refetch external syncs to get updated displayMode
- fetchExternalSyncs();
- // Refetch sync error status
- fetchSyncErrorStatus();
- }}
- />
- )}
-
- {/* Day Shifts Dialog */}
- <DayShiftsDialog
- open={showDayShiftsDialog}
- onOpenChange={setShowDayShiftsDialog}
- date={selectedDayDate}
- shifts={selectedDayShifts}
+ showPasswordDialog={dialogStates.showPasswordDialog}
+ onPasswordDialogChange={dialogStates.setShowPasswordDialog}
+ calendars={calendars}
+ onPasswordSuccess={handlePasswordSuccess}
+ showManagePasswordDialog={dialogStates.showManagePasswordDialog}
+ onManagePasswordDialogChange={dialogStates.setShowManagePasswordDialog}
+ onManagePasswordSuccess={refetchCalendars}
+ showDeleteCalendarDialog={dialogStates.showDeleteCalendarDialog}
+ onDeleteCalendarDialogChange={dialogStates.setShowDeleteCalendarDialog}
+ calendarToDelete={dialogStates.calendarToDelete}
+ onDeleteCalendar={handleDeleteCalendar}
+ showExternalSyncDialog={dialogStates.showExternalSyncDialog}
+ onExternalSyncDialogChange={dialogStates.setShowExternalSyncDialog}
+ syncErrorRefreshTrigger={syncLogRefreshTrigger}
+ onSyncComplete={handleSyncComplete}
+ showSyncNotificationDialog={dialogStates.showSyncNotificationDialog}
+ onSyncNotificationDialogChange={
+ dialogStates.setShowSyncNotificationDialog
+ }
+ onErrorsMarkedRead={fetchSyncErrorStatus}
+ onSyncLogUpdate={() => setSyncLogRefreshTrigger((prev) => prev + 1)}
+ showDayShiftsDialog={dialogStates.showDayShiftsDialog}
+ onDayShiftsDialogChange={dialogStates.setShowDayShiftsDialog}
+ selectedDayDate={dialogStates.selectedDayDate}
+ selectedDayShifts={dialogStates.selectedDayShifts}
locale={locale}
- onDeleteShift={handleDeleteShiftFromDayDialog}
- />
-
- {/* Synced Shifts Dialog */}
- <SyncedShiftsDialog
- open={showSyncedShiftsDialog}
- onOpenChange={setShowSyncedShiftsDialog}
- date={selectedDayDate}
- shifts={selectedSyncedShifts}
- />
-
- {/* View Settings Dialog */}
- <ViewSettingsDialog
- open={showViewSettingsDialog}
- onOpenChange={setShowViewSettingsDialog}
- shiftsPerDay={shiftsPerDay}
- externalShiftsPerDay={externalShiftsPerDay}
- showShiftNotes={showShiftNotes}
- showFullTitles={showFullTitles}
- onShiftsPerDayChange={handleShiftsPerDayChange}
- onExternalShiftsPerDayChange={handleExternalShiftsPerDayChange}
- onShowShiftNotesChange={handleShowShiftNotesChange}
- onShowFullTitlesChange={handleShowFullTitlesChange}
+ onDeleteShiftFromDayDialog={handleDeleteShiftFromDayDialog}
+ showSyncedShiftsDialog={dialogStates.showSyncedShiftsDialog}
+ onSyncedShiftsDialogChange={dialogStates.setShowSyncedShiftsDialog}
+ selectedSyncedShifts={dialogStates.selectedSyncedShifts}
+ showViewSettingsDialog={dialogStates.showViewSettingsDialog}
+ onViewSettingsDialogChange={dialogStates.setShowViewSettingsDialog}
+ viewSettings={viewSettings}
+ onViewSettingsChange={{
+ handleShiftsPerDayChange: viewSettings.handleShiftsPerDayChange,
+ handleExternalShiftsPerDayChange:
+ viewSettings.handleExternalShiftsPerDayChange,
+ handleShowShiftNotesChange: viewSettings.handleShowShiftNotesChange,
+ handleShowFullTitlesChange: viewSettings.handleShowFullTitlesChange,
+ handleShiftSortTypeChange: viewSettings.handleShiftSortTypeChange,
+ handleShiftSortOrderChange: viewSettings.handleShiftSortOrderChange,
+ handleCombinedSortModeChange:
+ viewSettings.handleCombinedSortModeChange,
+ }}
+ showNoteDialog={noteActions.showNoteDialog}
+ onNoteDialogChange={noteActions.handleNoteDialogChange}
+ selectedNote={noteActions.selectedNote}
+ selectedNoteDate={noteActions.selectedDate}
+ onNoteSubmit={noteActions.handleNoteSubmit}
+ onNoteDelete={
+ noteActions.selectedNote ? noteActions.handleNoteDelete : undefined
+ }
/>
- {/* Sync Notification Center */}
- {selectedCalendar && (
- <SyncNotificationDialog
- open={showSyncNotificationDialog}
- onOpenChange={setShowSyncNotificationDialog}
- calendarId={selectedCalendar}
- onErrorsMarkedRead={fetchSyncErrorStatus}
- onSyncLogUpdate={() => setSyncLogRefreshTrigger((prev) => prev + 1)}
- syncLogRefreshTrigger={syncLogRefreshTrigger}
- />
- )}
-
- {/* Footer */}
<AppFooter versionInfo={versionInfo} />
</div>
);
diff --git a/components/calendar-content.tsx b/components/calendar-content.tsx
new file mode 100644
index 0000000..5606c87
--- /dev/null
+++ b/components/calendar-content.tsx
@@ -0,0 +1,123 @@
+import { motion } from "motion/react";
+import { useTranslations } from "next-intl";
+import { StickyNote } from "lucide-react";
+import { CalendarGrid } from "@/components/calendar-grid";
+import { ShiftStats } from "@/components/shift-stats";
+import { ShiftsList } from "@/components/shifts-list";
+import { MonthNavigation } from "@/components/month-navigation";
+import { ShiftWithCalendar } from "@/lib/types";
+import { CalendarNote, ExternalSync } from "@/lib/db/schema";
+import { Locale } from "date-fns";
+
+interface CalendarContentProps {
+ calendarDays: Date[];
+ currentDate: Date;
+ onDateChange: (date: Date) => void;
+ shifts: ShiftWithCalendar[];
+ notes: CalendarNote[];
+ selectedPresetId?: string;
+ togglingDates: Set<string>;
+ externalSyncs: ExternalSync[];
+ maxShiftsToShow?: number;
+ maxExternalShiftsToShow?: number;
+ showShiftNotes: boolean;
+ showFullTitles: boolean;
+ shiftSortType: "startTime" | "createdAt" | "title";
+ shiftSortOrder: "asc" | "desc";
+ combinedSortMode: boolean;
+ selectedCalendar: string | null;
+ statsRefreshTrigger: number;
+ shouldHideUIElements: boolean;
+ locale?: Locale;
+ 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;
+ onDeleteShift?: (id: string) => void;
+}
+
+export function CalendarContent(props: CalendarContentProps) {
+ const t = useTranslations();
+
+ return (
+ <>
+ <MonthNavigation
+ currentDate={props.currentDate}
+ onDateChange={props.onDateChange}
+ locale={props.locale}
+ />
+
+ <CalendarGrid
+ calendarDays={props.calendarDays}
+ currentDate={props.currentDate}
+ shifts={props.shifts}
+ notes={props.notes}
+ selectedPresetId={props.selectedPresetId}
+ togglingDates={props.togglingDates}
+ externalSyncs={props.externalSyncs}
+ maxShiftsToShow={props.maxShiftsToShow}
+ maxExternalShiftsToShow={props.maxExternalShiftsToShow}
+ showShiftNotes={props.showShiftNotes}
+ showFullTitles={props.showFullTitles}
+ shiftSortType={props.shiftSortType}
+ shiftSortOrder={props.shiftSortOrder}
+ combinedSortMode={props.combinedSortMode}
+ onDayClick={props.onDayClick}
+ onDayRightClick={props.onDayRightClick}
+ onNoteIconClick={props.onNoteIconClick}
+ onLongPress={props.onLongPress}
+ onShowAllShifts={props.onShowAllShifts}
+ onShowSyncedShifts={props.onShowSyncedShifts}
+ />
+
+ {!props.shouldHideUIElements && (
+ <motion.div
+ className="px-2 sm:px-0 mb-4"
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.3 }}
+ >
+ <div className="bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-xl p-3 sm:p-3.5 backdrop-blur-sm">
+ <div className="flex items-center gap-2.5">
+ <div className="shrink-0 w-8 h-8 rounded-lg bg-primary/20 flex items-center justify-center">
+ <StickyNote className="h-4 w-4 text-orange-500" />
+ </div>
+ <div className="flex-1">
+ <p className="text-xs sm:hidden text-foreground/80 leading-relaxed">
+ {t("note.hintMobile", {
+ default:
+ "Long press on a day to open notes. The note icon shows existing notes.",
+ })}
+ </p>
+ <p className="hidden sm:block text-sm text-foreground/80 leading-relaxed">
+ {t("note.hintDesktop", {
+ default:
+ "Right-click on a day to open notes. The note icon shows existing notes.",
+ })}
+ </p>
+ </div>
+ </div>
+ </div>
+ </motion.div>
+ )}
+
+ <div className="space-y-3 sm:space-y-4 px-2 sm:px-0">
+ <ShiftStats
+ calendarId={props.selectedCalendar || undefined}
+ currentDate={props.currentDate}
+ refreshTrigger={props.statsRefreshTrigger}
+ />
+
+ <ShiftsList
+ shifts={props.shifts}
+ currentDate={props.currentDate}
+ onDeleteShift={
+ props.shouldHideUIElements ? undefined : props.onDeleteShift
+ }
+ />
+ </div>
+ </>
+ );
+}
diff --git a/components/calendar-grid.tsx b/components/calendar-grid.tsx
index c22d399..b53522c 100644
--- a/components/calendar-grid.tsx
+++ b/components/calendar-grid.tsx
@@ -20,6 +20,9 @@ interface CalendarGridProps {
maxExternalShiftsToShow?: number; // undefined = show all (external shifts)
showShiftNotes?: boolean; // show notes in shift cards
showFullTitles?: boolean; // show full titles without truncation
+ shiftSortType?: "startTime" | "createdAt" | "title"; // sort type
+ shiftSortOrder?: "asc" | "desc"; // sort order
+ combinedSortMode?: boolean; // sort all shifts together or separately
onDayClick: (date: Date) => void;
onDayRightClick?: (e: React.MouseEvent, date: Date) => void;
onNoteIconClick?: (e: React.MouseEvent, date: Date) => void;
@@ -40,6 +43,9 @@ export function CalendarGrid({
maxExternalShiftsToShow,
showShiftNotes = false,
showFullTitles = false,
+ shiftSortType = "createdAt",
+ shiftSortOrder = "asc",
+ combinedSortMode = false,
onDayClick,
onDayRightClick,
onNoteIconClick,
@@ -74,6 +80,30 @@ export function CalendarGrid({
);
};
+ const sortShifts = (shiftsToSort: ShiftWithCalendar[]) => {
+ return [...shiftsToSort].sort((a, b) => {
+ let comparison = 0;
+
+ switch (shiftSortType) {
+ case "startTime":
+ comparison = a.startTime.localeCompare(b.startTime);
+ break;
+ case "createdAt": {
+ // Handle null values by treating them as very old dates
+ const aTime = a.createdAt ? new Date(a.createdAt).getTime() : 0;
+ const bTime = b.createdAt ? new Date(b.createdAt).getTime() : 0;
+ comparison = aTime - bTime;
+ break;
+ }
+ case "title":
+ comparison = a.title.localeCompare(b.title);
+ break;
+ }
+
+ return shiftSortOrder === "asc" ? comparison : -comparison;
+ });
+ };
+
return (
<div className="grid grid-cols-7 gap-0 sm:gap-1.5 mb-6">
{[
@@ -218,73 +248,140 @@ export function CalendarGrid({
return sync && sync.displayMode === "normal";
});
+ // Apply sorting based on mode
+ let sortedRegularShifts: ShiftWithCalendar[];
+ let sortedExternalNormalShifts: ShiftWithCalendar[];
+ let allSortedShifts: ShiftWithCalendar[];
+
+ if (combinedSortMode) {
+ // Combined mode: sort all shifts together
+ const allNormalShifts = [
+ ...regularShifts,
+ ...externalNormalShifts,
+ ];
+ allSortedShifts = sortShifts(allNormalShifts);
+ sortedRegularShifts = [];
+ sortedExternalNormalShifts = [];
+ } else {
+ // Separate mode: sort each group separately
+ sortedRegularShifts = sortShifts(regularShifts);
+ sortedExternalNormalShifts = sortShifts(externalNormalShifts);
+ allSortedShifts = [];
+ }
+
return (
<>
- {/* Display regular shifts */}
- {(maxShiftsToShow === undefined
- ? regularShifts
- : regularShifts.slice(0, maxShiftsToShow)
- ).map((shift) => (
- <CalendarShiftCard
- key={shift.id}
- shift={shift}
- showShiftNotes={showShiftNotes}
- showFullTitles={showFullTitles}
- />
- ))}
+ {combinedSortMode ? (
+ // Combined mode: display all shifts together
+ <>
+ {(maxShiftsToShow === undefined
+ ? allSortedShifts
+ : allSortedShifts.slice(0, maxShiftsToShow)
+ ).map((shift) => (
+ <CalendarShiftCard
+ key={shift.id}
+ shift={shift}
+ showShiftNotes={showShiftNotes}
+ showFullTitles={showFullTitles}
+ />
+ ))}
- {/* Show "+X more" for regular shifts if limited by maxShiftsToShow */}
- {maxShiftsToShow !== undefined &&
- regularShifts.length > maxShiftsToShow && (
- <div
- onClick={(e) => {
- if (selectedPresetId) return;
- e.stopPropagation();
- onShowAllShifts?.(day, regularShifts);
- }}
- 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"
- }`}
- >
- +{regularShifts.length - maxShiftsToShow}
- </div>
- )}
+ {/* Show "+X more" if limited by maxShiftsToShow */}
+ {maxShiftsToShow !== undefined &&
+ allSortedShifts.length > maxShiftsToShow && (
+ <div
+ onClick={(e) => {
+ if (selectedPresetId) return;
+ e.stopPropagation();
+ onShowAllShifts?.(day, allSortedShifts);
+ }}
+ 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"
+ }`}
+ >
+ +{allSortedShifts.length - maxShiftsToShow}
+ </div>
+ )}
+ </>
+ ) : (
+ // Separate mode: display regular and external shifts separately
+ <>
+ {/* Display regular shifts */}
+ {(maxShiftsToShow === undefined
+ ? sortedRegularShifts
+ : sortedRegularShifts.slice(0, maxShiftsToShow)
+ ).map((shift) => (
+ <CalendarShiftCard
+ key={shift.id}
+ shift={shift}
+ showShiftNotes={showShiftNotes}
+ showFullTitles={showFullTitles}
+ />
+ ))}
- {/* Display external shifts with normal display mode */}
- {(maxExternalShiftsToShow === undefined
- ? externalNormalShifts
- : externalNormalShifts.slice(0, maxExternalShiftsToShow)
- ).map((shift) => (
- <CalendarShiftCard
- key={shift.id}
- shift={shift}
- showShiftNotes={showShiftNotes}
- showFullTitles={showFullTitles}
- />
- ))}
+ {/* Show "+X more" for regular shifts if limited by maxShiftsToShow */}
+ {maxShiftsToShow !== undefined &&
+ sortedRegularShifts.length > maxShiftsToShow && (
+ <div
+ onClick={(e) => {
+ if (selectedPresetId) return;
+ e.stopPropagation();
+ onShowAllShifts?.(day, sortedRegularShifts);
+ }}
+ 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"
+ }`}
+ >
+ +{sortedRegularShifts.length - maxShiftsToShow}
+ </div>
+ )}
- {/* Show "+X more" for external shifts if limited by maxExternalShiftsToShow */}
- {maxExternalShiftsToShow !== undefined &&
- externalNormalShifts.length > maxExternalShiftsToShow && (
- <div
- onClick={(e) => {
- if (selectedPresetId) return;
- e.stopPropagation();
- onShowAllShifts?.(day, externalNormalShifts);
- }}
- 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"
- }`}
- >
- +
- {externalNormalShifts.length -
- maxExternalShiftsToShow}
- </div>
- )}
+ {/* Display external shifts with normal display mode */}
+ {(maxExternalShiftsToShow === undefined
+ ? sortedExternalNormalShifts
+ : sortedExternalNormalShifts.slice(
+ 0,
+ maxExternalShiftsToShow
+ )
+ ).map((shift) => (
+ <CalendarShiftCard
+ key={shift.id}
+ shift={shift}
+ showShiftNotes={showShiftNotes}
+ showFullTitles={showFullTitles}
+ />
+ ))}
+
+ {/* Show "+X more" for external shifts if limited by maxExternalShiftsToShow */}
+ {maxExternalShiftsToShow !== undefined &&
+ sortedExternalNormalShifts.length >
+ maxExternalShiftsToShow && (
+ <div
+ onClick={(e) => {
+ if (selectedPresetId) return;
+ e.stopPropagation();
+ onShowAllShifts?.(
+ day,
+ sortedExternalNormalShifts
+ );
+ }}
+ 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"
+ }`}
+ >
+ +
+ {sortedExternalNormalShifts.length -
+ maxExternalShiftsToShow}
+ </div>
+ )}
+ </>
+ )}
{/* Show minimal badges for each sync with minimal display mode */}
{Object.entries(syncedShiftsByMode).map(
diff --git a/components/dialog-manager.tsx b/components/dialog-manager.tsx
new file mode 100644
index 0000000..18d6173
--- /dev/null
+++ b/components/dialog-manager.tsx
@@ -0,0 +1,252 @@
+import { CalendarDialog } from "@/components/calendar-dialog";
+import { ShiftDialog, ShiftFormData } from "@/components/shift-dialog";
+import { PasswordDialog } from "@/components/password-dialog";
+import { ManagePasswordDialog } from "@/components/manage-password-dialog";
+import { DeleteCalendarDialog } from "@/components/delete-calendar-dialog";
+import { ExternalSyncManageDialog } from "@/components/external-sync-manage-dialog";
+import { SyncNotificationDialog } from "@/components/sync-notification-dialog";
+import { DayShiftsDialog } from "@/components/day-shifts-dialog";
+import { SyncedShiftsDialog } from "@/components/synced-shifts-dialog";
+import { ViewSettingsDialog } from "@/components/view-settings-dialog";
+import { NoteDialog } from "@/components/note-dialog";
+import { CalendarWithCount, ShiftWithCalendar } from "@/lib/types";
+import { CalendarNote } from "@/lib/db/schema";
+
+interface DialogManagerProps {
+ // Calendar Dialog
+ showCalendarDialog: boolean;
+ onCalendarDialogChange: (open: boolean) => void;
+ onCreateCalendar: (
+ name: string,
+ color: string,
+ password?: string
+ ) => Promise<void>;
+
+ // Shift Dialog
+ showShiftDialog: boolean;
+ onShiftDialogChange: (open: boolean) => void;
+ onShiftSubmit: (data: ShiftFormData) => void;
+ selectedDate?: Date;
+ selectedCalendar: string | null;
+ onPresetsChange: () => void;
+
+ // Password Dialog
+ showPasswordDialog: boolean;
+ onPasswordDialogChange: (open: boolean) => void;
+ calendars: CalendarWithCount[];
+ onPasswordSuccess: (password: string) => void;
+
+ // Manage Password Dialog
+ showManagePasswordDialog: boolean;
+ onManagePasswordDialogChange: (open: boolean) => void;
+ onManagePasswordSuccess: () => void;
+
+ // Delete Calendar Dialog
+ showDeleteCalendarDialog: boolean;
+ onDeleteCalendarDialogChange: (open: boolean) => void;
+ calendarToDelete?: string;
+ onDeleteCalendar: (password?: string) => void;
+
+ // External Sync Dialog
+ showExternalSyncDialog: boolean;
+ onExternalSyncDialogChange: (open: boolean) => void;
+ syncErrorRefreshTrigger: number;
+ onSyncComplete: () => void;
+
+ // Sync Notification Dialog
+ showSyncNotificationDialog: boolean;
+ onSyncNotificationDialogChange: (open: boolean) => void;
+ onErrorsMarkedRead: () => void;
+ onSyncLogUpdate: () => void;
+
+ // Day Shifts Dialog
+ showDayShiftsDialog: boolean;
+ onDayShiftsDialogChange: (open: boolean) => void;
+ selectedDayDate: Date | null;
+ selectedDayShifts: ShiftWithCalendar[];
+ locale: string;
+ onDeleteShiftFromDayDialog: (id: string) => void;
+
+ // Synced Shifts Dialog
+ showSyncedShiftsDialog: boolean;
+ onSyncedShiftsDialogChange: (open: boolean) => void;
+ selectedSyncedShifts: ShiftWithCalendar[];
+
+ // View Settings Dialog
+ showViewSettingsDialog: boolean;
+ onViewSettingsDialogChange: (open: boolean) => void;
+ viewSettings: {
+ shiftsPerDay: number | null;
+ externalShiftsPerDay: number | null;
+ showShiftNotes: boolean;
+ showFullTitles: boolean;
+ shiftSortType: "startTime" | "createdAt" | "title";
+ shiftSortOrder: "asc" | "desc";
+ combinedSortMode: boolean;
+ };
+ onViewSettingsChange: {
+ handleShiftsPerDayChange: (count: number | null) => void;
+ handleExternalShiftsPerDayChange: (count: number | null) => void;
+ handleShowShiftNotesChange: (show: boolean) => void;
+ handleShowFullTitlesChange: (show: boolean) => void;
+ handleShiftSortTypeChange: (
+ type: "startTime" | "createdAt" | "title"
+ ) => void;
+ handleShiftSortOrderChange: (order: "asc" | "desc") => void;
+ handleCombinedSortModeChange: (combined: boolean) => void;
+ };
+
+ // Note Dialog
+ showNoteDialog: boolean;
+ onNoteDialogChange: (open: boolean) => void;
+ selectedNote: CalendarNote | undefined;
+ selectedNoteDate?: Date;
+ onNoteSubmit: (text: string) => void;
+ onNoteDelete?: () => void;
+}
+
+export function DialogManager(props: DialogManagerProps) {
+ return (
+ <>
+ <CalendarDialog
+ open={props.showCalendarDialog}
+ onOpenChange={props.onCalendarDialogChange}
+ onSubmit={props.onCreateCalendar}
+ />
+
+ <ShiftDialog
+ open={props.showShiftDialog}
+ onOpenChange={props.onShiftDialogChange}
+ onSubmit={props.onShiftSubmit}
+ selectedDate={props.selectedDate}
+ onPresetsChange={props.onPresetsChange}
+ calendarId={props.selectedCalendar || undefined}
+ />
+
+ {props.selectedCalendar && (
+ <>
+ <PasswordDialog
+ open={props.showPasswordDialog}
+ onOpenChange={props.onPasswordDialogChange}
+ calendarId={props.selectedCalendar}
+ calendarName={
+ props.calendars.find((c) => c.id === props.selectedCalendar)
+ ?.name || ""
+ }
+ onSuccess={props.onPasswordSuccess}
+ />
+
+ <ManagePasswordDialog
+ open={props.showManagePasswordDialog}
+ onOpenChange={props.onManagePasswordDialogChange}
+ calendarId={props.selectedCalendar}
+ calendarName={
+ props.calendars.find((c) => c.id === props.selectedCalendar)
+ ?.name || ""
+ }
+ hasPassword={
+ !!props.calendars.find((c) => c.id === props.selectedCalendar)
+ ?.passwordHash
+ }
+ isLocked={
+ props.calendars.find((c) => c.id === props.selectedCalendar)
+ ?.isLocked || false
+ }
+ onSuccess={props.onManagePasswordSuccess}
+ />
+
+ <ExternalSyncManageDialog
+ open={props.showExternalSyncDialog}
+ onOpenChange={props.onExternalSyncDialogChange}
+ calendarId={props.selectedCalendar}
+ syncErrorRefreshTrigger={props.syncErrorRefreshTrigger}
+ onSyncComplete={props.onSyncComplete}
+ />
+
+ <SyncNotificationDialog
+ open={props.showSyncNotificationDialog}
+ onOpenChange={props.onSyncNotificationDialogChange}
+ calendarId={props.selectedCalendar}
+ onErrorsMarkedRead={props.onErrorsMarkedRead}
+ onSyncLogUpdate={props.onSyncLogUpdate}
+ syncLogRefreshTrigger={props.syncErrorRefreshTrigger}
+ />
+ </>
+ )}
+
+ {props.calendarToDelete && (
+ <DeleteCalendarDialog
+ open={props.showDeleteCalendarDialog}
+ onOpenChange={props.onDeleteCalendarDialogChange}
+ calendarName={
+ props.calendars.find((c) => c.id === props.calendarToDelete)
+ ?.name || ""
+ }
+ hasPassword={
+ !!props.calendars.find((c) => c.id === props.calendarToDelete)
+ ?.passwordHash
+ }
+ onConfirm={props.onDeleteCalendar}
+ />
+ )}
+
+ <DayShiftsDialog
+ open={props.showDayShiftsDialog}
+ onOpenChange={props.onDayShiftsDialogChange}
+ date={props.selectedDayDate}
+ shifts={props.selectedDayShifts}
+ locale={props.locale}
+ onDeleteShift={props.onDeleteShiftFromDayDialog}
+ />
+
+ <SyncedShiftsDialog
+ open={props.showSyncedShiftsDialog}
+ onOpenChange={props.onSyncedShiftsDialogChange}
+ date={props.selectedDayDate}
+ shifts={props.selectedSyncedShifts}
+ />
+
+ <ViewSettingsDialog
+ open={props.showViewSettingsDialog}
+ onOpenChange={props.onViewSettingsDialogChange}
+ shiftsPerDay={props.viewSettings.shiftsPerDay}
+ externalShiftsPerDay={props.viewSettings.externalShiftsPerDay}
+ showShiftNotes={props.viewSettings.showShiftNotes}
+ showFullTitles={props.viewSettings.showFullTitles}
+ shiftSortType={props.viewSettings.shiftSortType}
+ shiftSortOrder={props.viewSettings.shiftSortOrder}
+ combinedSortMode={props.viewSettings.combinedSortMode}
+ onShiftsPerDayChange={
+ props.onViewSettingsChange.handleShiftsPerDayChange
+ }
+ onExternalShiftsPerDayChange={
+ props.onViewSettingsChange.handleExternalShiftsPerDayChange
+ }
+ onShowShiftNotesChange={
+ props.onViewSettingsChange.handleShowShiftNotesChange
+ }
+ onShowFullTitlesChange={
+ props.onViewSettingsChange.handleShowFullTitlesChange
+ }
+ onShiftSortTypeChange={
+ props.onViewSettingsChange.handleShiftSortTypeChange
+ }
+ onShiftSortOrderChange={
+ props.onViewSettingsChange.handleShiftSortOrderChange
+ }
+ onCombinedSortModeChange={
+ props.onViewSettingsChange.handleCombinedSortModeChange
+ }
+ />
+
+ <NoteDialog
+ open={props.showNoteDialog}
+ onOpenChange={props.onNoteDialogChange}
+ onSubmit={props.onNoteSubmit}
+ onDelete={props.onNoteDelete}
+ selectedDate={props.selectedNoteDate}
+ note={props.selectedNote}
+ />
+ </>
+ );
+}
diff --git a/components/empty-calendar-state.tsx b/components/empty-calendar-state.tsx
new file mode 100644
index 0000000..ecf210f
--- /dev/null
+++ b/components/empty-calendar-state.tsx
@@ -0,0 +1,59 @@
+import { motion } from "motion/react";
+import { useTranslations } from "next-intl";
+import { Button } from "@/components/ui/button";
+import { LanguageSwitcher } from "@/components/language-switcher";
+import { Calendar as CalendarIcon, Plus } from "lucide-react";
+
+interface EmptyCalendarStateProps {
+ onCreateCalendar: () => void;
+}
+
+export function EmptyCalendarState({
+ onCreateCalendar,
+}: EmptyCalendarStateProps) {
+ const t = useTranslations();
+
+ return (
+ <div className="min-h-screen flex flex-col">
+ <div className="flex-1 flex items-center justify-center p-4">
+ <motion.div
+ className="text-center space-y-6 max-w-md"
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ >
+ <motion.div
+ initial={{ scale: 0 }}
+ animate={{ scale: 1 }}
+ transition={{ delay: 0.1, type: "spring", stiffness: 200 }}
+ className="w-20 h-20 mx-auto rounded-full bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center"
+ >
+ <CalendarIcon className="h-10 w-10 text-primary" />
+ </motion.div>
+ <div className="space-y-3">
+ <h1 className="text-2xl sm:text-3xl font-bold">
+ {t("onboarding.welcome")}
+ </h1>
+ <p className="text-muted-foreground text-sm sm:text-base leading-relaxed">
+ {t("onboarding.description")}
+ </p>
+ </div>
+ <motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}>
+ <Button
+ onClick={onCreateCalendar}
+ size="lg"
+ className="h-12 px-8 text-base font-semibold shadow-lg shadow-primary/20"
+ >
+ <Plus className="mr-2 h-5 w-5" />
+ {t("onboarding.createCalendar")}
+ </Button>
+ </motion.div>
+ </motion.div>
+ </div>
+ <div className="border-t bg-background">
+ <div className="container max-w-4xl mx-auto p-3 sm:p-4 flex justify-center">
+ <LanguageSwitcher />
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/components/loading-state.tsx b/components/loading-state.tsx
new file mode 100644
index 0000000..2988bc0
--- /dev/null
+++ b/components/loading-state.tsx
@@ -0,0 +1,27 @@
+import { motion } from "motion/react";
+import { useTranslations } from "next-intl";
+import { Calendar as CalendarIcon } from "lucide-react";
+
+export function LoadingState() {
+ const t = useTranslations();
+
+ return (
+ <div className="min-h-screen flex items-center justify-center bg-gradient-to-b from-background to-muted/20">
+ <motion.div
+ className="text-center space-y-4"
+ initial={{ opacity: 0, scale: 0.9 }}
+ animate={{ opacity: 1, scale: 1 }}
+ >
+ <motion.div
+ animate={{ rotate: 360 }}
+ transition={{ duration: 2, repeat: Infinity, ease: "linear" }}
+ >
+ <CalendarIcon className="h-12 w-12 sm:h-16 sm:w-16 mx-auto text-primary" />
+ </motion.div>
+ <p className="text-sm sm:text-base text-muted-foreground font-medium">
+ {t("common.loading")}
+ </p>
+ </motion.div>
+ </div>
+ );
+}
diff --git a/components/locked-calendar-view.tsx b/components/locked-calendar-view.tsx
new file mode 100644
index 0000000..999d26e
--- /dev/null
+++ b/components/locked-calendar-view.tsx
@@ -0,0 +1,79 @@
+import { motion } from "motion/react";
+import { useTranslations } from "next-intl";
+import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Calendar as CalendarIcon } from "lucide-react";
+import { verifyAndCachePassword } from "@/lib/password-cache";
+
+interface LockedCalendarViewProps {
+ calendarId: string;
+ onUnlock: (password: string) => void;
+}
+
+export function LockedCalendarView({
+ calendarId,
+ onUnlock,
+}: LockedCalendarViewProps) {
+ const t = useTranslations();
+
+ const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
+ e.preventDefault();
+ const formData = new FormData(e.currentTarget);
+ const password = formData.get("password") as string;
+
+ if (password && calendarId) {
+ const result = await verifyAndCachePassword(calendarId, password);
+
+ if (result.valid) {
+ onUnlock(password);
+ } else {
+ toast.error(t("validation.passwordIncorrect"));
+ }
+ }
+ };
+
+ return (
+ <div className="flex flex-col items-center justify-center py-20">
+ <motion.div
+ initial={{ opacity: 0, y: 20 }}
+ animate={{ opacity: 1, y: 0 }}
+ className="w-full max-w-md"
+ >
+ <div className="bg-gradient-to-b from-background via-background to-muted/30 backdrop-blur-xl shadow-2xl border border-border/50 rounded-2xl p-8">
+ <div className="w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mb-6 mx-auto">
+ <CalendarIcon className="h-10 w-10 text-primary" />
+ </div>
+ <h3 className="text-2xl font-semibold mb-2 text-center">
+ {t("password.currentlyLocked")}
+ </h3>
+ <p className="text-muted-foreground text-center mb-8">
+ {t("password.enterCalendarPassword")}
+ </p>
+ <form onSubmit={handleSubmit} className="space-y-4">
+ <div className="space-y-2">
+ <Label htmlFor="unlock-password" className="text-sm font-medium">
+ {t("form.passwordLabel")}
+ </Label>
+ <Input
+ id="unlock-password"
+ name="password"
+ type="password"
+ placeholder={t("form.passwordPlaceholder")}
+ className="h-11 border-primary/30 focus:border-primary/50 focus:ring-primary/20"
+ autoFocus
+ />
+ </div>
+ <Button
+ type="submit"
+ className="w-full h-11 bg-gradient-to-r from-primary to-primary/90 hover:from-primary/90 hover:to-primary/80 shadow-lg shadow-primary/25"
+ >
+ {t("common.unlock")}
+ </Button>
+ </form>
+ </div>
+ </motion.div>
+ </div>
+ );
+}
diff --git a/components/month-navigation.tsx b/components/month-navigation.tsx
new file mode 100644
index 0000000..d5d91e7
--- /dev/null
+++ b/components/month-navigation.tsx
@@ -0,0 +1,51 @@
+import { motion } from "motion/react";
+import { Button } from "@/components/ui/button";
+import { ChevronLeft, ChevronRight } from "lucide-react";
+import { format, addMonths, subMonths, Locale } from "date-fns";
+
+interface MonthNavigationProps {
+ currentDate: Date;
+ onDateChange: (date: Date) => void;
+ locale?: Locale;
+}
+
+export function MonthNavigation({
+ currentDate,
+ onDateChange,
+ locale,
+}: MonthNavigationProps) {
+ return (
+ <motion.div
+ className="flex items-center justify-between mb-4 sm:mb-5 px-2 sm:px-0"
+ initial={{ opacity: 0, y: -10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.3 }}
+ >
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-10 w-10 sm:h-11 sm:w-11 rounded-full active:scale-95 transition-transform"
+ onClick={() => onDateChange(subMonths(currentDate, 1))}
+ >
+ <ChevronLeft className="h-5 w-5" />
+ </Button>
+ <motion.h2
+ className="text-lg sm:text-xl font-bold"
+ key={format(currentDate, "MMMM yyyy")}
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.2 }}
+ >
+ {format(currentDate, "MMMM yyyy", { locale })}
+ </motion.h2>
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-10 w-10 sm:h-11 sm:w-11 rounded-full active:scale-95 transition-transform"
+ onClick={() => onDateChange(addMonths(currentDate, 1))}
+ >
+ <ChevronRight className="h-5 w-5" />
+ </Button>
+ </motion.div>
+ );
+}
diff --git a/components/view-settings-dialog.tsx b/components/view-settings-dialog.tsx
index 83a21e0..732145b 100644
--- a/components/view-settings-dialog.tsx
+++ b/components/view-settings-dialog.tsx
@@ -11,7 +11,14 @@ import {
import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label";
import { Slider } from "@/components/ui/slider";
-import { Maximize2, FileText, Infinity } from "lucide-react";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { Maximize2, FileText, Infinity, ArrowUpDown } from "lucide-react";
interface ViewSettingsDialogProps {
open: boolean;
@@ -20,10 +27,16 @@ interface ViewSettingsDialogProps {
externalShiftsPerDay: number | null;
showShiftNotes: boolean;
showFullTitles: boolean;
+ shiftSortType: "startTime" | "createdAt" | "title";
+ shiftSortOrder: "asc" | "desc";
+ combinedSortMode: boolean;
onShiftsPerDayChange: (count: number | null) => void;
onExternalShiftsPerDayChange: (count: number | null) => void;
onShowShiftNotesChange: (show: boolean) => void;
onShowFullTitlesChange: (show: boolean) => void;
+ onShiftSortTypeChange: (type: "startTime" | "createdAt" | "title") => void;
+ onShiftSortOrderChange: (order: "asc" | "desc") => void;
+ onCombinedSortModeChange: (combined: boolean) => void;
}
export function ViewSettingsDialog({
@@ -33,10 +46,16 @@ export function ViewSettingsDialog({
externalShiftsPerDay,
showShiftNotes,
showFullTitles,
+ shiftSortType,
+ shiftSortOrder,
+ combinedSortMode,
onShiftsPerDayChange,
onExternalShiftsPerDayChange,
onShowShiftNotesChange,
onShowFullTitlesChange,
+ onShiftSortTypeChange,
+ onShiftSortOrderChange,
+ onCombinedSortModeChange,
}: ViewSettingsDialogProps) {
const t = useTranslations();
@@ -147,6 +166,84 @@ export function ViewSettingsDialog({
</p>
</div>
+ {/* Shift Sorting */}
+ <div className="space-y-4">
+ <div className="flex items-center gap-2">
+ <ArrowUpDown className="h-4 w-4 text-primary" />
+ <Label className="text-sm font-semibold">
+ {t("view.sortOptions")}
+ </Label>
+ </div>
+ <div className="space-y-3 pl-6 border-l-2 border-border/50">
+ <div className="space-y-2">
+ <Label className="text-xs text-muted-foreground">
+ {t("view.sortBy")}
+ </Label>
+ <Select
+ value={shiftSortType}
+ onValueChange={onShiftSortTypeChange}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="startTime">
+ {t("view.sortByStartTime")}
+ </SelectItem>
+ <SelectItem value="createdAt">
+ {t("view.sortByCreatedAt")}
+ </SelectItem>
+ <SelectItem value="title">
+ {t("view.sortByTitle")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+
+ <div className="space-y-2">
+ <Label className="text-xs text-muted-foreground">
+ {t("view.sortOrder")}
+ </Label>
+ <Select
+ value={shiftSortOrder}
+ onValueChange={onShiftSortOrderChange}
+ >
+ <SelectTrigger className="w-full">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="asc">
+ {t("view.sortOrderAsc")}
+ </SelectItem>
+ <SelectItem value="desc">
+ {t("view.sortOrderDesc")}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+
+ <div className="flex items-start gap-3 pt-2">
+ <Checkbox
+ id="combined-sort"
+ checked={combinedSortMode}
+ onCheckedChange={onCombinedSortModeChange}
+ className="mt-0.5"
+ />
+ <div className="flex-1 space-y-1">
+ <Label
+ htmlFor="combined-sort"
+ className="text-sm font-medium cursor-pointer"
+ >
+ {t("view.combinedSort")}
+ </Label>
+ <p className="text-xs text-muted-foreground">
+ {t("view.combinedSortHint")}
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+
{/* Show Shift Notes */}
<div className="space-y-3">
<div className="flex items-center gap-2">
diff --git a/hooks/useDialogStates.ts b/hooks/useDialogStates.ts
new file mode 100644
index 0000000..7c03198
--- /dev/null
+++ b/hooks/useDialogStates.ts
@@ -0,0 +1,64 @@
+import { useState } from "react";
+import { ShiftWithCalendar } from "@/lib/types";
+
+export function useDialogStates() {
+ const [showCalendarDialog, setShowCalendarDialog] = useState(false);
+ const [showShiftDialog, setShowShiftDialog] = useState(false);
+ const [showPasswordDialog, setShowPasswordDialog] = useState(false);
+ const [showManagePasswordDialog, setShowManagePasswordDialog] =
+ useState(false);
+ const [showMobileCalendarDialog, setShowMobileCalendarDialog] =
+ useState(false);
+ const [showDeleteCalendarDialog, setShowDeleteCalendarDialog] =
+ useState(false);
+ const [showExternalSyncDialog, setShowExternalSyncDialog] = useState(false);
+ const [showSyncNotificationDialog, setShowSyncNotificationDialog] =
+ useState(false);
+ const [showDayShiftsDialog, setShowDayShiftsDialog] = useState(false);
+ const [showSyncedShiftsDialog, setShowSyncedShiftsDialog] = useState(false);
+ const [showViewSettingsDialog, setShowViewSettingsDialog] = 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
+ >();
+
+ return {
+ showCalendarDialog,
+ setShowCalendarDialog,
+ showShiftDialog,
+ setShowShiftDialog,
+ showPasswordDialog,
+ setShowPasswordDialog,
+ showManagePasswordDialog,
+ setShowManagePasswordDialog,
+ showMobileCalendarDialog,
+ setShowMobileCalendarDialog,
+ showDeleteCalendarDialog,
+ setShowDeleteCalendarDialog,
+ showExternalSyncDialog,
+ setShowExternalSyncDialog,
+ showSyncNotificationDialog,
+ setShowSyncNotificationDialog,
+ showDayShiftsDialog,
+ setShowDayShiftsDialog,
+ showSyncedShiftsDialog,
+ setShowSyncedShiftsDialog,
+ showViewSettingsDialog,
+ setShowViewSettingsDialog,
+ selectedDayDate,
+ setSelectedDayDate,
+ selectedDayShifts,
+ setSelectedDayShifts,
+ selectedSyncedShifts,
+ setSelectedSyncedShifts,
+ calendarToDelete,
+ setCalendarToDelete,
+ };
+}
diff --git a/hooks/useExternalSync.ts b/hooks/useExternalSync.ts
new file mode 100644
index 0000000..7962619
--- /dev/null
+++ b/hooks/useExternalSync.ts
@@ -0,0 +1,76 @@
+import { useState, useEffect, useCallback } from "react";
+import { ExternalSync } from "@/lib/db/schema";
+import { getCachedPassword } from "@/lib/password-cache";
+
+export function useExternalSync(selectedCalendar: string | null) {
+ const [externalSyncs, setExternalSyncs] = useState<ExternalSync[]>([]);
+ const [hasSyncErrors, setHasSyncErrors] = useState(false);
+ const [syncLogRefreshTrigger, setSyncLogRefreshTrigger] = useState(0);
+
+ const fetchExternalSyncs = useCallback(async () => {
+ if (!selectedCalendar) {
+ setExternalSyncs([]);
+ setHasSyncErrors(false);
+ return;
+ }
+
+ try {
+ const password = getCachedPassword(selectedCalendar);
+ const params = new URLSearchParams({ calendarId: selectedCalendar });
+ if (password) {
+ params.append("password", password);
+ }
+
+ const response = await fetch(`/api/external-syncs?${params}`);
+ if (response.ok) {
+ const data = await response.json();
+ setExternalSyncs(data);
+ }
+ } catch (error) {
+ console.error("Failed to fetch external syncs:", error);
+ }
+ }, [selectedCalendar]);
+
+ const fetchSyncErrorStatus = useCallback(async () => {
+ if (!selectedCalendar) {
+ setHasSyncErrors(false);
+ return;
+ }
+
+ try {
+ const password = getCachedPassword(selectedCalendar);
+ const params = new URLSearchParams({
+ calendarId: selectedCalendar,
+ limit: "50",
+ });
+ if (password) {
+ params.append("password", password);
+ }
+
+ const response = await fetch(`/api/sync-logs?${params}`);
+ if (response.ok) {
+ const logs = await response.json();
+ const hasErrors = logs.some(
+ (log: any) => log.status === "error" && !log.isRead
+ );
+ setHasSyncErrors(hasErrors);
+ }
+ } catch (error) {
+ console.error("Failed to fetch sync logs:", error);
+ }
+ }, [selectedCalendar]);
+
+ useEffect(() => {
+ fetchExternalSyncs();
+ fetchSyncErrorStatus();
+ }, [fetchExternalSyncs, fetchSyncErrorStatus]);
+
+ return {
+ externalSyncs,
+ hasSyncErrors,
+ syncLogRefreshTrigger,
+ setSyncLogRefreshTrigger,
+ fetchExternalSyncs,
+ fetchSyncErrorStatus,
+ };
+}
diff --git a/hooks/useNoteActions.ts b/hooks/useNoteActions.ts
new file mode 100644
index 0000000..a405a9a
--- /dev/null
+++ b/hooks/useNoteActions.ts
@@ -0,0 +1,97 @@
+import { useState, useCallback } from "react";
+import { CalendarNote } from "@/lib/db/schema";
+
+interface UseNoteActionsProps {
+ createNote: (
+ text: string,
+ date: Date,
+ onPasswordRequired: () => void
+ ) => Promise<boolean>;
+ updateNote: (
+ id: string,
+ text: string,
+ onPasswordRequired: () => void
+ ) => Promise<boolean>;
+ deleteNote: (id: string, onPasswordRequired: () => void) => Promise<boolean>;
+ onPasswordRequired: (action: () => Promise<void>) => void;
+}
+
+export function useNoteActions({
+ createNote,
+ updateNote,
+ deleteNote,
+ onPasswordRequired,
+}: UseNoteActionsProps) {
+ const [selectedNote, setSelectedNote] = useState<CalendarNote | undefined>();
+ const [selectedDate, setSelectedDate] = useState<Date | undefined>();
+ const [showNoteDialog, setShowNoteDialog] = useState(false);
+
+ const handleNoteSubmit = useCallback(
+ async (noteText: string) => {
+ const handlePasswordRequired = () => {
+ onPasswordRequired(async () => {
+ if (selectedNote) {
+ await updateNote(selectedNote.id, noteText, handlePasswordRequired);
+ } else if (selectedDate) {
+ await createNote(noteText, selectedDate, handlePasswordRequired);
+ }
+ });
+ };
+
+ if (selectedNote) {
+ await updateNote(selectedNote.id, noteText, handlePasswordRequired);
+ } else if (selectedDate) {
+ await createNote(noteText, selectedDate, handlePasswordRequired);
+ }
+ },
+ [selectedNote, selectedDate, createNote, updateNote, onPasswordRequired]
+ );
+
+ const handleNoteDelete = useCallback(async () => {
+ if (!selectedNote) return;
+
+ const handlePasswordRequired = () => {
+ onPasswordRequired(async () => {
+ if (selectedNote) {
+ const success = await deleteNote(
+ selectedNote.id,
+ handlePasswordRequired
+ );
+ if (success) {
+ setShowNoteDialog(false);
+ setSelectedNote(undefined);
+ }
+ }
+ });
+ };
+
+ const success = await deleteNote(selectedNote.id, handlePasswordRequired);
+ if (success) {
+ setShowNoteDialog(false);
+ }
+ }, [selectedNote, deleteNote, onPasswordRequired]);
+
+ const openNoteDialog = useCallback((date: Date, note?: CalendarNote) => {
+ setSelectedDate(date);
+ setSelectedNote(note);
+ setShowNoteDialog(true);
+ }, []);
+
+ const handleNoteDialogChange = useCallback((open: boolean) => {
+ setShowNoteDialog(open);
+ if (!open) {
+ setSelectedNote(undefined);
+ setSelectedDate(undefined);
+ }
+ }, []);
+
+ return {
+ selectedNote,
+ selectedDate,
+ showNoteDialog,
+ handleNoteSubmit,
+ handleNoteDelete,
+ openNoteDialog,
+ handleNoteDialogChange,
+ };
+}
diff --git a/hooks/usePasswordManagement.ts b/hooks/usePasswordManagement.ts
new file mode 100644
index 0000000..07e3052
--- /dev/null
+++ b/hooks/usePasswordManagement.ts
@@ -0,0 +1,136 @@
+import { useState, useEffect, useMemo, useCallback } from "react";
+import {
+ getCachedPassword,
+ verifyAndCachePassword,
+} from "@/lib/password-cache";
+import { CalendarWithCount } from "@/lib/types";
+import { ShiftFormData } from "@/components/shift-dialog";
+
+export interface PendingAction {
+ type: "delete" | "edit" | "syncNotifications";
+ shiftId?: string;
+ formData?: ShiftFormData;
+ presetAction?: () => Promise<void>;
+ noteAction?: () => Promise<void>;
+ action?: () => Promise<void>;
+}
+
+export function usePasswordManagement(
+ selectedCalendar: string | null,
+ calendars: CalendarWithCount[]
+) {
+ const [pendingAction, setPendingAction] = useState<PendingAction | null>(
+ null
+ );
+ const [isCalendarUnlocked, setIsCalendarUnlocked] = useState(true);
+ const [isVerifyingCalendarPassword, setIsVerifyingCalendarPassword] =
+ useState(false);
+ const [passwordCacheTrigger, setPasswordCacheTrigger] = useState(0);
+
+ const selectedCalendarData = useMemo(() => {
+ return calendars.find((c) => c.id === selectedCalendar);
+ }, [calendars, selectedCalendar]);
+
+ const shouldHideUIElements = useMemo(() => {
+ if (!selectedCalendar || !selectedCalendarData) return false;
+ const requiresPassword = !!selectedCalendarData.passwordHash;
+ const hasPassword = !!getCachedPassword(selectedCalendar);
+ return requiresPassword && !hasPassword;
+ }, [selectedCalendar, selectedCalendarData, passwordCacheTrigger]);
+
+ const selectedCalendarIsLocked = useMemo(() => {
+ if (!selectedCalendar) return false;
+ const currentCalendar = calendars.find((c) => c.id === selectedCalendar);
+ return currentCalendar?.isLocked ?? false;
+ }, [selectedCalendar, calendars]);
+
+ // Verify password when calendar changes
+ useEffect(() => {
+ if (!selectedCalendar) {
+ setIsCalendarUnlocked(true);
+ setIsVerifyingCalendarPassword(false);
+ return;
+ }
+
+ if (selectedCalendarIsLocked) {
+ const cachedPassword = getCachedPassword(selectedCalendar);
+
+ if (cachedPassword) {
+ setIsVerifyingCalendarPassword(true);
+ setIsCalendarUnlocked(false);
+
+ verifyAndCachePassword(selectedCalendar, cachedPassword)
+ .then((result) => {
+ setIsCalendarUnlocked(result.valid);
+ })
+ .catch(() => {
+ setIsCalendarUnlocked(false);
+ })
+ .finally(() => {
+ setIsVerifyingCalendarPassword(false);
+ });
+ } else {
+ setIsCalendarUnlocked(false);
+ setIsVerifyingCalendarPassword(false);
+ }
+ } else {
+ setIsCalendarUnlocked(true);
+ setIsVerifyingCalendarPassword(false);
+ }
+ }, [selectedCalendar, selectedCalendarIsLocked]);
+
+ const handlePasswordSuccess = useCallback(() => {
+ setPasswordCacheTrigger((prev) => prev + 1);
+ }, []);
+
+ const verifyPasswordForAction = useCallback(
+ async (
+ action: () => Promise<void>,
+ actionType: "delete" | "edit" | "syncNotifications" = "edit"
+ ) => {
+ if (!selectedCalendar) return false;
+
+ const calendar = calendars.find((c) => c.id === selectedCalendar);
+ if (!calendar) return false;
+
+ if (calendar.passwordHash) {
+ const cachedPassword = getCachedPassword(selectedCalendar);
+
+ if (cachedPassword) {
+ try {
+ const result = await verifyAndCachePassword(
+ selectedCalendar,
+ cachedPassword
+ );
+ if (result.valid) {
+ await action();
+ return true;
+ }
+ } catch (error) {
+ console.error("Failed to verify password:", error);
+ // Continue to show password dialog on error
+ }
+ }
+
+ setPendingAction({ type: actionType, action });
+ return false;
+ }
+
+ await action();
+ return true;
+ },
+ [selectedCalendar, calendars]
+ );
+
+ return {
+ pendingAction,
+ setPendingAction,
+ isCalendarUnlocked,
+ setIsCalendarUnlocked,
+ isVerifyingCalendarPassword,
+ shouldHideUIElements,
+ selectedCalendarData,
+ handlePasswordSuccess,
+ verifyPasswordForAction,
+ };
+}
diff --git a/hooks/useShiftActions.ts b/hooks/useShiftActions.ts
new file mode 100644
index 0000000..ed6a350
--- /dev/null
+++ b/hooks/useShiftActions.ts
@@ -0,0 +1,216 @@
+import { useState, useCallback, useRef, useEffect } from "react";
+import { toast } from "sonner";
+import { useTranslations } from "next-intl";
+import { isSameDay } from "date-fns";
+import { ShiftFormData } from "@/components/shift-dialog";
+import { ShiftWithCalendar } from "@/lib/types";
+import { ShiftPreset } from "@/lib/db/schema";
+import { formatDateToLocal } from "@/lib/date-utils";
+import {
+ getCachedPassword,
+ verifyAndCachePassword,
+} from "@/lib/password-cache";
+
+interface UseShiftActionsProps {
+ selectedCalendar: string | null;
+ shifts: ShiftWithCalendar[];
+ setShifts: (shifts: ShiftWithCalendar[]) => void;
+ presets: ShiftPreset[];
+ createShift: (data: ShiftFormData) => Promise<ShiftWithCalendar | null>;
+ updateShift: (
+ id: string,
+ data: ShiftFormData,
+ onPasswordRequired: () => void
+ ) => Promise<boolean>;
+ deleteShift: (id: string, onPasswordRequired: () => void) => Promise<boolean>;
+ onStatsRefresh: () => void;
+ onPasswordRequired: (action: () => Promise<void>) => void;
+}
+
+export function useShiftActions({
+ selectedCalendar,
+ shifts,
+ setShifts,
+ presets,
+ createShift,
+ updateShift,
+ deleteShift,
+ onStatsRefresh,
+ onPasswordRequired,
+}: UseShiftActionsProps) {
+ const t = useTranslations();
+ const [togglingDates, setTogglingDates] = useState<Set<string>>(new Set());
+ const togglingDatesRef = useRef(togglingDates);
+
+ // Keep ref in sync with state
+ useEffect(() => {
+ togglingDatesRef.current = togglingDates;
+ }, [togglingDates]);
+
+ const handleShiftSubmit = useCallback(
+ async (formData: ShiftFormData) => {
+ try {
+ const result = await createShift(formData);
+ if (result) {
+ onStatsRefresh();
+ }
+ } catch (error) {
+ console.error("Failed to create shift:", error);
+ }
+ },
+ [createShift, onStatsRefresh]
+ );
+
+ const handleUpdateShift = useCallback(
+ async (id: string, formData: ShiftFormData) => {
+ const success = await updateShift(id, formData, () => {
+ onPasswordRequired(async () => {
+ await updateShift(id, formData, () => {});
+ });
+ });
+ if (success) {
+ onStatsRefresh();
+ }
+ },
+ [updateShift, onStatsRefresh, onPasswordRequired]
+ );
+
+ const handleDeleteShift = useCallback(
+ async (id: string) => {
+ const success = await deleteShift(id, () => {
+ onPasswordRequired(async () => {
+ await deleteShift(id, () => {});
+ });
+ });
+ if (success) {
+ onStatsRefresh();
+ }
+ },
+ [deleteShift, onStatsRefresh, onPasswordRequired]
+ );
+
+ const handleAddShift = useCallback(
+ async (date: Date, selectedPresetId: string | undefined) => {
+ if (!selectedPresetId) return;
+
+ const preset = presets.find((p) => p.id === selectedPresetId);
+ if (!preset) return;
+
+ const targetDate = new Date(date);
+ const dateKey = formatDateToLocal(targetDate);
+
+ if (togglingDatesRef.current.has(dateKey)) return;
+
+ setTogglingDates((prev) => new Set(prev).add(dateKey));
+
+ try {
+ const password = selectedCalendar
+ ? getCachedPassword(selectedCalendar)
+ : null;
+
+ if (selectedCalendar) {
+ const result = await verifyAndCachePassword(
+ selectedCalendar,
+ password
+ );
+
+ if (result.protected && !result.valid) {
+ onPasswordRequired(() =>
+ handleAddShift(targetDate, selectedPresetId)
+ );
+ setTogglingDates((prev) => {
+ const next = new Set(prev);
+ next.delete(dateKey);
+ return next;
+ });
+ return;
+ }
+ }
+
+ const existingShift = shifts.find(
+ (shift) =>
+ shift.date &&
+ isSameDay(new Date(shift.date), targetDate) &&
+ shift.title === preset.title &&
+ shift.startTime === preset.startTime &&
+ shift.endTime === preset.endTime
+ );
+
+ if (existingShift) {
+ const previousShifts = [...shifts];
+ setShifts(shifts.filter((s) => s.id !== existingShift.id));
+ onStatsRefresh();
+
+ try {
+ const response = await fetch(`/api/shifts/${existingShift.id}`, {
+ method: "DELETE",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({ password }),
+ });
+
+ if (!response.ok) {
+ setShifts(previousShifts);
+ onStatsRefresh();
+ toast.error(
+ t("common.deleteError", { item: t("shift.shift_one") })
+ );
+ } else {
+ toast.success(
+ t("common.deleted", { item: t("shift.shift_one") })
+ );
+ }
+ } catch (error) {
+ console.error("Failed to delete shift:", error);
+ setShifts(previousShifts);
+ onStatsRefresh();
+ toast.error(
+ t("common.deleteError", { item: t("shift.shift_one") })
+ );
+ }
+ } else {
+ const shiftData: ShiftFormData = {
+ date: dateKey,
+ startTime: preset.startTime,
+ endTime: preset.endTime,
+ title: preset.title,
+ color: preset.color,
+ notes: preset.notes || "",
+ presetId: preset.id,
+ isAllDay: preset.isAllDay || false,
+ };
+
+ const newShift = await createShift(shiftData);
+ if (newShift) {
+ onStatsRefresh();
+ }
+ }
+ } finally {
+ setTogglingDates((prev) => {
+ const next = new Set(prev);
+ next.delete(dateKey);
+ return next;
+ });
+ }
+ },
+ [
+ selectedCalendar,
+ shifts,
+ setShifts,
+ presets,
+ createShift,
+ onStatsRefresh,
+ onPasswordRequired,
+ t,
+ ]
+ );
+
+ return {
+ togglingDates,
+ handleShiftSubmit,
+ handleUpdateShift,
+ handleDeleteShift,
+ handleAddShift,
+ };
+}
diff --git a/hooks/useShifts.ts b/hooks/useShifts.ts
index 18e1937..4d53877 100644
--- a/hooks/useShifts.ts
+++ b/hooks/useShifts.ts
@@ -81,7 +81,7 @@ export function useShifts(calendarId: string | undefined) {
setShifts((shifts) =>
shifts.map((s) => (s.id === tempId ? newShift : s))
);
- toast.success(t("common.created", { item: t("shift.title") }));
+ toast.success(t("common.created", { item: t("shift.shift_one") }));
return newShift;
} catch (error) {
console.error("Failed to create shift:", error);
diff --git a/hooks/useVersionInfo.ts b/hooks/useVersionInfo.ts
new file mode 100644
index 0000000..b4d27c7
--- /dev/null
+++ b/hooks/useVersionInfo.ts
@@ -0,0 +1,45 @@
+import { useState, useEffect } from "react";
+
+interface VersionInfo {
+ version: string;
+ githubUrl: string;
+ commitHash?: string;
+}
+
+export function useVersionInfo() {
+ const [versionInfo, setVersionInfo] = useState<VersionInfo | null>(null);
+
+ useEffect(() => {
+ const fetchVersion = async () => {
+ try {
+ const response = await fetch("/api/version");
+
+ if (!response.ok) {
+ let errorBody = "";
+ try {
+ const errorData = await response.json();
+ errorBody = JSON.stringify(errorData);
+ } catch {
+ errorBody = await response.text();
+ }
+ throw new Error(
+ `Fetch /api/version failed: ${response.status} ${response.statusText} - ${errorBody}`
+ );
+ }
+
+ const data = await response.json();
+ setVersionInfo({
+ version: data.version,
+ githubUrl: data.githubUrl,
+ commitHash: data.commitHash,
+ });
+ } catch (error) {
+ console.error("Failed to fetch version:", error);
+ }
+ };
+
+ fetchVersion();
+ }, []);
+
+ return versionInfo;
+}
diff --git a/hooks/useViewSettings.ts b/hooks/useViewSettings.ts
new file mode 100644
index 0000000..fef6c11
--- /dev/null
+++ b/hooks/useViewSettings.ts
@@ -0,0 +1,157 @@
+import { useState, useCallback } from "react";
+
+export function useViewSettings() {
+ const [shiftsPerDay, setShiftsPerDay] = useState<number | null>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("shifts-per-day");
+ if (stored === "null") return null;
+ if (stored) {
+ const parsed = parseInt(stored);
+ return isNaN(parsed) ? 3 : parsed;
+ }
+ }
+ return 3;
+ });
+
+ const [externalShiftsPerDay, setExternalShiftsPerDay] = useState<
+ number | null
+ >(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("external-shifts-per-day");
+ if (stored === "null") return null;
+ if (stored) {
+ const parsed = parseInt(stored);
+ return isNaN(parsed) ? 3 : parsed;
+ }
+ }
+ return 3;
+ });
+
+ const [showShiftNotes, setShowShiftNotes] = useState<boolean>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("show-shift-notes");
+ return stored === "true";
+ }
+ return false;
+ });
+
+ const [showFullTitles, setShowFullTitles] = useState<boolean>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("show-full-titles");
+ return stored === "true";
+ }
+ return false;
+ });
+
+ const [shiftSortType, setShiftSortType] = useState<
+ "startTime" | "createdAt" | "title"
+ >(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("shift-sort-type");
+ if (
+ stored === "startTime" ||
+ stored === "createdAt" ||
+ stored === "title"
+ ) {
+ return stored;
+ }
+ }
+ return "createdAt";
+ });
+
+ const [shiftSortOrder, setShiftSortOrder] = useState<"asc" | "desc">(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("shift-sort-order");
+ if (stored === "asc" || stored === "desc") {
+ return stored;
+ }
+ }
+ return "asc";
+ });
+
+ const [combinedSortMode, setCombinedSortMode] = useState<boolean>(() => {
+ if (typeof window !== "undefined") {
+ const stored = localStorage.getItem("combined-sort-mode");
+ return stored === "true";
+ }
+ return false;
+ });
+
+ const handleShiftsPerDayChange = useCallback((count: number | null) => {
+ setShiftsPerDay(count);
+ if (typeof window !== "undefined") {
+ localStorage.setItem(
+ "shifts-per-day",
+ count === null ? "null" : count.toString()
+ );
+ }
+ }, []);
+
+ const handleExternalShiftsPerDayChange = useCallback(
+ (count: number | null) => {
+ setExternalShiftsPerDay(count);
+ if (typeof window !== "undefined") {
+ localStorage.setItem(
+ "external-shifts-per-day",
+ count === null ? "null" : count.toString()
+ );
+ }
+ },
+ []
+ );
+
+ const handleShowShiftNotesChange = useCallback((show: boolean) => {
+ setShowShiftNotes(show);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("show-shift-notes", show.toString());
+ }
+ }, []);
+
+ const handleShowFullTitlesChange = useCallback((show: boolean) => {
+ setShowFullTitles(show);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("show-full-titles", show.toString());
+ }
+ }, []);
+
+ const handleShiftSortTypeChange = useCallback(
+ (type: "startTime" | "createdAt" | "title") => {
+ setShiftSortType(type);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("shift-sort-type", type);
+ }
+ },
+ []
+ );
+
+ const handleShiftSortOrderChange = useCallback((order: "asc" | "desc") => {
+ setShiftSortOrder(order);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("shift-sort-order", order);
+ }
+ }, []);
+
+ const handleCombinedSortModeChange = useCallback((combined: boolean) => {
+ setCombinedSortMode(combined);
+ if (typeof window !== "undefined") {
+ localStorage.setItem("combined-sort-mode", combined.toString());
+ }
+ }, []);
+
+ return {
+ shiftsPerDay,
+ externalShiftsPerDay,
+ showShiftNotes,
+ showFullTitles,
+ shiftSortType,
+ shiftSortOrder,
+ combinedSortMode,
+ handleShiftsPerDayChange,
+ handleExternalShiftsPerDayChange,
+ handleShowShiftNotesChange,
+ handleShowFullTitlesChange,
+ handleShiftSortTypeChange,
+ handleShiftSortOrderChange,
+ handleCombinedSortModeChange,
+ };
+}
diff --git a/lib/calendar-utils.ts b/lib/calendar-utils.ts
new file mode 100644
index 0000000..41f3292
--- /dev/null
+++ b/lib/calendar-utils.ts
@@ -0,0 +1,19 @@
+import {
+ startOfMonth,
+ endOfMonth,
+ startOfWeek,
+ endOfWeek,
+ eachDayOfInterval,
+} from "date-fns";
+
+export function getCalendarDays(date: Date): Date[] {
+ const monthStart = startOfMonth(date);
+ const monthEnd = endOfMonth(date);
+ const calendarStart = startOfWeek(monthStart, { weekStartsOn: 1 });
+ const calendarEnd = endOfWeek(monthEnd, { weekStartsOn: 1 });
+
+ return eachDayOfInterval({
+ start: calendarStart,
+ end: calendarEnd,
+ });
+}
diff --git a/messages/de.json b/messages/de.json
index fb0fc12..307ce1e 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -156,6 +156,16 @@
"externalShiftsPerDay": "Externe Schichten pro Tag",
"externalShiftsPerDayHint": "Maximale Anzahl der Schichten aus externen Kalendern pro Tag",
"showAll": "Alle",
+ "sortOptions": "Sortieroptionen",
+ "sortBy": "Sortieren nach",
+ "sortByStartTime": "Startzeit",
+ "sortByCreatedAt": "Erstellungsdatum",
+ "sortByTitle": "Titel (A-Z)",
+ "sortOrder": "Reihenfolge",
+ "sortOrderAsc": "Aufsteigend",
+ "sortOrderDesc": "Absteigend",
+ "combinedSort": "Alle Schichten zusammen sortieren",
+ "combinedSortHint": "Normale und externe Schichten gemeinsam sortieren statt separat",
"displayOptions": "Anzeigeoptionen",
"showNotes": "Schichtnotizen anzeigen",
"showNotesHint": "Notizen der Schichten im Kalender anzeigen",
diff --git a/messages/en.json b/messages/en.json
index 244cf66..c043e04 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -156,6 +156,16 @@
"externalShiftsPerDay": "External shifts per day",
"externalShiftsPerDayHint": "Maximum number of external calendar shifts to display per day",
"showAll": "All",
+ "sortOptions": "Sort Options",
+ "sortBy": "Sort by",
+ "sortByStartTime": "Start time",
+ "sortByCreatedAt": "Creation date",
+ "sortByTitle": "Title (A-Z)",
+ "sortOrder": "Order",
+ "sortOrderAsc": "Ascending",
+ "sortOrderDesc": "Descending",
+ "combinedSort": "Sort all shifts together",
+ "combinedSortHint": "Sort regular and external shifts together instead of separately",
"displayOptions": "Display Options",
"showNotes": "Show shift notes",
"showNotesHint": "Display shift notes in calendar grid",
diff --git a/messages/it.json b/messages/it.json
index d5681c0..44a62e2 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -156,6 +156,16 @@
"externalShiftsPerDay": "Turni esterni al giorno",
"externalShiftsPerDayHint": "Numero massimo di turni da calendari esterni da visualizzare per giorno",
"showAll": "Tutti",
+ "sortOptions": "Opzioni di Ordinamento",
+ "sortBy": "Ordina per",
+ "sortByStartTime": "Ora di inizio",
+ "sortByCreatedAt": "Data di creazione",
+ "sortByTitle": "Titolo (A-Z)",
+ "sortOrder": "Ordine",
+ "sortOrderAsc": "Crescente",
+ "sortOrderDesc": "Decrescente",
+ "combinedSort": "Ordina tutti i turni insieme",
+ "combinedSortHint": "Ordina i turni regolari ed esterni insieme invece che separatamente",
"displayOptions": "Opzioni di Visualizzazione",
"showNotes": "Mostra note turni",
"showNotesHint": "Visualizza note dei turni nella griglia calendario",
diff --git a/package-lock.json b/package-lock.json
index 479375d..32bb72e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1996,15 +1996,15 @@
}
},
"node_modules/@next/env": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/env/-/env-16.0.7.tgz",
- "integrity": "sha512-gpaNgUh5nftFKRkRQGnVi5dpcYSKGcZZkQffZ172OrG/XkrnS7UBTQ648YY+8ME92cC4IojpI2LqTC8sTDhAaw==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/env/-/env-16.0.8.tgz",
+ "integrity": "sha512-xP4WrQZuj9MdmLJy3eWFHepo+R3vznsMSS8Dy3wdA7FKpjCiesQ6DxZvdGziQisj0tEtCgBKJzjcAc4yZOgLEQ==",
"license": "MIT"
},
"node_modules/@next/eslint-plugin-next": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.0.7.tgz",
- "integrity": "sha512-hFrTNZcMEG+k7qxVxZJq3F32Kms130FAhG8lvw2zkKBgAcNOJIxlljNiCjGygvBshvaGBdf88q2CqWtnqezDHA==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.0.8.tgz",
+ "integrity": "sha512-1miV0qXDcLUaOdHridVPCh4i39ElRIAraseVIbb3BEqyZ5ol9sPyjTP/GNTPV5rBxqxjF6/vv5zQTVbhiNaLqA==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2012,9 +2012,9 @@
}
},
"node_modules/@next/swc-darwin-arm64": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.0.7.tgz",
- "integrity": "sha512-LlDtCYOEj/rfSnEn/Idi+j1QKHxY9BJFmxx7108A6D8K0SB+bNgfYQATPk/4LqOl4C0Wo3LACg2ie6s7xqMpJg==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.0.8.tgz",
+ "integrity": "sha512-yjVMvTQN21ZHOclQnhSFbjBTEizle+1uo4NV6L4rtS9WO3nfjaeJYw+H91G+nEf3Ef43TaEZvY5mPWfB/De7tA==",
"cpu": [
"arm64"
],
@@ -2028,9 +2028,9 @@
}
},
"node_modules/@next/swc-darwin-x64": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.0.7.tgz",
- "integrity": "sha512-rtZ7BhnVvO1ICf3QzfW9H3aPz7GhBrnSIMZyr4Qy6boXF0b5E3QLs+cvJmg3PsTCG2M1PBoC+DANUi4wCOKXpA==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.0.8.tgz",
+ "integrity": "sha512-+zu2N3QQ0ZOb6RyqQKfcu/pn0UPGmg+mUDqpAAEviAcEVEYgDckemOpiMRsBP3IsEKpcoKuNzekDcPczEeEIzA==",
"cpu": [
"x64"
],
@@ -2044,9 +2044,9 @@
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.0.7.tgz",
- "integrity": "sha512-mloD5WcPIeIeeZqAIP5c2kdaTa6StwP4/2EGy1mUw8HiexSHGK/jcM7lFuS3u3i2zn+xH9+wXJs6njO7VrAqww==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.0.8.tgz",
+ "integrity": "sha512-LConttk+BeD0e6RG0jGEP9GfvdaBVMYsLJ5aDDweKiJVVCu6sGvo+Ohz9nQhvj7EQDVVRJMCGhl19DmJwGr6bQ==",
"cpu": [
"arm64"
],
@@ -2060,9 +2060,9 @@
}
},
"node_modules/@next/swc-linux-arm64-musl": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.0.7.tgz",
- "integrity": "sha512-+ksWNrZrthisXuo9gd1XnjHRowCbMtl/YgMpbRvFeDEqEBd523YHPWpBuDjomod88U8Xliw5DHhekBC3EOOd9g==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.0.8.tgz",
+ "integrity": "sha512-JaXFAlqn8fJV+GhhA9lpg6da/NCN/v9ub98n3HoayoUSPOVdoxEEt86iT58jXqQCs/R3dv5ZnxGkW8aF4obMrQ==",
"cpu": [
"arm64"
],
@@ -2076,9 +2076,9 @@
}
},
"node_modules/@next/swc-linux-x64-gnu": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.0.7.tgz",
- "integrity": "sha512-4WtJU5cRDxpEE44Ana2Xro1284hnyVpBb62lIpU5k85D8xXxatT+rXxBgPkc7C1XwkZMWpK5rXLXTh9PFipWsA==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.0.8.tgz",
+ "integrity": "sha512-O7M9it6HyNhsJp3HNAsJoHk5BUsfj7hRshfptpGcVsPZ1u0KQ/oVy8oxF7tlwxA5tR43VUP0yRmAGm1us514ng==",
"cpu": [
"x64"
],
@@ -2092,9 +2092,9 @@
}
},
"node_modules/@next/swc-linux-x64-musl": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.0.7.tgz",
- "integrity": "sha512-HYlhqIP6kBPXalW2dbMTSuB4+8fe+j9juyxwfMwCe9kQPPeiyFn7NMjNfoFOfJ2eXkeQsoUGXg+O2SE3m4Qg2w==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.0.8.tgz",
+ "integrity": "sha512-8+KClEC/GLI2dLYcrWwHu5JyC5cZYCFnccVIvmxpo6K+XQt4qzqM5L4coofNDZYkct/VCCyJWGbZZDsg6w6LFA==",
"cpu": [
"x64"
],
@@ -2108,9 +2108,9 @@
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.0.7.tgz",
- "integrity": "sha512-EviG+43iOoBRZg9deGauXExjRphhuYmIOJ12b9sAPy0eQ6iwcPxfED2asb/s2/yiLYOdm37kPaiZu8uXSYPs0Q==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.0.8.tgz",
+ "integrity": "sha512-rpQ/PgTEgH68SiXmhu/cJ2hk9aZ6YgFvspzQWe2I9HufY6g7V02DXRr/xrVqOaKm2lenBFPNQ+KAaeveywqV+A==",
"cpu": [
"arm64"
],
@@ -2124,9 +2124,9 @@
}
},
"node_modules/@next/swc-win32-x64-msvc": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.0.7.tgz",
- "integrity": "sha512-gniPjy55zp5Eg0896qSrf3yB1dw4F/3s8VK1ephdsZZ129j2n6e1WqCbE2YgcKhW9hPB9TVZENugquWJD5x0ug==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.0.8.tgz",
+ "integrity": "sha512-jWpWjWcMQu2iZz4pEK2IktcfR+OA9+cCG8zenyLpcW8rN4rzjfOzH4yj/b1FiEAZHKS+5Vq8+bZyHi+2yqHbFA==",
"cpu": [
"x64"
],
@@ -3435,9 +3435,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
- "version": "24.10.1",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz",
- "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
+ "version": "24.10.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.2.tgz",
+ "integrity": "sha512-WOhQTZ4G8xZ1tjJTvKOpyEVSGgOTvJAfDK3FNFgELyaTpzhdgHVHeqW8V+UJvzF5BT+/B54T/1S2K6gd9c7bbA==",
"devOptional": true,
"license": "MIT",
"dependencies": {
@@ -3465,18 +3465,17 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz",
- "integrity": "sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz",
+ "integrity": "sha512-JXij0vzIaTtCwu6SxTh8qBc66kmf1xs7pI4UOiMDFVct6q86G0Zs7KRcEoJgY3Cav3x5Tq0MF5jwgpgLqgKG3A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
- "@typescript-eslint/scope-manager": "8.48.1",
- "@typescript-eslint/type-utils": "8.48.1",
- "@typescript-eslint/utils": "8.48.1",
- "@typescript-eslint/visitor-keys": "8.48.1",
- "graphemer": "^1.4.0",
+ "@typescript-eslint/scope-manager": "8.49.0",
+ "@typescript-eslint/type-utils": "8.49.0",
+ "@typescript-eslint/utils": "8.49.0",
+ "@typescript-eslint/visitor-keys": "8.49.0",
"ignore": "^7.0.0",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.1.0"
@@ -3489,7 +3488,7 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
- "@typescript-eslint/parser": "^8.48.1",
+ "@typescript-eslint/parser": "^8.49.0",
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0"
}
@@ -3505,16 +3504,16 @@
}
},
"node_modules/@typescript-eslint/parser": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.1.tgz",
- "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.49.0.tgz",
+ "integrity": "sha512-N9lBGA9o9aqb1hVMc9hzySbhKibHmB+N3IpoShyV6HyQYRGIhlrO5rQgttypi+yEeKsKI4idxC8Jw6gXKD4THA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/scope-manager": "8.48.1",
- "@typescript-eslint/types": "8.48.1",
- "@typescript-eslint/typescript-estree": "8.48.1",
- "@typescript-eslint/visitor-keys": "8.48.1",
+ "@typescript-eslint/scope-manager": "8.49.0",
+ "@typescript-eslint/types": "8.49.0",
+ "@typescript-eslint/typescript-estree": "8.49.0",
+ "@typescript-eslint/visitor-keys": "8.49.0",
"debug": "^4.3.4"
},
"engines": {
@@ -3530,14 +3529,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz",
- "integrity": "sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.49.0.tgz",
+ "integrity": "sha512-/wJN0/DKkmRUMXjZUXYZpD1NEQzQAAn9QWfGwo+Ai8gnzqH7tvqS7oNVdTjKqOcPyVIdZdyCMoqN66Ia789e7g==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/tsconfig-utils": "^8.48.1",
- "@typescript-eslint/types": "^8.48.1",
+ "@typescript-eslint/tsconfig-utils": "^8.49.0",
+ "@typescript-eslint/types": "^8.49.0",
"debug": "^4.3.4"
},
"engines": {
@@ -3552,14 +3551,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.1.tgz",
- "integrity": "sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.49.0.tgz",
+ "integrity": "sha512-npgS3zi+/30KSOkXNs0LQXtsg9ekZ8OISAOLGWA/ZOEn0ZH74Ginfl7foziV8DT+D98WfQ5Kopwqb/PZOaIJGg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/types": "8.48.1",
- "@typescript-eslint/visitor-keys": "8.48.1"
+ "@typescript-eslint/types": "8.49.0",
+ "@typescript-eslint/visitor-keys": "8.49.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -3570,9 +3569,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz",
- "integrity": "sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.49.0.tgz",
+ "integrity": "sha512-8prixNi1/6nawsRYxet4YOhnbW+W9FK/bQPxsGB1D3ZrDzbJ5FXw5XmzxZv82X3B+ZccuSxo/X8q9nQ+mFecWA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -3587,15 +3586,15 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.1.tgz",
- "integrity": "sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.49.0.tgz",
+ "integrity": "sha512-KTExJfQ+svY8I10P4HdxKzWsvtVnsuCifU5MvXrRwoP2KOlNZ9ADNEWWsQTJgMxLzS5VLQKDjkCT/YzgsnqmZg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/types": "8.48.1",
- "@typescript-eslint/typescript-estree": "8.48.1",
- "@typescript-eslint/utils": "8.48.1",
+ "@typescript-eslint/types": "8.49.0",
+ "@typescript-eslint/typescript-estree": "8.49.0",
+ "@typescript-eslint/utils": "8.49.0",
"debug": "^4.3.4",
"ts-api-utils": "^2.1.0"
},
@@ -3612,9 +3611,9 @@
}
},
"node_modules/@typescript-eslint/types": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz",
- "integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.49.0.tgz",
+ "integrity": "sha512-e9k/fneezorUo6WShlQpMxXh8/8wfyc+biu6tnAqA81oWrEic0k21RHzP9uqqpyBBeBKu4T+Bsjy9/b8u7obXQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -3626,16 +3625,16 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz",
- "integrity": "sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.49.0.tgz",
+ "integrity": "sha512-jrLdRuAbPfPIdYNppHJ/D0wN+wwNfJ32YTAm10eJVsFmrVpXQnDWBn8niCSMlWjvml8jsce5E/O+86IQtTbJWA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/project-service": "8.48.1",
- "@typescript-eslint/tsconfig-utils": "8.48.1",
- "@typescript-eslint/types": "8.48.1",
- "@typescript-eslint/visitor-keys": "8.48.1",
+ "@typescript-eslint/project-service": "8.49.0",
+ "@typescript-eslint/tsconfig-utils": "8.49.0",
+ "@typescript-eslint/types": "8.49.0",
+ "@typescript-eslint/visitor-keys": "8.49.0",
"debug": "^4.3.4",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
@@ -3693,16 +3692,16 @@
}
},
"node_modules/@typescript-eslint/utils": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.1.tgz",
- "integrity": "sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.49.0.tgz",
+ "integrity": "sha512-N3W7rJw7Rw+z1tRsHZbK395TWSYvufBXumYtEGzypgMUthlg0/hmCImeA8hgO2d2G4pd7ftpxxul2J8OdtdaFA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.7.0",
- "@typescript-eslint/scope-manager": "8.48.1",
- "@typescript-eslint/types": "8.48.1",
- "@typescript-eslint/typescript-estree": "8.48.1"
+ "@typescript-eslint/scope-manager": "8.49.0",
+ "@typescript-eslint/types": "8.49.0",
+ "@typescript-eslint/typescript-estree": "8.49.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -3717,13 +3716,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.1.tgz",
- "integrity": "sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.49.0.tgz",
+ "integrity": "sha512-LlKaciDe3GmZFphXIc79THF/YYBugZ7FS1pO581E/edlVVNbZKDy93evqmrfQ9/Y4uN0vVhX4iuchq26mK/iiA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/types": "8.48.1",
+ "@typescript-eslint/types": "8.49.0",
"eslint-visitor-keys": "^4.2.1"
},
"engines": {
@@ -4329,9 +4328,9 @@
"license": "MIT"
},
"node_modules/baseline-browser-mapping": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.0.tgz",
- "integrity": "sha512-Mh++g+2LPfzZToywfE1BUzvZbfOY52Nil0rn9H1CPC5DJ7fX+Vir7nToBeoiSbB1zTNeGYbELEvJESujgGrzXw==",
+ "version": "2.9.5",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.5.tgz",
+ "integrity": "sha512-D5vIoztZOq1XM54LUdttJVc96ggEsIfju2JBvht06pSzpckp3C7HReun67Bghzrtdsq9XdMGbSSB3v3GhMNmAA==",
"dev": true,
"license": "Apache-2.0",
"bin": {
@@ -4521,9 +4520,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001759",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001759.tgz",
- "integrity": "sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw==",
+ "version": "1.0.30001760",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001760.tgz",
+ "integrity": "sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==",
"funding": [
{
"type": "opencollective",
@@ -4854,9 +4853,9 @@
}
},
"node_modules/drizzle-kit": {
- "version": "0.31.7",
- "resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.7.tgz",
- "integrity": "sha512-hOzRGSdyKIU4FcTSFYGKdXEjFsncVwHZ43gY3WU5Bz9j5Iadp6Rh6hxLSQ1IWXpKLBKt/d5y1cpSPcV+FcoQ1A==",
+ "version": "0.31.8",
+ "resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.8.tgz",
+ "integrity": "sha512-O9EC/miwdnRDY10qRxM8P3Pg8hXe3LyU4ZipReKOgTwn4OqANmftj8XJz1UPUAS6NMHf0E2htjsbQujUTkncCg==",
"license": "MIT",
"dependencies": {
"@drizzle-team/brocli": "^0.10.2",
@@ -5009,9 +5008,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.5.263",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.263.tgz",
- "integrity": "sha512-DrqJ11Knd+lo+dv+lltvfMDLU27g14LMdH2b0O3Pio4uk0x+z7OR+JrmyacTPN2M8w3BrZ7/RTwG3R9B7irPlg==",
+ "version": "1.5.267",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz",
+ "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==",
"dev": true,
"license": "ISC"
},
@@ -5359,13 +5358,13 @@
}
},
"node_modules/eslint-config-next": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.0.7.tgz",
- "integrity": "sha512-WubFGLFHfk2KivkdRGfx6cGSFhaQqhERRfyO8BRx+qiGPGp7WLKcPvYC4mdx1z3VhVRcrfFzczjjTrbJZOpnEQ==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.0.8.tgz",
+ "integrity": "sha512-8J5cOAboXIV3f8OD6BOyj7Fik6n/as7J4MboiUSExWruf/lCu1OPR3ZVSdnta6WhzebrmAATEmNSBZsLWA6kbg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@next/eslint-plugin-next": "16.0.7",
+ "@next/eslint-plugin-next": "16.0.8",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.32.0",
@@ -6119,13 +6118,6 @@
"dev": true,
"license": "ISC"
},
- "node_modules/graphemer": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz",
- "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/has-bigints": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz",
@@ -7427,12 +7419,12 @@
}
},
"node_modules/next": {
- "version": "16.0.7",
- "resolved": "https://registry.npmjs.org/next/-/next-16.0.7.tgz",
- "integrity": "sha512-3mBRJyPxT4LOxAJI6IsXeFtKfiJUbjCLgvXO02fV8Wy/lIhPvP94Fe7dGhUgHXcQy4sSuYwQNcOLhIfOm0rL0A==",
+ "version": "16.0.8",
+ "resolved": "https://registry.npmjs.org/next/-/next-16.0.8.tgz",
+ "integrity": "sha512-LmcZzG04JuzNXi48s5P+TnJBsTGPJunViNKV/iE4uM6kstjTQsQhvsAv+xF6MJxU2Pr26tl15eVbp0jQnsv6/g==",
"license": "MIT",
"dependencies": {
- "@next/env": "16.0.7",
+ "@next/env": "16.0.8",
"@swc/helpers": "0.5.15",
"caniuse-lite": "^1.0.30001579",
"postcss": "8.4.31",
@@ -7445,14 +7437,14 @@
"node": ">=20.9.0"
},
"optionalDependencies": {
- "@next/swc-darwin-arm64": "16.0.7",
- "@next/swc-darwin-x64": "16.0.7",
- "@next/swc-linux-arm64-gnu": "16.0.7",
- "@next/swc-linux-arm64-musl": "16.0.7",
- "@next/swc-linux-x64-gnu": "16.0.7",
- "@next/swc-linux-x64-musl": "16.0.7",
- "@next/swc-win32-arm64-msvc": "16.0.7",
- "@next/swc-win32-x64-msvc": "16.0.7",
+ "@next/swc-darwin-arm64": "16.0.8",
+ "@next/swc-darwin-x64": "16.0.8",
+ "@next/swc-linux-arm64-gnu": "16.0.8",
+ "@next/swc-linux-arm64-musl": "16.0.8",
+ "@next/swc-linux-x64-gnu": "16.0.8",
+ "@next/swc-linux-x64-musl": "16.0.8",
+ "@next/swc-win32-arm64-msvc": "16.0.8",
+ "@next/swc-win32-x64-msvc": "16.0.8",
"sharp": "^0.34.4"
},
"peerDependencies": {
@@ -7556,9 +7548,8 @@
"version": "0.5.17",
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz",
"integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==",
+ "extraneous": true,
"license": "Apache-2.0",
- "optional": true,
- "peer": true,
"dependencies": {
"tslib": "^2.8.0"
}
@@ -8069,9 +8060,9 @@
}
},
"node_modules/react-day-picker": {
- "version": "9.11.3",
- "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-9.11.3.tgz",
- "integrity": "sha512-7lD12UvGbkyXqgzbYIGQTbl+x29B9bAf+k0pP5Dcs1evfpKk6zv4EdH/edNc8NxcmCiTNXr2HIYPrSZ3XvmVBg==",
+ "version": "9.12.0",
+ "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-9.12.0.tgz",
+ "integrity": "sha512-t8OvG/Zrciso5CQJu5b1A7yzEmebvST+S3pOVQJWxwjjVngyG/CA2htN/D15dLI4uTEuLLkbZyS4YYt480FAtA==",
"license": "MIT",
"dependencies": {
"@date-fns/tz": "^1.4.1",
@@ -9198,16 +9189,16 @@
}
},
"node_modules/typescript-eslint": {
- "version": "8.48.1",
- "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.48.1.tgz",
- "integrity": "sha512-FbOKN1fqNoXp1hIl5KYpObVrp0mCn+CLgn479nmu2IsRMrx2vyv74MmsBLVlhg8qVwNFGbXSp8fh1zp8pEoC2A==",
+ "version": "8.49.0",
+ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.49.0.tgz",
+ "integrity": "sha512-zRSVH1WXD0uXczCXw+nsdjGPUdx4dfrs5VQoHnUWmv1U3oNlAKv4FUNdLDhVUg+gYn+a5hUESqch//Rv5wVhrg==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@typescript-eslint/eslint-plugin": "8.48.1",
- "@typescript-eslint/parser": "8.48.1",
- "@typescript-eslint/typescript-estree": "8.48.1",
- "@typescript-eslint/utils": "8.48.1"
+ "@typescript-eslint/eslint-plugin": "8.49.0",
+ "@typescript-eslint/parser": "8.49.0",
+ "@typescript-eslint/typescript-estree": "8.49.0",
+ "@typescript-eslint/utils": "8.49.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -9283,9 +9274,9 @@
}
},
"node_modules/update-browserslist-db": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.0.tgz",
- "integrity": "sha512-Dn+NlSF/7+0lVSEZ57SYQg6/E44arLzsVOGgrElBn/BlG1B8WKdbLppOocFrXwRNTkNlgdGNaBgH1o0lggDPiw==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz",
+ "integrity": "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA==",
"dev": true,
"funding": [
{