Elffuss BraidHub

kikocis/continue public

972ea8cfaef0 · 1.6 KiBRawPermalink
1import styled from "styled-components";
2import { useAppDispatch } from "../../../../redux/hooks";
3import {
4 callCurrentTool,
5 cancelCurrentToolCall,
6} from "../../../../redux/thunks";
7import {
8 getAltKeyLabel,
9 getFontSize,
10 getMetaKeyLabel,
11 isJetBrains,
12} from "../../../../util";
13import { EnterButton } from "../../InputToolbar/EnterButton";
14
15const Container = styled.div`
16 display: flex;
17 justify-content: space-between;
18 align-items: center;
19 width: 100%;
20`;
21
22const StopButton = styled.div`
23 font-size: ${getFontSize() - 3}px;
24 padding: 2px;
25 padding-right: 4px;
26 cursor: pointer;
27`;
28
29export function PendingToolCallToolbar() {
30 const dispatch = useAppDispatch();
31 const jetbrains = isJetBrains();
32
33 return (
34 <Container>
35 <div className="text-description flex flex-row items-center pb-0.5 pr-1 text-xs">
36 <span className="hidden sm:flex">Pending tool call</span>
37 </div>
38
39 <div className="flex gap-2 pb-0.5">
40 <StopButton
41 className="text-description"
42 onClick={() => dispatch(cancelCurrentToolCall())}
43 data-testid="reject-tool-call-button"
44 >
45 {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
46 {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
47 </StopButton>
48 <EnterButton
49 isPrimary={true}
50 className="text-description"
51 onClick={() => dispatch(callCurrentTool())}
52 data-testid="accept-tool-call-button"
53 >
54 {getMetaKeyLabel()} ⏎ Continue
55 </EnterButton>
56 </div>
57 </Container>
58 );
59}