"use client"; import { useState } from "react"; import { createPortal } from "react-dom"; import { AlertTriangle, X } from "lucide-react"; type IssueDetailsSummaryProps = { label: string; message?: string; notes?: string[]; description?: string; }; export default function IssueDetailsSummary({ label, message, notes, description = "Issue details returned by the current operation.", }: IssueDetailsSummaryProps) { const [detailOpen, setDetailOpen] = useState(false); const issueNotes = (notes?.length ? notes : message ? [message] : []).filter( Boolean, ); const issueCount = issueNotes.length || 1; return ( <> {detailOpen && typeof document !== "undefined" ? createPortal(
{label} Issues

{description}

{issueNotes.map((note, index) => (
{note}
))}
, document.body, ) : null} ); }