From bfb749a8a6f80bc904d398e862ecea00340a768d Mon Sep 17 00:00:00 2001 From: mARTin Date: Mon, 30 Mar 2026 22:51:40 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20Phase=202=20=E2=80=94=20consolidate?= =?UTF-8?q?=20profile=20state=20reads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace all individual useState reads (viewStyle, timeFormat, language, cellDuration, showTimeGrid, showNextTask, showSomeday, showAllDay, etc.) with profile.fieldName reads. Individual useState declarations remain; only read sites are migrated. No UI logic changed. - getEffective() calls use profile.fieldName as global fallback - workingHoursStart/End derived from profile.startHour/endHour - All JSX reads (className, conditionals, child props) use profile.* - SettingsSidebar value props use profile.* (setters unchanged) - Add weekStartDay: 1 to profile defaults - ProjectsSidebar function body reverted (uses language prop, not profile) - darkMode excluded: localStorage-only, not an API profile field v1.80.1 --- package.json | 2 +- src/components/WeeklyView.tsx | 362 +++++++++++++++++----------------- 2 files changed, 182 insertions(+), 182 deletions(-) diff --git a/package.json b/package.json index 2a48f23..cda204d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.80.0", + "version": "1.80.1", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/src/components/WeeklyView.tsx b/src/components/WeeklyView.tsx index 5174ee7..a2664b2 100644 --- a/src/components/WeeklyView.tsx +++ b/src/components/WeeklyView.tsx @@ -849,6 +849,7 @@ export default function WeeklyView() { dayHeaderGap: "0.75em", dateVerticalAlign: "middle", allDayPosition: "above", + weekStartDay: 1, focusTimerDuration: 25, focusBreakDuration: 5, headlineFont: "Oswald", @@ -951,18 +952,18 @@ export default function WeeklyView() { viewSettingsRef.current = viewSettings; const getEffective = (key: K, globalVal: PerViewOverrides[K]): PerViewOverrides[K] => { - const vs = viewSettingsRef.current[viewStyle]; + const vs = viewSettingsRef.current[profile.viewStyle]; if (vs && vs[key] !== undefined) return vs[key] as PerViewOverrides[K]; return globalVal; }; const isPerView = (key: keyof PerViewOverrides): boolean => { - const vs = viewSettingsRef.current[viewStyle]; + const vs = viewSettingsRef.current[profile.viewStyle]; return !!(vs && vs[key] !== undefined); }; const saveViewSetting = async (key: K, value: PerViewOverrides[K], perView: boolean) => { const updated = { ...viewSettingsRef.current }; if (perView) { - updated[viewStyle] = { ...(updated[viewStyle] || {}), [key]: value }; + updated[profile.viewStyle] = { ...(updated[profile.viewStyle] || {}), [key]: value }; } else { // Remove per-view overrides for this key from ALL views and set globally for (const v of Object.keys(updated)) { @@ -987,9 +988,9 @@ export default function WeeklyView() { if (isPerView(key)) { // Remove per-view override (revert to global) const updated = { ...viewSettingsRef.current }; - if (updated[viewStyle]) { - const { [key]: _, ...rest } = updated[viewStyle] as any; - updated[viewStyle] = rest; + if (updated[profile.viewStyle]) { + const { [key]: _, ...rest } = updated[profile.viewStyle] as any; + updated[profile.viewStyle] = rest; } viewSettingsRef.current = updated; setViewSettings(updated); @@ -1011,17 +1012,17 @@ export default function WeeklyView() { const [showAllDay, setShowAllDay] = useState(true); // Effective per-view values (override if set for current view, else global) - const effectiveHourLabelFormat = getEffective("hourLabelFormat", hourLabelFormat); - const effectiveShowSubHourSlots = getEffective("showSubHourSlots", showSubHourSlots); + const effectiveHourLabelFormat = getEffective("hourLabelFormat", profile.hourLabelFormat ?? "short"); + const effectiveShowSubHourSlots = getEffective("showSubHourSlots", profile.showSubHourSlots ?? true); const effectiveWeatherEnabled = getEffective("weatherEnabled", profile.weatherEnabled); const effectiveWeatherDisplay = (getEffective("weatherDisplay", WEATHER_DISPLAY_DEFAULTS) || WEATHER_DISPLAY_DEFAULTS) as WeatherDisplayKey[]; const effectiveShowTaskCheckboxes = getEffective("showTaskCheckboxes", profile.showTaskCheckboxes); const effectiveShowProjectIcons = getEffective("showProjectIcons", profile.showProjectIcons); - const effectiveShowSomeday = getEffective("showSomeday", showSomeday); - const effectiveShowAllDay = getEffective("showAllDayEvents", showAllDay); - const effectiveAllDayPosition = getEffective("allDayPosition", allDayPosition) || "above"; + const effectiveShowSomeday = getEffective("showSomeday", profile.showSomeday ?? true); + const effectiveShowAllDay = getEffective("showAllDayEvents", profile.showAllDayEvents ?? true); + const effectiveAllDayPosition = getEffective("allDayPosition", profile.allDayPosition ?? "above") || "above"; const effectiveShowCompletedTasks = getEffective("showCompletedTasks", profile.showCompletedTasks !== false); - const effectiveCellDuration = getEffective("cellDuration", cellDuration) as CellDuration; + const effectiveCellDuration = getEffective("cellDuration", profile.cellDuration ?? 30) as CellDuration; const effectiveStartHour = getEffective("startHour", profile.startHour ?? 8) ?? 8; const effectiveEndHour = getEffective("endHour", profile.endHour ?? 18) ?? 18; @@ -1321,14 +1322,14 @@ export default function WeeklyView() { useEffect(() => { if (!mounted) return; - localStorage.setItem("weekly-week-start", String(weekStartDay)); + localStorage.setItem("weekly-week-start", String(profile.weekStartDay ?? 1)); // REMOVED: Re-align current week start when start day changes // This was forcing the view to snap to Monday, breaking the "Yesterday as first column" setting. // setCurrentWeekStart(prev => getStartOfWeek(prev, weekStartDay)); - }, [weekStartDay, mounted]); + }, [profile.weekStartDay, mounted]); // Translation helper - const t = translations[language] || translations["en"]; + const t = translations[profile.language] || translations["en"]; // Refs for scroll const dayColumnsRef = useRef([]); @@ -1371,7 +1372,7 @@ export default function WeeklyView() { window.removeEventListener('resize', updateHeight); if (resizeObserver) resizeObserver.disconnect(); }; - }, [dayHeaderRef.current, cellDuration, viewDays, isMobile, profile.mobileDateLayout, profile.dateLayout, profile.dateAlignment, profile.dayHeaderGap, profile.headlineFontSize, profile.headlineFontWeight, profile.dateFontSize, profile.dateVerticalAlign, profile.headerDisplay, profile.weekdayFormat, viewStyle]); + }, [dayHeaderRef.current, profile.cellDuration, viewDays, isMobile, profile.mobileDateLayout, profile.dateLayout, profile.dateAlignment, profile.dayHeaderGap, profile.headlineFontSize, profile.headlineFontWeight, profile.dateFontSize, profile.dateVerticalAlign, profile.headerDisplay, profile.weekdayFormat, profile.viewStyle]); const somedaySectionRef = useRef(null); // Unified scroll sync handlers @@ -1383,8 +1384,8 @@ export default function WeeklyView() { }; const jumpToHour = (hour: number) => { - const slotsPerHour = 60 / cellDuration; - const slotHeight = getSlotHeight(cellDuration); + const slotsPerHour = 60 / effectiveCellDuration; + const slotHeight = getSlotHeight(effectiveCellDuration); const scrollOffset = hour * slotsPerHour * slotHeight; console.log(`[SCROLL] Jumping to hour ${hour} (offset ${scrollOffset}px)`); @@ -1449,8 +1450,8 @@ export default function WeeklyView() { }; // Working hours range (configurable) - const workingHoursStart = startHour; - const workingHoursEnd = endHour; + const workingHoursStart = profile.startHour ?? 8; + const workingHoursEnd = profile.endHour ?? 18; // Fetch calendar events // Find connectionId for a given calendarId @@ -1984,7 +1985,7 @@ export default function WeeklyView() { // Mobile: show a sticky day bar by reading scroll position on the actual grid scroll container useEffect(() => { - if (!isMobile || !showTimeGrid) return; + if (!isMobile || !profile.showTimeGrid) return; const grid = gridRef.current; if (!grid) return; @@ -2009,7 +2010,7 @@ export default function WeeklyView() { const dateStr = (currentCol as Element).getAttribute('data-date'); if (dateStr) { const d = new Date(dateStr + 'T00:00:00'); - const dayNames = language === 'de' + const dayNames = profile.language === 'de' ? ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'] : ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; const label = `${dayNames[d.getDay()]} ${d.getDate()}.${d.getMonth() + 1}.`; @@ -2021,7 +2022,7 @@ export default function WeeklyView() { grid.addEventListener('scroll', updateStickyDay, { passive: true }); updateStickyDay(); return () => grid.removeEventListener('scroll', updateStickyDay); - }, [isMobile, showTimeGrid, currentWeekStart, viewDays, language]); + }, [isMobile, profile.showTimeGrid, currentWeekStart, viewDays, profile.language]); // Compute the goal date key: for "week" scope, normalize to Monday of that week; for "day", use the exact date const getGoalDateKey = useCallback( @@ -2212,7 +2213,7 @@ export default function WeeklyView() { setStartHour(data.user.startHour); if (data.user.endHour !== undefined) setEndHour(data.user.endHour); - if (data.user.viewStyle !== undefined) { + if (data.user.profile.viewStyle !== undefined) { setViewStyle(data.user.viewStyle as ViewStyle); setShowTimeGrid(data.user.showTimeGrid ?? true); } @@ -5029,7 +5030,7 @@ export default function WeeklyView() { 24, ); - const fontSizeScale = fontSize === "S" ? 0.85 : fontSize === "L" ? 1.15 : 1; + const fontSizeScale = profile.fontSize === "S" ? 0.85 : profile.fontSize === "L" ? 1.15 : 1; const mobileScale = isMobile ? (profile.mobileFontScale || 1.0) : 1.0; const fontVal = (v: string | undefined) => v && v !== "__custom__" ? v : ""; const scaleRem = (base: string) => { @@ -5049,8 +5050,8 @@ export default function WeeklyView() { "--weekly-item-hover": activeTheme.color0, } : {}), "--weekly-font-headline": - fontVal(profile.headlineFont) || headlineFont - ? `"${fontVal(profile.headlineFont) || headlineFont}", sans-serif` + fontVal(profile.headlineFont) + ? `"${fontVal(profile.headlineFont)}", sans-serif` : "var(--font-headline)", "--weekly-headline-size": scaleRem(profile.headlineFontSize || "1.25rem"), "--weekly-headline-weight": profile.headlineFontWeight || "900", @@ -5088,13 +5089,12 @@ export default function WeeklyView() { "--weekly-task-size": scaleRem(profile.taskFontSize || "0.9rem"), "--weekly-task-weight": profile.taskFontWeight || "400", "--weekly-event-font": - fontVal(profile.eventFontFamily) || eventFontFamily - ? `"${fontVal(profile.eventFontFamily) || eventFontFamily}", sans-serif` + fontVal(profile.eventFontFamily) + ? `"${fontVal(profile.eventFontFamily)}", sans-serif` : "var(--weekly-font)", - "--weekly-event-size": scaleRem(profile.eventFontSize || eventFontSize || "0.85rem"), - "--weekly-event-weight": - profile.eventFontWeight || eventFontWeight || "400", - "--font-weight-body": profile.fontWeight || fontWeight || "400", + "--weekly-event-size": scaleRem(profile.eventFontSize || "0.85rem"), + "--weekly-event-weight": profile.eventFontWeight || "400", + "--font-weight-body": profile.fontWeight || "400", "--weekly-weekend-sat": activeTheme?.color3 || (darkMode ? invertColor(profile.weekendColorSat || "#666666") : profile.weekendColorSat || "#666666"), @@ -5125,7 +5125,7 @@ export default function WeeklyView() { style={{ alignItems: "center", justifyContent: "center" }} >
- {translations[language]?.loading || translations["en"].loading} + {translations[profile.language]?.loading || translations["en"].loading}
); @@ -5172,7 +5172,7 @@ export default function WeeklyView() { style={isAllDayExpanded && allDayHeight ? { height: `${allDayHeight}px`, overflowY: 'auto' } : undefined} >
- {showTimeGrid && ( + {profile.showTimeGrid && (
setIsAllDayExpanded(!isAllDayExpanded)} @@ -5293,7 +5293,7 @@ export default function WeeklyView() { return (
{/* Mobile sticky day indicator */} @@ -5349,30 +5349,30 @@ export default function WeeklyView() { }} >
- {language === "de" ? "Einstellungen" : "Preferences"} + {profile.language === "de" ? "Einstellungen" : "Preferences"}
{/* Navigation Row */}
- +
{/* Quick Actions */}
- - - - - - + + + + + - +
{/* Separator */} @@ -5381,7 +5381,7 @@ export default function WeeklyView() { {/* View Style */}
- {language === "de" ? "Ansicht" : "View"} + {profile.language === "de" ? "Ansicht" : "View"}
{[ @@ -5391,7 +5391,7 @@ export default function WeeklyView() { { key: "kanban", icon: }, ].map((v) => ( ))} @@ -5401,7 +5401,7 @@ export default function WeeklyView() { {/* Columns / Days */}
- {language === "de" ? "Spalten" : "Days"} + {profile.language === "de" ? "Spalten" : "Days"}
{[1, 2, 3, 5, 7].map((num) => ( @@ -5414,10 +5414,10 @@ export default function WeeklyView() {
{/* Slot Duration (only with time grid) */} - {showTimeGrid && ( + {profile.showTimeGrid && (
- {language === "de" ? "Zeitfenster" : "Slot"} + {profile.language === "de" ? "Zeitfenster" : "Slot"}
{[15, 30, 60].map((d) => ( @@ -5433,12 +5433,12 @@ export default function WeeklyView() { {/* Text size */}
- {language === "de" ? "Textgröße" : "Text size"} + {profile.language === "de" ? "Textgröße" : "Text size"}
{(["S", "M", "L"] as const).map((size) => ( ))} @@ -5450,31 +5450,31 @@ export default function WeeklyView() { {/* Toggle switches */}
- {language === "de" ? "Irgendwann" : "Someday"} -
- {language === "de" ? "Zeitplan" : "Schedule"} -
- {language === "de" ? "Ganztägig" : "All-day"} -
- {language === "de" ? "Checkboxen" : "Checkboxes"} + {profile.language === "de" ? "Checkboxen" : "Checkboxes"}
- {language === "de" ? "Projekt-Icons" : "Project Icons"} + {profile.language === "de" ? "Projekt-Icons" : "Project Icons"} @@ -5482,30 +5482,30 @@ export default function WeeklyView() { {/* Start on */}
- {language === "de" ? "Starten mit" : "Start on"} + {profile.language === "de" ? "Starten mit" : "Start on"}
{/* Display mode */}
- {language === "de" ? "Anzeige" : "Display"} + {profile.language === "de" ? "Anzeige" : "Display"}
@@ -5529,7 +5529,7 @@ export default function WeeklyView() { style={{ display: "flex", alignItems: "center", gap: "6px", background: "none", border: "none", cursor: "pointer", fontSize: "0.75rem", color: darkMode ? "#6b7280" : "#9ca3af", padding: "4px 0" }} > - {language === "de" ? "Ausblenden" : "Hide"} + {profile.language === "de" ? "Ausblenden" : "Hide"}
@@ -5539,7 +5539,7 @@ export default function WeeklyView() { {showProjectsSidebar && ( setShowProjectsSidebar(false)} @@ -5608,14 +5608,14 @@ export default function WeeklyView() { d.getFullYear() === today.getFullYear() ); const refDate = isTodayInWeek ? today : getCWReferenceDate(getVisibleDays()); - return refDate.toLocaleDateString(language, { day: '2-digit', month: '2-digit', year: 'numeric' }); + return refDate.toLocaleDateString(profile.language, { day: '2-digit', month: '2-digit', year: 'numeric' }); })() : profile.headerDisplay === "month_year" ? - getCWReferenceDate(getVisibleDays()).toLocaleDateString(language, { month: 'long', year: 'numeric' }) : + getCWReferenceDate(getVisibleDays()).toLocaleDateString(profile.language, { month: 'long', year: 'numeric' }) : profile.headerDisplay === "custom" ? - formatCustomHeader(profile.headerCustomFormat || "KW WW | YYYY", getVisibleDays(), language, t) : + formatCustomHeader(profile.headerCustomFormat || "KW WW | YYYY", getVisibleDays(), profile.language, t) : profile.headerDisplay === "month" ? - getCWReferenceDate(getVisibleDays()).toLocaleDateString(language, { month: "long" }) : + getCWReferenceDate(getVisibleDays()).toLocaleDateString(profile.language, { month: "long" }) : `KW ${getWeekNumber(getCWReferenceDate(getVisibleDays())).toString().padStart(2, "0")} | ${getCWReferenceDate(getVisibleDays()).getFullYear()}` } @@ -5638,7 +5638,7 @@ export default function WeeklyView() { @@ -5647,28 +5647,28 @@ export default function WeeklyView() {
{/* Slot Duration — desktop only (available in sidebar on tablet) */} - {showTimeGrid && ( + {profile.showTimeGrid && (
setShowDatePicker(false)} - language={language} + language={profile.language} anchorRef={datePickerBtnRef} /> )} @@ -5754,9 +5754,9 @@ export default function WeeklyView() { profile.headerDisplay === "none" ? "" : profile.headerDisplay === "month" - ? getCWReferenceDate(getVisibleDays()).toLocaleDateString(language, { month: "long" }) + ? getCWReferenceDate(getVisibleDays()).toLocaleDateString(profile.language, { month: "long" }) : profile.headerDisplay === "month_year" - ? getCWReferenceDate(getVisibleDays()).toLocaleDateString(language, { month: "long", year: "numeric" }) + ? getCWReferenceDate(getVisibleDays()).toLocaleDateString(profile.language, { month: "long", year: "numeric" }) : profile.headerDisplay === "date" ? (() => { const today = new Date(); @@ -5766,10 +5766,10 @@ export default function WeeklyView() { d.getFullYear() === today.getFullYear() ); const refDate = isTodayInWeek ? today : getCWReferenceDate(getVisibleDays()); - return refDate.toLocaleDateString(language, { day: '2-digit', month: '2-digit', year: 'numeric' }); + return refDate.toLocaleDateString(profile.language, { day: '2-digit', month: '2-digit', year: 'numeric' }); })() : profile.headerDisplay === "custom" - ? formatCustomHeader(profile.headerCustomFormat || "KW WW | YYYY", getVisibleDays(), language, t) + ? formatCustomHeader(profile.headerCustomFormat || "KW WW | YYYY", getVisibleDays(), profile.language, t) : `KW ${getWeekNumber(getCWReferenceDate(getVisibleDays())).toString().padStart(2, "0")}` } @@ -5833,9 +5833,9 @@ export default function WeeklyView() { /> ) : ( !showNextTask && setIsEditingGoal(true)} - className={`cursor-pointer font-medium italic transition-colors ${showNextTask ? "cursor-default text-gray-600 dark:text-white hover:text-black dark:hover:text-gray-100" : "text-gray-600 dark:text-yellow-400 hover:text-black dark:hover:text-yellow-300"}`} - title={showNextTask ? "Next task" : "Edit goal"} + onClick={() => !profile.showNextTask && setIsEditingGoal(true)} + className={`cursor-pointer font-medium italic transition-colors ${profile.showNextTask ? "cursor-default text-gray-600 dark:text-white hover:text-black dark:hover:text-gray-100" : "text-gray-600 dark:text-yellow-400 hover:text-black dark:hover:text-yellow-300"}`} + title={profile.showNextTask ? "Next task" : "Edit goal"} style={{ fontFamily: profile.goalFontFamily ? `"${profile.goalFontFamily}", sans-serif` @@ -5852,7 +5852,7 @@ export default function WeeklyView() { WebkitBoxOrient: "vertical" as const, }} > - {showNextTask + {profile.showNextTask ? (() => { const today = new Date(); today.setHours(0, 0, 0, 0); @@ -5900,8 +5900,8 @@ export default function WeeklyView() { - - - + + - + - +
- {language === "de" ? "Tage" : "Days"}: + {profile.language === "de" ? "Tage" : "Days"}: {[1, 2, 3, 5, 7].map((num) => (
- {showTimeGrid && ( + {profile.showTimeGrid && (
- {language === "de" ? "Slot" : "Slot"}: + {profile.language === "de" ? "Slot" : "Slot"}: {[15, 30, 60].map((duration) => ( @@ -6333,7 +6333,7 @@ export default function WeeklyView() { @@ -6346,7 +6346,7 @@ export default function WeeklyView() { setKanbanNewTaskTitle(e.target.value)} onKeyDown={(e) => { @@ -6401,7 +6401,7 @@ export default function WeeklyView() { }} > - {language === "de" ? "Aufgabe" : "Add task"} + {profile.language === "de" ? "Aufgabe" : "Add task"} )}
@@ -6438,7 +6438,7 @@ export default function WeeklyView() { setKanbanNewTaskTitle(e.target.value)} onKeyDown={(e) => { @@ -6493,7 +6493,7 @@ export default function WeeklyView() { }} > - {language === "de" ? "Aufgabe" : "Add task"} + {profile.language === "de" ? "Aufgabe" : "Add task"} )}
@@ -6506,15 +6506,15 @@ export default function WeeklyView() { })()} {/* Main Grid with Time Column */} - {viewStyle !== "kanban" &&
-
} onScroll={handleGridScroll} style={showTimeGrid ? { + {profile.viewStyle !== "kanban" &&
+
} onScroll={handleGridScroll} style={profile.showTimeGrid ? { height: '100%', overflowY: 'auto', overflowX: 'hidden', WebkitOverflowScrolling: 'touch' as any, } : undefined}> {/* Time Column */} - {showTimeGrid && ( + {profile.showTimeGrid && (
{(isHourStart || effectiveShowSubHourSlots) && ( - {formatHour(hour, parseInt(minutes), (isHourStart ? effectiveHourLabelFormat : 'full') as "short" | "full", timeFormat)} + {formatHour(hour, parseInt(minutes), (isHourStart ? effectiveHourLabelFormat : 'full') as "short" | "full", profile.timeFormat)} )}
); })} {/* End-of-day 24:00 label */}
- {timeFormat === '24h' ? '24' : '12 AM'} + {profile.timeFormat === '24h' ? '24' : '12 AM'}
@@ -6629,7 +6629,7 @@ export default function WeeklyView() { className={`weekly-days-grid cols-${viewDays}`} data-slide-direction={slideDirection} data-nav-type={viewDays > 1 ? "week" : "day"} - style={showTimeGrid ? { + style={profile.showTimeGrid ? { height: `${24 * (60 / effectiveCellDuration) * getSlotHeight(effectiveCellDuration) + getHeaderHeight(effectiveCellDuration)}px`, flex: 1, alignSelf: "flex-start", @@ -6693,21 +6693,21 @@ export default function WeeklyView() { <> {activeDateLayout === "left" && ( - {formatDateHeader(date, language)} + {formatDateHeader(date, profile.language)} )}

- {getDayName(date, language, weekdayFormat, customWeekdayNames, weekStartDay, weekdayCase)} + {getDayName(date, profile.language, profile.weekdayFormat, profile.customWeekdayNames, profile.weekStartDay, profile.weekdayCase)}

{(activeDateLayout === "right" || activeDateLayout === "above" || activeDateLayout === "below" || activeDateLayout === undefined) && ( - {formatDateHeader(date, language)} + {formatDateHeader(date, profile.language)} )} @@ -6717,14 +6717,14 @@ export default function WeeklyView() { {/* Time Grid or Simple List */} - {showTimeGrid ? ( + {profile.showTimeGrid ? (
{/* Calendar Fetching Indicator */} - {showTimeGrid && colIndex === 0 && isFetchingCalendar && ( + {profile.showTimeGrid && colIndex === 0 && isFetchingCalendar && (
Syncing Calendar... @@ -7319,7 +7319,7 @@ export default function WeeklyView() {
} {/* All-Day Events Section (below position) — hidden in kanban */} - {viewStyle !== "kanban" && effectiveAllDayPosition === "below" && allDaySection} + {profile.viewStyle !== "kanban" && effectiveAllDayPosition === "below" && allDaySection} {/* Someday Section */} {effectiveShowSomeday && (<> @@ -8383,8 +8383,8 @@ export default function WeeklyView() { initialStartTime={calendarEventModal.initialStartTime} initialEndTime={calendarEventModal.initialEndTime} connections={connections} - weekStartDay={weekStartDay} - language={language} + weekStartDay={profile.weekStartDay ?? 1} + language={profile.language} onClose={() => setCalendarEventModal({ ...calendarEventModal, isOpen: false }) } @@ -8411,13 +8411,13 @@ export default function WeeklyView() { padding: '16px 20px 12px', fontWeight: 700, fontSize: '0.95rem', borderBottom: '2px solid #3b82f6', }}> - {language === 'de' ? 'Wiederkehrendes Ereignis bearbeiten' : 'Edit recurring event'} + {profile.language === 'de' ? 'Wiederkehrendes Ereignis bearbeiten' : 'Edit recurring event'}
{([ - { value: 'this' as const, title: language === 'de' ? 'Nur dieses Ereignis' : 'This event', desc: language === 'de' ? 'Alle anderen Ereignisse der Serie bleiben unverändert.' : 'All other events in the series stay the same.' }, - { value: 'future' as const, title: language === 'de' ? 'Dieses und folgende Ereignisse' : 'This and following events', desc: language === 'de' ? 'Dieses und alle zukünftigen Ereignisse der Serie werden geändert.' : 'This and all future events in the series will be changed.' }, - { value: 'all' as const, title: language === 'de' ? 'Alle Ereignisse' : 'All events', desc: language === 'de' ? 'Alle Ereignisse der Serie werden geändert.' : 'All events in the series will be changed.' }, + { value: 'this' as const, title: profile.language === 'de' ? 'Nur dieses Ereignis' : 'This event', desc: profile.language === 'de' ? 'Alle anderen Ereignisse der Serie bleiben unverändert.' : 'All other events in the series stay the same.' }, + { value: 'future' as const, title: profile.language === 'de' ? 'Dieses und folgende Ereignisse' : 'This and following events', desc: profile.language === 'de' ? 'Dieses und alle zukünftigen Ereignisse der Serie werden geändert.' : 'This and all future events in the series will be changed.' }, + { value: 'all' as const, title: profile.language === 'de' ? 'Alle Ereignisse' : 'All events', desc: profile.language === 'de' ? 'Alle Ereignisse der Serie werden geändert.' : 'All events in the series will be changed.' }, ]).map(opt => (
@@ -8485,7 +8485,7 @@ export default function WeeklyView() { t.dayOfWeek === now.getDay() && isSameDay( currentWeekStart, - getStartOfWeek(now, weekStartDay), + getStartOfWeek(now, profile.weekStartDay ?? 1), ))), ); @@ -8520,19 +8520,19 @@ export default function WeeklyView() { } }} onSettingsChanged={handleSettingsChanged} - showTimeGrid={showTimeGrid} + showTimeGrid={profile.showTimeGrid ?? true} setShowTimeGrid={setShowTimeGrid} - cellDuration={cellDuration} + cellDuration={profile.cellDuration ?? 30} setCellDuration={setCellDuration} - weekStartDay={weekStartDay} + weekStartDay={profile.weekStartDay ?? 1} setWeekStartDay={setWeekStartDay} - viewStyle={viewStyle} + viewStyle={profile.viewStyle ?? "simple"} setViewStyle={setViewStyle} - showSomeday={showSomeday} + showSomeday={profile.showSomeday ?? true} setShowSomeday={setShowSomeday} - showAllDay={showAllDay} + showAllDay={profile.showAllDayEvents ?? true} setShowAllDay={setShowAllDay} - showSchedule={showSchedule} + showSchedule={profile.showSchedule ?? true} setShowSchedule={setShowSchedule} goal={goal} setGoal={setGoal} @@ -8543,26 +8543,26 @@ export default function WeeklyView() { setFocusTimerDuration={setFocusTimerDuration} focusBreakDuration={focusBreakDuration} setFocusBreakDuration={setFocusBreakDuration} - fontSize={fontSize} + fontSize={profile.fontSize ?? "M"} setFontSize={setFontSize} - showNextTask={showNextTask} + showNextTask={profile.showNextTask ?? false} setShowNextTask={setShowNextTask} - headlineFont={headlineFont} - headlineFontSize={headlineFontSize} - headlineFontWeight={headlineFontWeight} - dateFontFamily={dateFontFamily} - dateFontSize={dateFontSize} - dateFontWeight={dateFontWeight} - timeTaskFontFamily={timeTaskFontFamily} - timeTaskFontSize={timeTaskFontSize} - timeTaskFontWeight={timeTaskFontWeight} - bodyFont={bodyFont} - taskFontFamily={taskFontFamily} - taskFontSize={taskFontSize} - taskFontWeight={taskFontWeight} - fontWeight={fontWeight} - weekendColorSat={weekendColorSat} - weekendColorSun={weekendColorSun} + headlineFont={profile.headlineFont ?? "Inter"} + headlineFontSize={profile.headlineFontSize ?? "1.25rem"} + headlineFontWeight={profile.headlineFontWeight ?? "900"} + dateFontFamily={profile.dateFontFamily ?? "Inter"} + dateFontSize={profile.dateFontSize ?? "0.65rem"} + dateFontWeight={profile.dateFontWeight ?? "400"} + timeTaskFontFamily={profile.timeTaskFontFamily ?? "Inter"} + timeTaskFontSize={profile.timeTaskFontSize ?? "0.75rem"} + timeTaskFontWeight={profile.timeTaskFontWeight ?? "500"} + bodyFont={profile.bodyFont ?? "Inter"} + taskFontFamily={profile.taskFontFamily ?? "Inter"} + taskFontSize={profile.taskFontSize ?? "0.9rem"} + taskFontWeight={profile.taskFontWeight ?? "400"} + fontWeight={profile.fontWeight ?? "400"} + weekendColorSat={profile.weekendColorSat ?? "#666666"} + weekendColorSun={profile.weekendColorSun ?? "#dc2626"} protectEventTimes={protectEventTimes} setProtectEventTimes={setProtectEventTimes} goalFontWeight={profile.goalFontWeight || "500"} @@ -8572,11 +8572,11 @@ export default function WeeklyView() { executeImport={executeImport} onImportLists={(lists) => doImport("apple", lists)} importStatusMsg={importStatusMsg} - hourLabelFormat={hourLabelFormat} + hourLabelFormat={profile.hourLabelFormat ?? "short"} setHourLabelFormat={setHourLabelFormat} - showSubHourSlots={showSubHourSlots} + showSubHourSlots={profile.showSubHourSlots ?? true} setShowSubHourSlots={setShowSubHourSlots} - allDayPosition={allDayPosition} + allDayPosition={profile.allDayPosition ?? "above"} setAllDayPosition={setAllDayPosition} saveSetting={saveSetting} availableTaskLists={availableTaskLists} @@ -8609,7 +8609,7 @@ export default function WeeklyView() { }, onAddProject: () => { setShowProjectsSidebar(true); }, onRecurringTasks: () => setIsRecurringTasksOpen(true), - onToggleNextTask: () => { const newVal = !showNextTask; setShowNextTask(newVal); saveSetting("showNextTask", newVal); }, + onToggleNextTask: () => { const newVal = !profile.showNextTask; setShowNextTask(newVal); saveSetting("showNextTask", newVal); }, onFocusMode: () => setShowFocusMode(true), onToggleDarkMode: () => setDarkMode(!darkMode), onSearch: () => setIsSearchOpen(true), @@ -8617,18 +8617,18 @@ export default function WeeklyView() { onRedo: handleRedo, onRefresh: () => { fetchCalendarEvents(true); fetchTasks(); }, darkMode, - showNextTask, + showNextTask: profile.showNextTask ?? false, undoCount, redoCount, viewDays, onViewDaysChange: (num: number) => { setViewDays(num); savedViewDaysRef.current = num; saveSetting("viewDays", num); }, - showTimeGrid, - cellDuration, + showTimeGrid: profile.showTimeGrid ?? true, + cellDuration: profile.cellDuration ?? 30, onCellDurationChange: (d: CellDuration) => { setCellDuration(d); saveSetting("cellDuration", d); }, - viewStyle, + viewStyle: profile.viewStyle ?? "simple", onViewStyleChange: (s: string) => { setViewStyle(s as any); saveSetting("viewStyle", s); }, - startHour, - endHour, + startHour: profile.startHour ?? 8, + endHour: profile.endHour ?? 18, onStartHourChange: (h: number) => { setStartHour(h); saveSetting("startHour", h); }, onEndHourChange: (h: number) => { setEndHour(h); saveSetting("endHour", h); }, }} @@ -8647,7 +8647,7 @@ export default function WeeklyView() { task={selectedTaskForRecurrence} onClose={() => setSelectedTaskForRecurrence(null)} onSave={handleRecurrenceSave} - language={language} + language={profile.language} /> ) } @@ -8657,7 +8657,7 @@ export default function WeeklyView() { { await saveSetting("hasCompletedOnboarding", true); setShowOnboarding(false); await fetchProfile(); }} onSkip={async () => { await saveSetting("hasCompletedOnboarding", true); setShowOnboarding(false); await fetchProfile(); }} @@ -8808,7 +8808,7 @@ export default function WeeklyView() { setKanbanDetailTask({ ...liveTask, markdownContent: val }); } }} - placeholder={language === "de" ? "Notizen hinzufügen..." : "Add notes..."} + placeholder={profile.language === "de" ? "Notizen hinzufügen..." : "Add notes..."} className="kanban-detail-notes" rows={4} /> @@ -8863,7 +8863,7 @@ export default function WeeklyView() { @@ -8876,7 +8876,7 @@ export default function WeeklyView() { @@ -8885,7 +8885,7 @@ export default function WeeklyView() { onClick={() => setKanbanDetailTask(null)} className="kanban-detail-btn kanban-detail-btn-cancel" > - {language === "de" ? "Abbrechen" : "Cancel"} + {profile.language === "de" ? "Abbrechen" : "Cancel"}
)} @@ -9026,7 +9026,7 @@ export default function WeeklyView() { setShowDatePicker(false); }} onClose={() => setShowDatePicker(false)} - language={language} + language={profile.language} />