blob: b51dd3073a950a988578291368773adedc911d4c (
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
54
55
56
57
58
59
60
|
import React from "react";
import { lightGray, vscBackground } from ".";
import styled from "styled-components";
import { ChatBubbleOvalLeftIcon } from "@heroicons/react/24/outline";
import { getFontSize } from "../util";
const CollapseButton = styled.div`
background-color: ${vscBackground};
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
flex-grow: 0;
margin-left: 13px;
cursor: pointer;
`;
const CollapsedDiv = styled.div<{ fontSize?: number }>`
margin-top: 8px;
margin-bottom: 8px;
margin-left: 8px;
display: flex;
align-items: center;
gap: 4px;
font-size: ${(props) => props.fontSize || getFontSize()}px;
min-height: 16px;
`;
interface TimelineItemProps {
historyNode: any;
open: boolean;
onToggle: () => void;
children: any;
iconElement?: any;
}
function TimelineItem(props: TimelineItemProps) {
return props.open ? (
props.children
) : (
<CollapsedDiv fontSize={getFontSize()}>
<CollapseButton
onClick={() => {
props.onToggle();
}}
>
{props.iconElement || (
<ChatBubbleOvalLeftIcon width="16px" height="16px" />
)}
</CollapseButton>
<span style={{ color: lightGray }}>
{props.historyNode.observation?.error
? props.historyNode.observation?.title
: props.historyNode.step.name}
</span>
</CollapsedDiv>
);
}
export default TimelineItem;
|