import React from "react"; import { useTerminalStore } from "../store/useTerminalStore"; import { MdClose, MdClearAll } from "react-icons/md"; import { FiTerminal } from "react-icons/fi"; export const TerminalOutput: React.FC = () => { const { jobs, isOpen, activeJobId, closeTerminal, setActiveJob, clearJobs, removeJob, } = useTerminalStore(); if (!isOpen) return null; const activeJob = jobs.find((j) => j.id === activeJobId) || jobs[jobs.length - 1]; return (
{/* Terminal header */}
TERMINAL {jobs.length > 0 && ( {jobs.length} )}
{jobs.length > 0 && ( )}
{/* Job tabs */} {jobs.length > 1 && (
{jobs.map((job) => ( ))}
)} {/* Terminal output */}
{activeJob ? ( <> {/* Command header */}
$ {activeJob.command.join(" ")}
{/* Stdin if provided */} {activeJob.stdin && (
stdin:
                  {activeJob.stdin}
                
)} {/* Stdout */} {activeJob.stdout && (
                {activeJob.stdout}
              
)} {/* Stderr */} {activeJob.stderr && (
                {activeJob.stderr}
              
)} {/* Status */} {activeJob.isRunning ? (
⏳ Running...
) : activeJob.status !== null ? (
{activeJob.status === 0 ? "✓ Process exited with code 0" : `✗ Process exited with code ${activeJob.status}`}
) : null} ) : (
No active jobs
)}
); };