summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/ErrorStepContainer.tsx
blob: 07c0a0461ce1d7d650758ab85376626eff071646 (plain)
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
import React from "react";
import styled from "styled-components";
import { HistoryNode } from "../../../schema/HistoryNode";
import { defaultBorderRadius, vscBackground } from ".";
import HeaderButtonWithText from "./HeaderButtonWithText";
import {
  MinusCircleIcon,
  MinusIcon,
  XMarkIcon,
} from "@heroicons/react/24/outline";

const Div = styled.div`
  padding: 8px;
  background-color: #ff000011;
  border-radius: ${defaultBorderRadius};
  border: 1px solid #cc0000;
  margin: 8px;
`;

interface ErrorStepContainerProps {
  historyNode: HistoryNode;
  onClose: () => void;
  onDelete: () => void;
}

function ErrorStepContainer(props: ErrorStepContainerProps) {
  return (
    <div style={{ backgroundColor: vscBackground, position: "relative" }}>
      <div
        style={{
          position: "absolute",
          right: "12px",
          top: "12px",
          display: "flex",
        }}
      >
        <HeaderButtonWithText text="Collapse" onClick={() => props.onClose()}>
          <MinusCircleIcon width="1.3em" height="1.3em" />
        </HeaderButtonWithText>
        <HeaderButtonWithText text="Collapse" onClick={() => props.onDelete()}>
          <XMarkIcon width="1.3em" height="1.3em" />
        </HeaderButtonWithText>
      </div>
      <Div>
        <pre style={{ whiteSpace: "pre-wrap", wordWrap: "break-word" }}>
          {props.historyNode.observation?.error as string}
        </pre>
      </Div>
    </div>
  );
}

export default ErrorStepContainer;