perf: fix stale auto-save bug + extract SettingsSidebar to lazy chunk

- saveSetting: add setProfile(p => ({...p, [key]: value})) so profile
  stays in sync with individual setting changes — prevents auto-save
  from overwriting fresh settings with stale profile object values
- Extract SettingsSidebar (4725 lines) from WeeklyView.tsx into its own
  file; lazy-load with next/dynamic so the ~4500-line settings panel
  is deferred until the user opens settings
- Extract shared constants/helpers to src/lib/:
  fontConstants.ts (AVAILABLE_FONTS, FONT_WEIGHTS, isCustomFont)
  weeklyViewTranslations.ts (translations object, ~1100 lines)
  weeklyViewConstants.ts (WeatherDisplayKey, WEATHER_DISPLAY_DEFAULTS)
- WeeklyView.tsx: 16,209 → 10,364 lines (-36%)

v1.80.0
This commit is contained in:
mARTin 2026-03-30 22:03:09 +02:00
parent 6fed38381c
commit a5f6edd82d
6 changed files with 5907 additions and 5854 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.79.0", "version": "1.80.0",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

28
src/lib/fontConstants.ts Normal file
View File

@ -0,0 +1,28 @@
// Font options shared between WeeklyView and SettingsSidebar
export const AVAILABLE_FONTS = [
{ name: "Default (Inter)", value: "Inter" },
{ name: "Roboto", value: "Roboto" },
{ name: "Open Sans", value: "Open Sans" },
{ name: "Lato", value: "Lato" },
{ name: "Montserrat", value: "Montserrat" },
{ name: "Oswald", value: "Oswald" },
{ name: "Raleway", value: "Raleway" },
{ name: "Playfair Display", value: "Playfair Display" },
{ name: "Merriweather", value: "Merriweather" },
{ name: "Nunito", value: "Nunito" },
{ name: "Dancing Script", value: "Dancing Script" },
{ name: "Pacifico", value: "Pacifico" },
{ name: "Custom Google Font...", value: "__custom__" },
];
// Check if a font value is a custom (non-preset) font
export const isCustomFont = (value: string): boolean =>
!!value && value !== "__custom__" && !AVAILABLE_FONTS.slice(0, -1).some((f) => f.value === value);
export const FONT_WEIGHTS = [
{ name: "Light", value: "300" },
{ name: "Normal", value: "400" },
{ name: "Medium", value: "500" },
{ name: "Bold", value: "700" },
];

View File

@ -0,0 +1,4 @@
// Shared constants for WeeklyView and SettingsSidebar
export type WeatherDisplayKey = "icon" | "temp" | "feelsLike" | "wind" | "gusts" | "precipProb" | "precip" | "humidity" | "uv";
export const WEATHER_DISPLAY_DEFAULTS: WeatherDisplayKey[] = ["icon", "temp"];

File diff suppressed because it is too large Load Diff