"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { motion } from "framer-motion"; import { useTranslation } from "react-i18next"; import { ShieldAlert, LogOut, MessageSquare, Send, Loader2 } from "lucide-react"; import toast, { Toaster } from "react-hot-toast"; import AuthService from "../services/AuthService"; import { sendGeneralReport } from "../utils/api"; import InteractiveBackground from "../components/Animation/Background"; export default function BlockedPage() { const { t } = useTranslation(); const router = useRouter(); const [form, setForm] = useState({ subject: "", body: "" }); const [isSubmitting, setIsSubmitting] = useState(false); const [isSent, setIsSent] = useState(false); const handleLogout = () => { AuthService.deleteToken(); router.replace("/"); }; const updateField = (field, value) => { setForm((current) => ({ ...current, [field]: value })); if (isSent) setIsSent(false); }; const handleSubmit = async (event) => { event.preventDefault(); if (!form.subject.trim() || !form.body.trim()) { toast.error(t("blocked.fillAllFields")); return; } setIsSubmitting(true); try { await sendGeneralReport(form.subject.trim(), form.body.trim()); setIsSent(true); setForm({ subject: "", body: "" }); toast.success(t("blocked.reportSent")); } catch (error) { toast.error(t("blocked.sendError")); } finally { setIsSubmitting(false); } }; return (

{t("blocked.title")}

{t("blocked.description")}

{t("blocked.logoutTitle")}

{t("blocked.logoutDesc")}

{t("blocked.contactSupportTitle")}

{t("blocked.contactSupportDesc")}

updateField("subject", event.target.value)} placeholder={t("blocked.subjectPlaceholder")} className="w-full px-4 py-3 bg-white border border-gray-200 rounded-2xl focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent text-gray-900 placeholder-gray-400" />