import React, { useState } from "react"; import { marked } from "marked"; import type { CommentData } from "../../types/comments"; interface CommentFormProps { onAdd: (comment: CommentData) => void; } const CommentForm: React.FC = ({ onAdd }) => { const [text, setText] = useState(""); const [markdownEnabled, setMarkdownEnabled] = useState(false); const [preview, setPreview] = useState(false); function handleSubmit() { if (!text.trim()) return; const newComment: CommentData = { user_name: "User", comment_text: text, created_at: new Date().toISOString(), markdown_enabled: markdownEnabled, }; onAdd(newComment); setText(""); setPreview(false); } return (