"use client"; import React, { useState } from "react"; import { useTranslation } from "@/lib/i18n"; export default function NoteForm({ projectId }) { const { t } = useTranslation(); const [note, setNote] = useState(""); const [status, setStatus] = useState(null); async function handleSubmit(e) { e.preventDefault(); const res = await fetch("/api/notes", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ project_id: projectId, note }), }); if (res.ok) { setNote(""); setStatus(t("common.addNoteSuccess")); window.location.reload(); } else { setStatus(t("common.addNoteError")); } } return (