fix(frontend): login P0 — 去卡头重复、offline 文案、显密可键盘

去掉卡内盾牌标题;后端不可用改为「服务暂不可用」并禁用登录钮;显密切换可 Tab 聚焦。
This commit is contained in:
Codex committed 2026-10-28 21:47:25 +08:00
1 parent c759e111ec
commit c1e21c20d8
3 files changed
+34 -15

No files matched your search

+3 -11
View File
@@ -1,7 +1,7 @@
import { memo, useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useLocation, useNavigate } from 'react-router'
import { Activity, Eye, EyeOff, Shield, ServerOff } from 'lucide-react'
import { Activity, Eye, EyeOff, ServerOff } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Checkbox } from '@/components/ui/checkbox'
import { Input } from '@/components/ui/input'
@@ -106,20 +106,12 @@ const Login = memo(function Login() {
<div>
<p className="text-sm font-medium text-warning">{t('login.backendDown')}</p>
<p className="text-xs text-warning mt-1">{t('login.backendDownHint')}</p>
<code className="block mt-2 px-3 py-2 bg-warning/20 rounded text-xs font-mono text-warning">
./run.sh
</code>
</div>
</div>
)}
{/* Login Card */}
<div className="bg-card rounded-2xl shadow-lg border border-border p-8">
<div className="flex items-center gap-2 mb-6">
<Shield className="w-5 h-5 text-primary" />
<h2 className="text-lg font-semibold text-foreground">{t('login.heading')}</h2>
</div>
{error && (
<div className="mb-4 p-3 rounded-lg bg-destructive/10 border border-destructive/30 text-destructive text-sm">
{error}
@@ -157,7 +149,7 @@ const Login = memo(function Login() {
type="button"
onClick={togglePassword}
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
tabIndex={-1}
aria-label={showPassword ? t('login.hidePassword') : t('login.showPassword')}
>
{showPassword ? (
<EyeOff className="w-4 h-4" />
@@ -182,7 +174,7 @@ const Login = memo(function Login() {
<Button
type="submit"
className="w-full h-10 bg-primary hover:bg-primary/90 text-primary-foreground"
disabled={loading}
disabled={loading || backendStatus === 'offline'}
>
{loading ? t('login.submitting') : t('login.submit')}
</Button>