feat(settings): 设置与个人信息模块审计重构 — i18n + 服务注入解耦 + Error Boundary + 流式渲染

- 新增 SettingsService 接口 + Context 注入,组件层不再直接 import users/messaging actions

- 新增 resolveRoleSettingsConfig 配置驱动角色路由,删除 parent/student/teacher-settings-view 冗余文件

- 新增 SettingsSectionErrorBoundary,每个 TabsContent + profile 角色概览区块均包裹

- 新增 ProfileStudentOverview/ProfileTeacherOverview 异步 Server Component + 骨架屏,支持流式渲染

- 抽取 buildStudentOverviewData 等纯函数到 lib/student-overview-data.ts,便于单元测试

- 新增 settings.json 翻译文件(zh-CN + en),所有组件改用 useTranslations/getTranslations

- 重构 profile/page.tsx:i18n 适配 + Suspense 分区加载 + 业务逻辑抽离

- 同步更新架构图 004/005
This commit is contained in:
SpecialX
2026-06-22 16:15:36 +08:00
parent 21c7e65fee
commit 5d42495480
29 changed files with 2445 additions and 1094 deletions

View File

@@ -0,0 +1,280 @@
{
"title": "Settings",
"backToDashboard": "Back to dashboard",
"tabs": {
"general": "General",
"notifications": "Notifications",
"appearance": "Appearance",
"security": "Security",
"ai": "AI"
},
"profile": {
"title": "Profile Information",
"description": "Update your personal information.",
"fields": {
"name": "Full Name",
"namePlaceholder": "Your name",
"email": "Email",
"emailDisabled": "Email cannot be changed.",
"phone": "Phone",
"phonePlaceholder": "+1 234 567 890",
"address": "Address",
"addressPlaceholder": "123 Main St, City, Country",
"gender": "Gender",
"genderPlaceholder": "Select gender",
"age": "Age",
"role": "Role"
},
"save": "Save Changes",
"saving": "Saving...",
"success": "Profile updated successfully",
"failure": "Failed to update profile"
},
"notifications": {
"title": "Notification Preferences",
"description": "Choose how and when you want to be notified.",
"channels": {
"title": "Delivery Channels",
"subtitle": "Select the channels through which you want to receive notifications.",
"push": "Push Notifications",
"pushDesc": "Receive in-app and browser push notifications.",
"email": "Email",
"emailDesc": "Send notifications to my registered email address.",
"sms": "SMS",
"smsDesc": "Send critical notifications via SMS (charges may apply)."
},
"categories": {
"title": "Notification Categories",
"subtitle": "Choose which types of events should trigger notifications.",
"messages": "Messages",
"messagesDesc": "New direct messages and replies.",
"announcements": "Announcements",
"announcementsDesc": "School, grade, and class announcements.",
"homework": "Homework",
"homeworkDesc": "New assignments and submission reminders.",
"grades": "Grades",
"gradesDesc": "Exam and assignment grade releases.",
"attendance": "Attendance",
"attendanceDesc": "Attendance records and absence alerts."
},
"quietHours": {
"title": "Quiet Hours",
"subtitle": "Suppress non-urgent notifications during a specified time period each day.",
"enable": "Enable Quiet Hours",
"enableDesc": "When enabled, only urgent notifications will be delivered during the specified hours.",
"start": "Start Time",
"end": "End Time"
},
"save": "Save Preferences",
"saving": "Saving...",
"success": "Preferences updated",
"failure": "Failed to update preferences"
},
"appearance": {
"theme": {
"title": "Theme",
"description": "Choose how the interface looks on this device.",
"label": "Color theme",
"system": "System",
"light": "Light",
"dark": "Dark"
},
"language": {
"title": "Language",
"description": "Choose the interface language.",
"label": "Interface language"
}
},
"security": {
"changePassword": {
"title": "Change Password",
"description": "Choose a strong password to keep your account secure.",
"current": "Current Password",
"currentPlaceholder": "Enter current password",
"new": "New Password",
"newPlaceholder": "Enter new password",
"confirm": "Confirm New Password",
"confirmPlaceholder": "Re-enter new password",
"strength": "Password strength",
"strengthWeak": "Weak",
"strengthMedium": "Medium",
"strengthStrong": "Strong",
"requirements": "Password requirements:",
"submit": "Update Password",
"updating": "Updating..."
},
"session": {
"title": "Session",
"description": "Account access and session controls.",
"signOut": "Log out",
"signOutDesc": "Return to the login screen.",
"confirmTitle": "Confirm sign out",
"confirmDesc": "Are you sure you want to sign out? You will be returned to the login screen.",
"cancel": "Cancel",
"confirm": "Sign out"
},
"tips": {
"title": "Security Tips",
"description": "Best practices to keep your account safe.",
"tip1": "Use a unique password that you don't reuse across other sites.",
"tip2": "Avoid common words, names, or sequential patterns.",
"tip3": "Change your password periodically.",
"tip4": "Your account will be temporarily locked after multiple failed login attempts."
}
},
"ai": {
"providers": {
"title": "AI Providers",
"description": "Manage AI vendors and default model configuration.",
"existing": "Existing Providers",
"selectPlaceholder": "Create new or select existing",
"createNew": "Create new",
"keyStatus": "Key Status",
"stored": "Stored",
"noKey": "No key stored",
"id": "ID",
"idDesc": "Auto-generated for each provider.",
"provider": "Provider",
"providerPlaceholder": "Select provider",
"baseUrl": "API URL",
"baseUrlPlaceholder": "https://open.bigmodel.cn/api/paas/v4",
"baseUrlDesc": "Enter base URL without /chat/completions suffix.",
"model": "Model",
"modelPlaceholder": "gpt-4o-mini",
"apiKey": "API Key",
"apiKeyPlaceholder": "Paste new key to replace",
"apiKeyDesc": "Existing key won't be displayed. Leave blank to keep current.",
"setDefault": "Set as default",
"test": "Test",
"testing": "Testing...",
"save": "Save Changes",
"saving": "Saving...",
"testSuccess": "Test passed",
"testFailure": "Test failed",
"saveSuccess": "Saved",
"saveFailure": "Failed to save",
"loadFailure": "Failed to load AI providers",
"needKey": "Please enter API key to test",
"needTest": "Please test the configuration before saving"
}
},
"quickLinks": {
"title": "Quick links",
"description": "Common places you may want to visit.",
"profile": "Profile",
"dashboard": "Dashboard",
"children": "Children",
"grades": "Grades",
"attendance": "Attendance",
"assignments": "Assignments",
"schedule": "Schedule",
"textbooks": "Textbooks",
"exams": "Exams",
"homework": "Homework"
},
"roleDescriptions": {
"admin": "Manage your account and system configuration.",
"teacher": "Manage your profile, notifications, and teaching preferences.",
"student": "Manage your profile, notifications, and learning preferences.",
"parent": "Manage your profile, notifications, and child follow-up preferences."
},
"errors": {
"loadFailed": "Page load failed",
"loadFailedDesc": "Sorry, an unexpected error occurred while loading the page. Please try again later.",
"retry": "Retry",
"sectionLoadFailed": "This section failed to load",
"sectionLoadFailedDesc": "Please try again later."
},
"admin": {
"title": "System Settings",
"description": "Manage system basics and runtime parameters.",
"schoolInfo": {
"title": "School Information",
"description": "Basic school information displayed throughout the system.",
"name": "School Name",
"namePlaceholder": "Enter school name",
"code": "School Code",
"codePlaceholder": "Enter school code",
"phone": "Contact Phone",
"phonePlaceholder": "Enter contact phone",
"email": "Contact Email",
"emailPlaceholder": "Enter contact email",
"address": "School Address",
"addressPlaceholder": "Enter school address",
"description2": "School Description",
"descriptionPlaceholder": "Enter school description"
},
"securityPolicy": {
"title": "Security Policy",
"description": "Password policy and session management.",
"passwordMinLength": "Minimum Password Length",
"sessionTimeout": "Session Timeout (minutes)",
"requireSpecialChar": "Require special characters in passwords",
"requireSpecialCharDesc": "Require at least one special character in user passwords",
"requireUppercase": "Require uppercase letters in passwords",
"requireUppercaseDesc": "Require at least one uppercase letter in user passwords",
"forcePasswordChange": "Force password change on first login",
"forcePasswordChangeDesc": "New users or after password reset must change password on first login"
},
"fileUpload": {
"title": "File Upload",
"description": "File upload limits and storage configuration.",
"maxFileSize": "Max File Size (MB)",
"allowedTypes": "Allowed File Types",
"allowedTypesPlaceholder": "e.g. jpg,png,pdf,docx"
},
"notificationConfig": {
"title": "Notification Configuration",
"description": "How and when system notifications are sent.",
"notifyNewUser": "Notify admins on new user registration",
"notifyNewUserDesc": "Send notification to admins when a new user registers",
"notifyScheduleChange": "Notify teachers on schedule changes",
"notifyScheduleChangeDesc": "Notify relevant teachers when schedule change is approved",
"notifyAnnouncement": "Notify target users on announcement publish",
"notifyAnnouncementDesc": "Push notification to target users when announcement is published"
},
"save": "Save Settings",
"saving": "Saving...",
"reset": "Reset",
"saveSuccess": "Settings saved",
"saveFailure": "Failed to save settings",
"loadFailure": "Failed to load system settings"
},
"profilePage": {
"title": "Profile",
"description": "Manage your personal and account information.",
"editProfile": "Edit Profile",
"personalInfo": {
"title": "Personal Information",
"description": "Basic personal details.",
"fullName": "Full Name",
"gender": "Gender",
"age": "Age",
"phone": "Phone",
"address": "Address"
},
"accountInfo": {
"title": "Account Information",
"description": "System account details.",
"email": "Email",
"role": "Role",
"memberSince": "Member Since",
"onboardedAt": "Onboarded At"
},
"studentOverview": {
"title": "Student Overview",
"description": "Your academic performance and schedule."
},
"teacherOverview": {
"title": "Teacher Overview",
"description": "Your teaching subjects and classes.",
"teachingSubjects": "Teaching Subjects",
"teachingSubjectsDesc": "Subjects you are currently assigned to teach.",
"noSubjects": "No subjects assigned yet.",
"teachingClasses": "Teaching Classes",
"teachingClassesDesc": "Classes you are currently managing.",
"noClasses": "No classes assigned yet.",
"view": "View"
}
}
}