diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index 5c2ac9d..c07a66a 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -676,6 +676,7 @@ export default function WeeklyView() { dayHeaderGap?: string; showTaskCheckboxes?: boolean; quoteSourceUrls?: string[]; + startDayOffset?: number; }>({ name: session?.user?.name || "", email: session?.user?.email || "", @@ -2150,6 +2151,7 @@ export default function WeeklyView() { const goToToday = () => { const d = new Date(); d.setHours(0, 0, 0, 0); + d.setDate(d.getDate() + (profile?.startDayOffset || 0)); setCurrentWeekStart(d); }; @@ -5827,6 +5829,7 @@ export default function WeeklyView() { somedayLists={somedayLists} handleToggleTaskList={handleToggleTaskList} fetchAvailableTaskLists={fetchAvailableTaskLists} + setCurrentWeekStart={setCurrentWeekStart} /> ) } @@ -6843,8 +6846,10 @@ interface SettingsSidebarProps { yearColor?: string; dayHeaderGap?: string; showTaskCheckboxes?: boolean; + startDayOffset?: number; quoteSourceUrls: string[]; }) => void; + setCurrentWeekStart: (d: Date) => void; quoteSourceUrls?: string[]; goal: string; setGoal: (goal: string) => void; @@ -7090,6 +7095,7 @@ function SettingsSidebar({ handleToggleTaskList, fetchAvailableTaskLists, initialTab, + setCurrentWeekStart, }: SettingsSidebarProps) { const [activeTab, setActiveTab] = useState< "calendar" | "general" | "account" | "styling" | "motivation" | "about" @@ -7202,6 +7208,7 @@ function SettingsSidebar({ dayHeaderGap?: string; showTaskCheckboxes?: boolean; quoteSourceUrls?: string[]; + startDayOffset?: number; }>({ name: "", email: "", @@ -7361,6 +7368,7 @@ function SettingsSidebar({ yearFontWeight: profile.yearFontWeight, dayHeaderGap: profile.dayHeaderGap, showTaskCheckboxes: profile.showTaskCheckboxes, + startDayOffset: profile.startDayOffset, } as any); }, [profile, showTimeGrid, cellDuration, viewStyle, fontSize, showNextTask, showSomeday, showAllDay, showSchedule]); @@ -7436,6 +7444,7 @@ function SettingsSidebar({ showSubHourSlots: data.user.showSubHourSlots !== undefined ? data.user.showSubHourSlots : true, allDayPosition: data.user.allDayPosition || "below", showTaskCheckboxes: data.user.showTaskCheckboxes || false, + startDayOffset: data.user.startDayOffset !== undefined ? data.user.startDayOffset : 0, }); if (data.user.showTimeGrid !== undefined) @@ -7452,6 +7461,14 @@ function SettingsSidebar({ setShowSchedule(data.user.showSchedule); if (data.user.focusBreakDuration) setFocusBreakDuration(data.user.focusBreakDuration); + + // Apply the initial start date offset if set + if (data.user.startDayOffset !== undefined && data.user.startDayOffset !== 0) { + const d = new Date(); + d.setHours(0, 0, 0, 0); + d.setDate(d.getDate() + data.user.startDayOffset); + setCurrentWeekStart(d); + } } } } catch (e) { @@ -7647,6 +7664,7 @@ function SettingsSidebar({ goalScope: profile.goalScope, dateLayout: profile.dateLayout, dateAlignment: profile.dateAlignment, + startDayOffset: profile.startDayOffset, } as any); } @@ -7774,6 +7792,29 @@ function SettingsSidebar({ > {/* Visibility Toggles */} +
+ + +
+