import { useState } from 'react'; import { motion } from 'motion/react'; import { ArrowRight, Eye, EyeOff, KeyRound } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { ThemeToggle } from '@/components/theme-toggle'; import { useTheme } from '@/contexts/ThemeContext'; import { cn } from '@/lib/utils'; import { APP_NAME, APP_VERSION } from '@/types'; interface LoginPageProps { onLogin: (password: string) => Promise<{ success: boolean; error?: string }>; } export function LoginPage({ onLogin }: LoginPageProps) { const { appearance } = useTheme(); const customBg = appearance.background.type !== 'none'; const [password, setPassword] = useState(''); const [showPwd, setShowPwd] = useState(false); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const [shake, setShake] = useState(0); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); const result = await onLogin(password); setLoading(false); if (!result.success) { setError(result.error || '登录失败'); setShake((k) => k + 1); } }; return (
{/* Sky gradient backdrop */}
SnowLuma
{APP_NAME} v{APP_VERSION}

OneBot v11 协议网关 · 安全登录

0 ? { x: [0, -8, 8, -6, 6, -3, 3, 0] } : {}} transition={{ duration: 0.4 }} className="relative" > setPassword(e.target.value)} autoFocus className="h-11 pl-9 pr-10 text-sm" /> {error && ( {error} )}

© {new Date().getFullYear()} SnowLuma. All rights reserved.

); }