"use client"; import { useState } from "react"; import type { ICompilerService } from "../structures/ICompilerService"; export function DiagnosticsPanel({ diagnostics, }: { diagnostics: ICompilerService.IDiagnostic[]; }) { const [expanded, setExpanded] = useState(false); const errorCount = diagnostics.filter((d) => d.severity === "error").length; const warnCount = diagnostics.filter((d) => d.severity === "warning").length; if (diagnostics.length === 0) return (
0 errors · 0 warnings
); return (
{expanded && (
{diagnostics.map((d, i) => (
{d.severity === "error" ? "✗" : "!"} {d.line}:{d.column} {d.code ?? ""} {d.message}
))}
)}
); }