# Code coverage report for src/components/features/python-runner/TerminalHeader.tsx

# All files / src/components/features/python-runner TerminalHeader.tsx

100% Statements 46/46
100% Branches 12/12
100% Functions 1/1
100% Lines 46/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    471x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    21x
    21x
    21x
    21x
    21x
    21x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
    77x
     import { Play, CircleNotch, Terminal as TerminalIcon } from '@phosphor-icons/react'
    import { Button } from '@/components/ui/button'

    interface TerminalHeaderProps {
      onRun: () => void
      isRunning: boolean
      isInitializing: boolean
      waitingForInput: boolean
    }

    export function TerminalHeader({
      onRun,
      isRunning,
      isInitializing,
      waitingForInput
    }: TerminalHeaderProps) {
      return (
        <div className="flex items-center justify-between p-4 border-b border-border bg-muted/30" data-testid="terminal-header">
          <div className="flex items-center gap-2">
            <TerminalIcon size={18} weight="bold" className="text-primary" aria-hidden="true" />
            <h3 className="text-sm font-semibold text-foreground">Python Terminal</h3>
          </div>
          <Button
            onClick={onRun}
            disabled={isRunning || isInitializing || waitingForInput}
            size="sm"
            className="gap-2"
            data-testid="run-python-btn"
            aria-label={isRunning ? 'Running code' : isInitializing ? 'Loading terminal' : 'Run Python code'}
            aria-busy={isRunning || isInitializing}
          >
            {isRunning || isInitializing ? (
              <>
                <CircleNotch className="animate-spin" size={16} aria-hidden="true" />
                {isInitializing ? 'Loading...' : 'Running...'}
              </>
            ) : (
              <>
                <Play size={16} weight="fill" aria-hidden="true" />
                Run
              </>
            )}
          </Button>
        </div>
      )
    }