feat(webui): restyle login page with Apple-style vibrancy

- Frosted "vibrancy" card (bg-card/65 + backdrop-blur-2xl) floating over the
  wavy background, with a centered brand focal point (logo tile, name,
  version, subtitle).
- Larger rounded fields/button (h-12, rounded-xl) for a calmer iOS feel.
- The "我觉得这个界面很卡怎么办?" help line becomes a 灵动岛-style frosted
  capsule (rounded-full, blur, float, spring on hover/tap).
- New entrance/hover motion gated on reduceMotion/disableMotion.
This commit is contained in:
DrSmoothl committed 2026-06-14 00:47:56 +08:00
1 parent dc26cc93ba
commit df0b79a87d
1 file changed
+39 -35
@@ -35,6 +35,7 @@ function readLoginFx(): boolean {
export function LoginPage({ onLogin }: LoginPageProps) {
const { appearance } = useTheme();
const customBg = appearance.background.type !== 'none';
const reduce = appearance.reduceMotion || appearance.disableMotion;
// The login page must never carry operator custom CSS. applyAppearance gates
// it on a token, but an in-session logout / 401 expiry won't re-run it, so
@@ -71,12 +72,12 @@ export function LoginPage({ onLogin }: LoginPageProps) {
{/* Animated wavy-line background (device-local toggle) */}
{fxOn && <LoginWaves />}
{/* Sky gradient backdrop — also softens the waves so the card stands out */}
{/* Soft glow backdrop — also helps the frosted card read against the waves */}
<div
className="pointer-events-none absolute inset-0"
style={{
background:
'radial-gradient(80% 60% at 50% 0%, color-mix(in oklab, var(--primary) 18%, transparent) 0%, transparent 70%)',
'radial-gradient(75% 55% at 50% 0%, color-mix(in oklab, var(--primary) 20%, transparent) 0%, transparent 68%)',
}}
/>
@@ -85,46 +86,48 @@ export function LoginPage({ onLogin }: LoginPageProps) {
</div>
<motion.div
initial={{ opacity: 0, y: 16, scale: 0.98 }}
initial={reduce ? false : { opacity: 0, y: 16, scale: 0.98 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
transition={{ duration: 0.45, ease: [0.16, 1, 0.3, 1] }}
className="relative z-10 w-full max-w-md"
transition={reduce ? { duration: 0 } : { duration: 0.45, ease: [0.16, 1, 0.3, 1] }}
className="relative z-10 flex w-full max-w-md flex-col items-center"
>
<Card className="border-primary/15 shadow-xl backdrop-blur-sm supports-[backdrop-filter]:bg-card/95">
<CardContent className="p-7 sm:p-9">
<div className="flex items-center gap-3">
<div className="flex size-12 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/20">
<img src="/logo.png" alt="SnowLuma" className="size-9 object-contain" />
{/* Frosted "vibrancy" card */}
<Card className="w-full overflow-hidden border-border/50 bg-card/75 shadow-2xl shadow-primary/5 backdrop-blur-2xl supports-[backdrop-filter]:bg-card/65">
<CardContent className="px-7 py-9 sm:px-10">
{/* Centered brand focal point */}
<div className="flex flex-col items-center gap-3 text-center">
<div className="flex size-14 items-center justify-center rounded-2xl bg-primary/10 shadow-sm ring-1 ring-primary/20">
<img src="/logo.png" alt="SnowLuma" className="size-10 object-contain" />
</div>
<div>
<div className="flex items-baseline gap-2">
<span className="text-xl font-bold tracking-tight">{APP_NAME}</span>
<span className="text-[11px] text-muted-foreground tabular-nums">v{APP_VERSION}</span>
<div className="flex items-center justify-center gap-2">
<span className="text-2xl font-semibold tracking-tight">{APP_NAME}</span>
<span className="rounded-full bg-primary/10 px-1.5 py-0.5 font-mono text-[10px] text-primary tabular-nums">v{APP_VERSION}</span>
</div>
<p className="text-xs text-muted-foreground">OneBot v11 协议网关 · 安全登录</p>
<p className="mt-1 text-xs text-muted-foreground">OneBot v11 协议网关 · 安全登录</p>
</div>
</div>
<form onSubmit={handleSubmit} className="mt-7 flex flex-col gap-4">
<form onSubmit={handleSubmit} className="mt-8 flex flex-col gap-3.5">
<motion.div
key={shake}
animate={shake > 0 ? { x: [0, -8, 8, -6, 6, -3, 3, 0] } : {}}
transition={{ duration: 0.4 }}
className="relative"
>
<KeyRound className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
<KeyRound className="pointer-events-none absolute left-3.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
<Input
type={showPwd ? 'text' : 'password'}
placeholder="输入访问令牌"
value={password}
onChange={(e) => setPassword(e.target.value)}
autoFocus
className="h-11 pl-9 pr-10 text-sm"
className="h-12 rounded-xl bg-background/40 pl-10 pr-11 text-sm"
/>
<button
type="button"
onClick={() => setShowPwd((v) => !v)}
className="absolute right-2 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer"
className="absolute right-2 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"
tabIndex={-1}
aria-label={showPwd ? '隐藏密码' : '显示密码'}
>
@@ -134,15 +137,15 @@ export function LoginPage({ onLogin }: LoginPageProps) {
{error && (
<motion.p
initial={{ opacity: 0, y: -4 }}
initial={reduce ? false : { opacity: 0, y: -4 }}
animate={{ opacity: 1, y: 0 }}
className="rounded-md bg-destructive/10 px-3 py-2 text-center text-xs text-destructive"
className="rounded-lg bg-destructive/10 px-3 py-2 text-center text-xs text-destructive"
>
{error}
</motion.p>
)}
<Button type="submit" disabled={loading || !password} className="h-11">
<Button type="submit" disabled={loading || !password} className="h-12 rounded-xl text-[15px]">
{loading ? '验证中…' : (
<>
进入控制台 <ArrowRight className="size-4" />
@@ -151,27 +154,28 @@ export function LoginPage({ onLogin }: LoginPageProps) {
</Button>
</form>
<p className="mt-6 text-center text-[11px] text-muted-foreground">
<p className="mt-7 text-center text-[11px] text-muted-foreground">
© {new Date().getFullYear()} SnowLuma. All rights reserved.
</p>
</CardContent>
</Card>
{/* Perf escape hatch for the animated background */}
<div className="mt-4 text-center">
<button
type="button"
onClick={() => setHelpOpen(true)}
className="inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] text-muted-foreground transition-colors hover:text-foreground cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40"
>
<Sparkles className="size-3.5" />
我觉得这个界面很卡怎么办?
</button>
</div>
{/* 灵动岛-style frosted capsule: perf escape hatch for the background */}
<motion.button
type="button"
onClick={() => setHelpOpen(true)}
whileHover={reduce ? undefined : { scale: 1.04 }}
whileTap={reduce ? undefined : { scale: 0.97 }}
transition={{ type: 'spring', stiffness: 420, damping: 26 }}
className="mt-5 inline-flex items-center gap-2 rounded-full border border-border/50 bg-background/45 px-4 py-2 text-[12px] font-medium text-muted-foreground shadow-lg shadow-black/5 backdrop-blur-xl transition-colors hover:text-foreground supports-[backdrop-filter]:bg-background/35 cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40"
>
<Sparkles className="size-3.5 text-primary" />
我觉得这个界面很卡怎么办?
</motion.button>
</motion.div>
<Dialog open={helpOpen} onOpenChange={setHelpOpen}>
<DialogContent className="max-w-sm">
<DialogContent className="max-w-sm rounded-2xl">
<DialogHeader>
<DialogTitle>界面有点卡顿?</DialogTitle>
<DialogDescription>
@@ -179,7 +183,7 @@ export function LoginPage({ onLogin }: LoginPageProps) {
</DialogDescription>
</DialogHeader>
<div className="flex items-center justify-between gap-4 rounded-lg border bg-muted/20 px-4 py-3">
<div className="flex items-center justify-between gap-4 rounded-xl border bg-muted/30 px-4 py-3">
<div className="min-w-0">
<p className="text-sm font-medium">登录页动态背景</p>
<p className="mt-0.5 text-[11px] text-muted-foreground">{fxOn ? '已开启 · 关闭后背景为静态' : '已关闭 · 背景为静态'}</p>