feat(frontend): enhance terminal login UI with improved styling and i18n shortcuts

- Update PixelBlast animation with increased pixel size (6.5) and speed (0.35)
- Replace semantic color tokens with explicit zinc color palette for better visual consistency
- Add keyboard shortcuts translations to support multiple languages (en, zh)
- Implement i18n for all terminal UI labels: submit, cancel, clear, start/end actions
- Update terminal header and content styling with zinc-700 borders and zinc-100 text
- Enhance keyboard shortcuts hint display with localized action labels
- Improve text color hierarchy using zinc-400, zinc-500, and zinc-600 variants
This commit is contained in:
yyhuni
2026-01-14 10:58:12 +08:00
parent 191ff9837b
commit 08a4807bef
4 changed files with 39 additions and 16 deletions

View File

@@ -50,10 +50,12 @@ export default function LoginPage() {
<div className="relative flex min-h-svh flex-col bg-black">
<div className="fixed inset-0 z-0">
<PixelBlast
className=""
style={{}}
pixelSize={6}
pixelSize={6.5}
patternScale={4.5}
color="#06b6d4"
speed={0.35}
/>
</div>
@@ -76,6 +78,11 @@ export default function LoginPage() {
welcomeMessage: t("welcomeMessage"),
authFailed: t("authFailed"),
invalidCredentials: t("invalidCredentials"),
shortcuts: t("shortcuts"),
submit: t("submit"),
cancel: t("cancel"),
clear: t("clear"),
startEnd: t("startEnd"),
}}
/>
</div>

View File

@@ -20,6 +20,11 @@ interface TerminalLoginTranslations {
welcomeMessage: string
authFailed: string
invalidCredentials: string
shortcuts: string
submit: string
cancel: string
clear: string
startEnd: string
}
interface TerminalLine {
@@ -205,11 +210,11 @@ export function TerminalLogin({
return (
<>
<span className="text-foreground">{before}</span>
<span className="text-zinc-100">{before}</span>
<span className="animate-blink inline-block min-w-[0.6em] bg-green-500 text-black">
{cursorChar || "\u00A0"}
</span>
<span className="text-foreground">{after.slice(1)}</span>
<span className="text-zinc-100">{after.slice(1)}</span>
</>
)
}
@@ -219,18 +224,18 @@ export function TerminalLogin({
ref={containerRef}
onClick={handleContainerClick}
className={cn(
"border-border bg-background/80 backdrop-blur-sm z-0 w-full max-w-2xl rounded-xl border cursor-text",
"border-zinc-700 bg-zinc-900/80 backdrop-blur-sm z-0 w-full max-w-2xl rounded-xl border cursor-text",
className
)}
>
{/* Terminal header */}
<div className="border-border flex items-center gap-x-2 border-b px-4 py-3">
<div className="border-zinc-700 flex items-center gap-x-2 border-b px-4 py-3">
<div className="flex flex-row gap-x-2">
<div className="h-3 w-3 rounded-full bg-red-500"></div>
<div className="h-3 w-3 rounded-full bg-yellow-500"></div>
<div className="h-3 w-3 rounded-full bg-green-500"></div>
</div>
<span className="ml-2 text-xs text-muted-foreground font-mono">{t.title}</span>
<span className="ml-2 text-xs text-zinc-400 font-mono">{t.title}</span>
</div>
{/* Terminal content */}
@@ -247,7 +252,7 @@ export function TerminalLogin({
triggerOnHover={true}
triggerOnce={false}
/>
<div className="text-muted-foreground text-sm mt-3">
<div className="text-zinc-400 text-sm mt-3">
{t.subtitle}
</div>
</div>
@@ -259,8 +264,8 @@ export function TerminalLogin({
className={cn(
"whitespace-pre-wrap",
line.type === "prompt" && "text-green-500",
line.type === "input" && "text-foreground",
line.type === "info" && "text-muted-foreground",
line.type === "input" && "text-zinc-100",
line.type === "info" && "text-zinc-500",
line.type === "success" && "text-green-500",
line.type === "error" && "text-red-500",
line.type === "warning" && "text-yellow-500"
@@ -300,11 +305,12 @@ export function TerminalLogin({
{/* Keyboard shortcuts hint */}
{(step === "username" || step === "password") && (
<div className="mt-6 text-xs text-muted-foreground/50">
<span className="text-muted-foreground/70">Shortcuts:</span>{" "}
<span className="text-cyan-500/50">Ctrl+C</span> cancel{" "}
<span className="text-cyan-500/50">Ctrl+U</span> clear{" "}
<span className="text-cyan-500/50">Ctrl+A/E</span> start/end
<div className="mt-6 text-xs text-zinc-600">
<span className="text-zinc-500">{t.shortcuts}:</span>{" "}
<span className="text-cyan-600">Enter</span> {t.submit}{" "}
<span className="text-cyan-600">Ctrl+C</span> {t.cancel}{" "}
<span className="text-cyan-600">Ctrl+U</span> {t.clear}{" "}
<span className="text-cyan-600">Ctrl+A/E</span> {t.startEnd}
</div>
)}
</div>

View File

@@ -546,7 +546,12 @@
"accessGranted": "Access granted.",
"welcomeMessage": "Welcome back, commander.",
"authFailed": "ERROR: Authentication failed.",
"invalidCredentials": "Invalid credentials. Please try again."
"invalidCredentials": "Invalid credentials. Please try again.",
"shortcuts": "Shortcuts",
"submit": "submit",
"cancel": "cancel",
"clear": "clear",
"startEnd": "start/end"
},
"changePassword": {
"title": "Change Password",

View File

@@ -560,7 +560,12 @@
"accessGranted": "认证成功。",
"welcomeMessage": "欢迎回来,指挥官。",
"authFailed": "错误:认证失败。",
"invalidCredentials": "凭据无效,请重试。"
"invalidCredentials": "凭据无效,请重试。",
"shortcuts": "快捷键",
"submit": "提交",
"cancel": "取消",
"clear": "清空",
"startEnd": "行首/行尾"
},
"changePassword": {
"title": "修改密码",