- 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
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
// 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" },
|
|
];
|