feat(web): 优化设置页面交互与语言同步
- 二级页面返回按钮导航到设置页而非路由栈上一页 - 通用设置开关等待后端响应后再更新 UI,失败时显示 toast - 删除用户名/邮箱的硬编码默认值,使用 auth token 邮箱作为 fallback - AppShell 侧边栏显示真实头像和用户名 - 页面加载时检查 URL 语言与用户偏好是否一致,不一致则重定向
This commit is contained in:
@@ -154,7 +154,7 @@ export default function ProfileDetailPage({ locale, profile: p }: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
const email = getAuth()?.user?.email || 'user@example.com';
|
||||
const email = getAuth()?.user?.email || '';
|
||||
|
||||
return (
|
||||
<div className="flex flex-col lg:flex-row gap-6 min-h-full">
|
||||
@@ -165,7 +165,7 @@ export default function ProfileDetailPage({ locale, profile: p }: Props) {
|
||||
<img src={profile.avatar_url} alt={displayName} className="w-32 h-32 rounded-full object-cover border-2 border-violet-200" />
|
||||
) : (
|
||||
<div className="w-32 h-32 rounded-full bg-violet-50 border-2 border-violet-200 flex items-center justify-center">
|
||||
<span className="text-violet-600 text-4xl font-bold">{(displayName || 'U')[0].toUpperCase()}</span>
|
||||
<span className="text-violet-600 text-4xl font-bold">{displayName ? displayName[0].toUpperCase() : '?'}</span>
|
||||
</div>
|
||||
)}
|
||||
<h3 className="text-slate-900 text-lg font-bold">{p.avatarTitle}</h3>
|
||||
@@ -205,7 +205,7 @@ export default function ProfileDetailPage({ locale, profile: p }: Props) {
|
||||
<span className="material-symbols-rounded text-slate-400 text-lg">email</span>
|
||||
<div>
|
||||
<p className="text-slate-400 text-xs">{p.emailLabel}</p>
|
||||
<p className="text-slate-600 text-sm">{email}</p>
|
||||
<p className="text-slate-600 text-sm">{email || '-'}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user