import type { CommentItem } from "@/lib/comment-model"; import { relativeTime } from "@/lib/feed-model"; export interface CommentsPanelProps { comments: CommentItem[]; loading?: boolean; /** Error text naming the action that failed. The list stays shown. */ error?: string | null; value: string; busy?: boolean; onChange?: (v: string) => void; onSubmit?: () => void; onRetry?: () => void; now?: number; } export function CommentsPanel(p: CommentsPanelProps) { const empty = !p.value.trim(); return (
{p.loading ? : null} {!p.loading && p.comments.length === 0 && !p.error ? (

No comments yet.

) : null} {p.error ? (

{p.error}{" "} {p.onRetry ? : null}

) : null}
{ e.preventDefault(); if (!empty && !p.busy) p.onSubmit?.(); }} > p.onChange?.(e.target.value)} />
); }