/** * Comment detail slide-over panel. * * Shows full comment body, author details, moderation metadata, * and status change buttons. */ import { Badge, Button } from "@cloudflare/kumo"; import { X, Check, Trash, Warning, UserCircle, EnvelopeSimple } from "@phosphor-icons/react"; import * as React from "react"; import type { AdminComment, CommentStatus } from "../../lib/api/comments.js"; import { cn } from "../../lib/utils.js"; export interface CommentDetailProps { comment: AdminComment; onClose: () => void; onStatusChange: (id: string, status: CommentStatus) => void; onDelete: (id: string) => void; isAdmin: boolean; isStatusPending: boolean; } export function CommentDetail({ comment, onClose, onStatusChange, onDelete, isAdmin, isStatusPending, }: CommentDetailProps) { // Close on Escape React.useEffect(() => { const handler = (e: KeyboardEvent) => { if (e.key === "Escape" && !e.defaultPrevented) { e.preventDefault(); onClose(); } }; document.addEventListener("keydown", handler); return () => document.removeEventListener("keydown", handler); }, [onClose]); const date = new Date(comment.createdAt); return ( <> {/* Backdrop */}
{/* Panel */}{comment.body}
Collection:{" "} {comment.collection}
Content ID:{" "}
{comment.contentId}
Reply to:{" "}
{comment.parentId}
{JSON.stringify(comment.moderationMetadata, null, 2)}