import InputError from '@/components/input-error'; import LoadingButton from '@/components/loading-button'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { onHandleChange } from '@/lib/inertia'; import { useForm, usePage } from '@inertiajs/react'; import { SquarePen } from 'lucide-react'; import { useState } from 'react'; import { Editor } from 'richtor'; import 'richtor/styles'; const ForumEdit = ({ url, forum }: { url: string; forum: CourseForum }) => { const [open, setOpen] = useState(false); const { props } = usePage(); const { translate } = props as any; const { button, input, frontend } = translate; const { data, setData, put, errors, processing, reset } = useForm({ url, title: forum.title, description: forum.description, }); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); put(route('course-forums.update', forum.id), { onSuccess: () => { reset(); setOpen(false); }, }); }; return ( {frontend.edit_forum_question}
onHandleChange(e, setData)} />
setData('description', value as string)} />
{button.update}
); }; export default ForumEdit;