Elffuss BraidHub

kikocis/continue public

3ff29c567dd0 · 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 { GeneratingIndicator } from "./GeneratingIndicator";
7
8export const IsApplyingToolbar = () => {
9 const ideMessenger = useContext(IdeMessengerContext);
10 const dispatch = useAppDispatch();
11 const jetbrains = window.location.protocol === "jb-api:";
12
13 return (
14 <div className="flex w-full items-center justify-between">
15 <GeneratingIndicator text="Applying" testId={"notch-applying-text"} />
16 <div
17 data-testid="notch-applying-cancel-button"
18 className="text-description text-2xs cursor-pointer p-0.5 pr-1 hover:brightness-125"
19 onClick={() => {
20 // Note that this will NOT stop generation but once apply is cancelled will show the Generating/cancel option
21 // Apply is prioritized because it can be more catastrophic
22 // Intentional to be more WYSIWYG for now
23 // Keyboard shortcut is handled in chat
24 void dispatch(cancelStream());
25 ideMessenger.post("rejectDiff", {});
26 }}
27 >
28 {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
29 {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
30 </div>
31 </div>
32 );
33};