All files / src/components/DebugHeader DebugHeader.jsx

81.48% Statements 88/108
100% Branches 4/4
18.18% Functions 2/11
81.48% Lines 88/108

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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 1091x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 9x 9x 9x 9x 9x         9x 9x 9x 9x 9x 9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x     9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x 1x 1x  
import React, { useContext } from "react";
import {
  FaArrowLeft,
  FaArrowRight,
  FaForward,
  FaSquare,
} from "react-icons/fa6";
import { IoReload } from "react-icons/io5";
import { MdSkipNext, MdSkipPrevious } from "react-icons/md";
import { BsArrowRightSquareFill } from "react-icons/bs";
import { DataState } from "../../context/DataContext";
 
import "./DebugHeader.css";
 
const DebugHeader = () => {
  const {
    refresh,
    setRefresh,
    setTerminalOutput,
    setCommandPress,
    commandPress,
  } = DataState();
 
  const handleRun = (command) => {
    console.log("clicked");
    setCommandPress(!commandPress);
    setTerminalOutput(command);
  };
 
  return (
    <div className="parent-debug-header">
      <div className="debug-header">
        <div className="icons">
          <div className="arrow">
            <FaArrowLeft
              className="icon"
              title="Previous"
              onClick={() => {
                handleRun("previous");
              }}
            />
            <FaArrowRight
              className="icon"
              title="Next"
              onClick={() => {
                handleRun("next");
              }}
            />
          </div>
          <div className="others">
            <IoReload
              className="icon"
              title="Run"
              onClick={() => {
                handleRun("run");
              }}
            />
            <FaForward
              className="icon"
              title="Continue"
              onClick={() => {
                handleRun("continue");
              }}
            />
            <FaSquare
              className="icon"
              title="Stop"
              onClick={() => {
                handleRun("stop");
              }}
            />
            <MdSkipNext
              className="icon"
              title="Step"
              onClick={() => {
                handleRun("step");
              }}
            />
            <MdSkipPrevious
              className="icon"
              title="Finish"
              onClick={() => {
                handleRun("finish");
              }}
            />
            <BsArrowRightSquareFill
              className="icon"
              title="Run"
              onClick={() => {
                handleRun("step-out");
              }}
            />
          </div>
        </div>
        <div className="filename">
          <div className="filename-content">filename</div>
        </div>
        <div className="save">
          <button className="save-button" onClick={() => setRefresh(!refresh)}>
            {refresh ? "Saving.." : "Save"}
          </button>
        </div>
      </div>
    </div>
  );
};
 
export default DebugHeader;