'use client'; import { useState } from 'react'; import type { ExecutionResult } from '@/types'; interface Props { result: ExecutionResult | null; isLoading: boolean; } export default function OutputPanel({ result, isLoading }: Props) { const [collapsed, setCollapsed] = useState(false); if (!isLoading && !result) return null; const hasError = result?.error || (result?.stderr && result.stderr.trim()); const hasOutput = result?.stdout && result.stdout.trim(); return (
{result.error}
)}
{result?.timedOut && !result.error && (
Execution timed out after 15 seconds.
)} {hasOutput && ({result!.stdout}
)}
{hasError && !result?.error && (
{result!.stderr}
)}
{result && !isLoading && !result.error && !hasOutput && !hasError && (
No output
)}