"use client"; import * as React from "react"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { motion, AnimatePresence } from "framer-motion"; import { adminLoginAction } from "@/app/actions"; import Link from "next/link"; const expo = [0.16, 1, 0.3, 1] as [number, number, number, number]; interface Props { params: Promise<{ lang: string }>; } export default function AdminLoginPage({ params }: Props) { const router = useRouter(); // Unpack params Promise natively using React 19 use() hook const { lang } = React.use(params); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!username.trim() || !password.trim()) { setError("Kullanıcı adı ve şifre zorunludur!"); return; } setLoading(true); setError(null); const res = await adminLoginAction({ username: username.trim(), password: password.trim() }); if (res.success) { router.push(`/${lang}/admin`); } else { setError(res.error || "Giriş başarısız!"); setLoading(false); } }; return (
{/* Dynamic Background Pattern */}
{/* Decorative Floating Block */}
{/* Back to Home Link */}
ANA SAYFAYA DÖN
{/* Accent Ribbon */}
{/* Logo Monogram */}
AYR

YÖNETİCİ GİRİŞİ

AYRİS TECH YÖNETİM MERKEZİ

{/* Error Message */} {error && (
{error} )} {/* Username Input */}
setUsername(e.target.value)} disabled={loading} className="w-full font-mono text-xs bg-[#EDE8E0] border border-[#C8C2B8] hover:border-[#0A0A0A] focus:border-[#0A0A0A] focus:bg-[#EDE8E0] outline-none px-4 py-3.5 text-[#0A0A0A] transition-all" placeholder="Örn: admin" />
{/* Password Input */}
setPassword(e.target.value)} disabled={loading} className="w-full font-mono text-xs bg-[#EDE8E0] border border-[#C8C2B8] hover:border-[#0A0A0A] focus:border-[#0A0A0A] focus:bg-[#EDE8E0] outline-none px-4 py-3.5 text-[#0A0A0A] transition-all" placeholder="••••••••" />
{/* Submit Button */} {/* Decorative Security Footer */}
SECURE SHELL v2.4 ● ONLINE
); }