"use client"; import { Box, Button, Group, Paper, SimpleGrid, Stack, Text, Textarea, TextInput, Title, } from "@mantine/core"; import { notifications } from "@mantine/notifications"; import { IconBrandGmail, IconLocation } from "@tabler/icons-react"; import Image from "next/image"; import { useState } from "react"; export default function SupportCenter() { const [data, setData] = useState({ email: "", title: "", description: "", }); const [isLoading, setLoading] = useState(false); const handleSubmit = async () => { if (!data.email || !data.title || !data.description) { return notifications.show({ title: "Error", color: "red", message: "Please fill in all fields.", }); } try { setLoading(true); const response = await fetch("/api/helper/support-center", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(data), }); const result = await response.json(); if (result.success) { notifications.show({ title: "Success", color: "green", message: "Message sent successfully.", }); setData({ email: "", title: "", description: "", }); } if (!result.success) { notifications.show({ title: "Error", color: "red", message: result.error || "Failed to send message.", }); } } catch (error) { console.log(error); } finally { setLoading(false); } }; return ( logo Support Center Send us a message and we'll get back to you as soon as possible. Contact Information For general inquiries, please contact us ! Email bip.baliinteraktifperkasa@gmail.com Location Bali, Indonesia Send a Message { setData({ ...data, email: e.target.value, }); }} /> { setData({ ...data, title: e.target.value, }); }} />