forked from panteLx/BetterShift
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalendar-content.tsx
More file actions
139 lines (131 loc) · 4.96 KB
/
Copy pathcalendar-content.tsx
File metadata and controls
139 lines (131 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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 { GuestBanner } from "@/components/guest-banner";
import { ShiftWithCalendar } from "@/lib/types";
import { CalendarNote, ExternalSync } from "@/lib/db/schema";
import { Locale } from "date-fns";
import { useAuth } from "@/hooks/useAuth";
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;
highlightedWeekdays?: number[];
highlightColor?: string;
selectedCalendar: string | null;
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;
onEditShift?: (shift: ShiftWithCalendar) => void;
}
export function CalendarContent(props: CalendarContentProps) {
const t = useTranslations();
const { isGuest } = useAuth();
return (
<>
<MonthNavigation
currentDate={props.currentDate}
onDateChange={props.onDateChange}
locale={props.locale}
/>
{/* Guest Banner - compact on mobile, default on desktop */}
{isGuest && (
<>
<div className="mb-4 px-2 sm:hidden">
<GuestBanner variant="compact" />
</div>
<div className="hidden sm:block mb-4">
<GuestBanner variant="default" />
</div>
</>
)}
<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}
highlightedWeekdays={props.highlightedWeekdays}
highlightColor={props.highlightColor}
onDayClick={props.onDayClick}
onDayRightClick={props.onDayRightClick}
onNoteIconClick={props.onNoteIconClick}
onLongPress={props.onLongPress}
onShowAllShifts={props.onShowAllShifts}
onShowSyncedShifts={props.onShowSyncedShifts}
onEditShift={props.onEditShift}
/>
<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}
/>
<ShiftsList
shifts={props.shifts}
currentDate={props.currentDate}
onDeleteShift={props.onDeleteShift}
onEditShift={props.onEditShift}
calendarId={props.selectedCalendar || undefined}
/>
</div>
</>
);
}