diff --git a/src/pages/forms/[id].tsx b/src/pages/forms/[id].tsx index 283abdb..af10eab 100644 --- a/src/pages/forms/[id].tsx +++ b/src/pages/forms/[id].tsx @@ -61,6 +61,19 @@ export default function FormDetailPage() { : 'bg-red-100 text-red-800'; const camelCaseTitle = form.name.charAt(0).toUpperCase() + form.name.slice(1, form.name.length); + + const toggleFormStatus = async () => { + const { data, error } = await supabase + .from('forms') + .update({ is_open: !form.is_open }) + .eq('id', form.id); + if (error) { + console.error('Error updating form status:', error); + } else { + setForm({ ...form, is_open: !form.is_open }); + } + }; + return (
@@ -78,11 +91,20 @@ export default function FormDetailPage() {
- - - + + + + + {form.created_at && (

@@ -151,4 +173,4 @@ function respectNewLines(text: string | null | undefined) {
)); -} +} \ No newline at end of file