Elffuss BraidHub

kikocis/continue public

81ce8cce6ac5 · 1.4 KiBRawPermalink
1import { useContext } from "react";
2import { IdeMessengerContext } from "../../../../context/IdeMessenger";
3import { useAppDispatch } from "../../../../redux/hooks";
4import { cancelStream } from "../../../../redux/thunks/cancelStream";
5import { getAltKeyLabel, getMetaKeyLabel } from "../../../../util";
6import { Container, StopButton } from "./components";
7import { GeneratingIndicator } from "./GeneratingIndicator";
8
9export const IsApplyingToolbar = () => {
10 const ideMessenger = useContext(IdeMessengerContext);
11 const dispatch = useAppDispatch();
12 const jetbrains = window.location.protocol === "jb-api:";
13
14 return (
15 <Container>
16 <GeneratingIndicator text="Applying" testId={"notch-applying-text"} />
17 <StopButton
18 data-testid="notch-applying-cancel-button"
19 className="text-description"
20 onClick={() => {
21 // Note that this will NOT stop generation but once apply is cancelled will show the Generating/cancel option
22 // Apply is prioritized because it can be more catastrophic
23 // Intentional to be more WYSIWYG for now
24 // Keyboard shortcut is handled in chat
25 void dispatch(cancelStream());
26 ideMessenger.post("rejectDiff", {});
27 }}
28 >
29 {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
30 {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
31 </StopButton>
32 </Container>
33 );
34};