Elffuss BraidHub

kikocis/continue public

7a512fed920f · 1.4 KiBRawPermalink
1import { ChatBubbleOvalLeftIcon } from "@heroicons/react/24/outline";
2import { ChatHistoryItem } from "core";
3import styled from "styled-components";
4import { lightGray, vscBackground } from "..";
5import { getFontSize } from "../../util";
6
7const CollapseButton = styled.div`
8 background-color: ${vscBackground};
9 display: flex;
10 justify-content: center;
11 align-items: center;
12 flex-shrink: 0;
13 flex-grow: 0;
14 margin-left: 13px;
15 cursor: pointer;
16`;
17
18const CollapsedDiv = styled.div<{ fontSize?: number }>`
19 margin-top: 8px;
20 margin-bottom: 8px;
21 margin-left: 8px;
22 display: flex;
23 align-items: center;
24 gap: 4px;
25 font-size: ${(props) => props.fontSize || getFontSize()}px;
26 min-height: 16px;
27`;
28
29interface TimelineItemProps {
30 item: ChatHistoryItem;
31 open: boolean;
32 onToggle: () => void;
33 children: JSX.Element;
34 iconElement?: JSX.Element;
35}
36
37function TimelineItem(props: TimelineItemProps) {
38 return props.open ? (
39 props.children
40 ) : (
41 <CollapsedDiv fontSize={getFontSize()}>
42 <CollapseButton
43 onClick={() => {
44 props.onToggle();
45 }}
46 >
47 {props.iconElement || (
48 <ChatBubbleOvalLeftIcon width="16px" height="16px" />
49 )}
50 </CollapseButton>
51 <span style={{ color: lightGray }}>
52 {props.item.message.role} Message
53 {/* {props.step.error ? props.step.error.title : props.step.name} */}
54 </span>
55 </CollapsedDiv>
56 );
57}
58
59export default TimelineItem;