"use client"; import { IconInfoCircle, IconMarkdown } from "@tabler/icons-react"; import { useState, useTransition } from "react"; import { Button } from "@/components/ui/button"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Spinner } from "@/components/ui/spinner"; import { Textarea } from "@/components/ui/textarea"; import { toast } from "@/components/ui/toast"; import type { CommentUser } from "@/lib/data/comments"; import { createComment, updateComment } from "@/lib/server/comments"; import { CommentAvatar } from "./comment-avatar"; // Local form state shared by the create/reply/edit forms const useCommentFormState = (initialContent: string = "") => { const [content, setContent] = useState(initialContent); const [isPending, startTransition] = useTransition(); return { content, setContent, isPending, startTransition }; }; // Shared textarea component const CommentTextarea = ({ content, setContent, isPending, placeholder, ariaLabel, }: { content: string; setContent: (value: string) => void; isPending: boolean; placeholder: string; ariaLabel: string; }) => (