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

0% Statements 0/46
0% Branches 0/1
0% Functions 0/1
0% Lines 0/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
    47

     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>
      )
    }