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:
46
src/modules/settings/components/quick-links-card.tsx
Normal file
46
src/modules/settings/components/quick-links-card.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { useTranslations } from "next-intl"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import { Button } from "@/shared/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/shared/components/ui/card"
|
||||
|
||||
export interface QuickLinkItem {
|
||||
href: string
|
||||
/** settings.quickLinks 命名空间下的 i18n 键 */
|
||||
labelKey: string
|
||||
icon?: ReactNode
|
||||
}
|
||||
|
||||
/**
|
||||
* 快捷链接卡片
|
||||
*
|
||||
* 在设置页 General 标签页底部展示角色专属的常用入口。
|
||||
* 文本通过 settings.quickLinks 命名空间国际化。
|
||||
*/
|
||||
export function QuickLinksCard({ links }: { links: QuickLinkItem[] }): ReactNode {
|
||||
const t = useTranslations("settings.quickLinks")
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{t("title")}</CardTitle>
|
||||
<CardDescription>{t("description")}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-wrap gap-2">
|
||||
<Button asChild variant="outline">
|
||||
<Link href="/profile">{t("profile")}</Link>
|
||||
</Button>
|
||||
{links.map((link) => (
|
||||
<Button key={link.href} asChild variant="outline" className="gap-2">
|
||||
<Link href={link.href}>
|
||||
{link.icon}
|
||||
{t(link.labelKey)}
|
||||
</Link>
|
||||
</Button>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user