| 1 | import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util"; |
| 2 | import { GeneratingIndicator } from "./GeneratingIndicator"; |
| 3 | |
| 4 | interface StreamingToolbarProps { |
| 5 | onStop: () => void; |
| 6 | displayText?: string; |
| 7 | } |
| 8 | |
| 9 | export function StreamingToolbar({ |
| 10 | onStop, |
| 11 | displayText = "Stop", |
| 12 | }: StreamingToolbarProps) { |
| 13 | const jetbrains = isJetBrains(); |
| 14 | |
| 15 | return ( |
| 16 | <div className="flex w-full items-center justify-between"> |
| 17 | <GeneratingIndicator /> |
| 18 | <div |
| 19 | onClick={onStop} |
| 20 | className="text-2xs cursor-pointer px-1.5 py-0.5 hover:brightness-125" |
| 21 | > |
| 22 | <span className="text-description">{displayText}</span> |
| 23 | {/* JetBrains overrides cmd+backspace, so we have to use another shortcut */} |
| 24 | <span className="text-description-muted ml-1 opacity-75"> |
| 25 | {jetbrains ? getAltKeyLabel() : getMetaKeyLabel()}⌫ |
| 26 | </span> |
| 27 | </div> |
| 28 | </div> |
| 29 | ); |
| 30 | } |