'use client'; import { useState } from 'react'; type CommentInputProps = { placeholder?: string; submitLabel?: string; onSubmit: (content: string) => Promise; onCancel?: () => void; }; export function CommentInput({ placeholder = '写下你的评论…', submitLabel = '发布', onSubmit, onCancel, }: CommentInputProps) { const [content, setContent] = useState(''); const [busy, setBusy] = useState(false); const handleSubmit = async () => { const trimmed = content.trim(); if (!trimmed || busy) return; setBusy(true); try { await onSubmit(trimmed); setContent(''); onCancel?.(); } finally { setBusy(false); } }; return (