From e3fe01b9c3f1bbed4085e22a3db06f11e3a6058e Mon Sep 17 00:00:00 2001 From: Sajad Mirjalili Date: Mon, 29 Sep 2025 12:09:51 +0330 Subject: [PATCH] fix: settings defualt values --- public/locales/en/setting.json | 3 +-- public/locales/fa/setting.json | 3 +-- src/features/profile/routes/SettingPage.tsx | 13 ++++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/public/locales/en/setting.json b/public/locales/en/setting.json index cf75b15..87ab0d2 100644 --- a/public/locales/en/setting.json +++ b/public/locales/en/setting.json @@ -100,8 +100,7 @@ "dark": "Dark", "language": "زبان/language", "calendar": "Calendar and date format", - "solar": "Solar", - "lunar": "Lunar", + "jalali": "jalali", "christian": "Christian", "iran": "Iran", "saving": "Saving...", diff --git a/public/locales/fa/setting.json b/public/locales/fa/setting.json index 20c8cdd..3cd7f03 100644 --- a/public/locales/fa/setting.json +++ b/public/locales/fa/setting.json @@ -100,8 +100,7 @@ "dark": "تاریک", "language": "زبان/language", "calendar": "فرمت تقویم و تاریخ", - "solar": "شمسی", - "lunar": "قمری", + "jalali": "شمسی", "christian": "میلادی", "iran": "ایران", "saving": "در حال ذخیره‌سازی...", diff --git a/src/features/profile/routes/SettingPage.tsx b/src/features/profile/routes/SettingPage.tsx index 034e1c4..6318944 100644 --- a/src/features/profile/routes/SettingPage.tsx +++ b/src/features/profile/routes/SettingPage.tsx @@ -19,7 +19,7 @@ import { saveSettings } from '../api/settingsApi'; import { useProfile } from '../hooks/useProfile'; type ThemeMode = 'light' | 'dark'; -type CalendarType = 'christian' | 'solar' | 'lunar'; +type CalendarType = 'christian' | 'jalali'; interface SettingsState { language: string; @@ -33,9 +33,8 @@ const languageOptions = [ ]; const calendarOptions: { key: CalendarType; apiValue: number }[] = [ - { key: 'christian', apiValue: 1 }, - { key: 'solar', apiValue: 2 }, - { key: 'lunar', apiValue: 3 }, + { key: 'jalali', apiValue: 1 }, + { key: 'christian', apiValue: 2 }, ]; const themeApiMap: Record = { light: 1, dark: 2 }; @@ -46,7 +45,7 @@ export function SettingPage() { const [savedSettings, setSavedSettings] = useState({ language: i18n.language, - calendar: 'solar', + calendar: 'jalali', theme: mode === 'light' || mode === 'dark' ? mode : 'light', }); const [draftSettings, setDraftSettings] = @@ -78,9 +77,9 @@ export function SettingPage() { theme: themeReverseMap[theme] || 'light', calendar: calendarOptions.find((c) => c.apiValue === calendarType)?.key || - 'solar', + 'jalali', language: - languageOptions.find((l) => l.apiValue === language)?.code || 'en', + languageOptions.find((l) => l.apiValue === language)?.code || 'fa', }; setSavedSettings(newSettings); setDraftSettings(newSettings);