feat(web): add settings sub-pages and connect to backend APIs
- Add GeneralSettingsPage for language, privacy, and notification settings - Add FeedbackPage for user feedback submission with image upload - Connect settings to backend PATCH /users/me/settings API - Implement language preference sync between frontend and backend - Update login flow to pass language preference and redirect based on user settings - Add Astro entry pages for /settings/general and /settings/feedback routes - Update sidebar navigation: language button links to general settings - Fix account data card to link to profile page - Remove "deletion" text from account data description
This commit is contained in:
@@ -30,6 +30,34 @@ interface SessionResponse {
|
||||
user: { id: string; email: string };
|
||||
}
|
||||
|
||||
// --- Language mapping ---
|
||||
|
||||
/**
|
||||
* Map frontend locale to backend BCP-47 language tag
|
||||
*/
|
||||
export function localeToBackendLanguage(locale: string): string {
|
||||
const mapping: Record<string, string> = {
|
||||
'zh': 'zh-CN',
|
||||
'zh_Hant': 'zh-TW',
|
||||
'en': 'en-US',
|
||||
};
|
||||
return mapping[locale] || 'zh-CN';
|
||||
}
|
||||
|
||||
/**
|
||||
* Map backend BCP-47 language tag to frontend locale
|
||||
*/
|
||||
export function backendLanguageToLocale(lang: string): string {
|
||||
const mapping: Record<string, string> = {
|
||||
'zh-CN': 'zh',
|
||||
'zh-TW': 'zh_Hant',
|
||||
'zh-Hant': 'zh_Hant',
|
||||
'en-US': 'en',
|
||||
'en': 'en',
|
||||
};
|
||||
return mapping[lang] || 'zh';
|
||||
}
|
||||
|
||||
// --- Storage ---
|
||||
|
||||
export function getAuth(): AuthData | null {
|
||||
|
||||
Reference in New Issue
Block a user