| 1 | import { useContext } from "react"; |
| 2 | import styled from "styled-components"; |
| 3 | import { IdeMessengerContext } from "../../../../context/IdeMessenger"; |
| 4 | import { getFontSize } from "../../../../util"; |
| 5 | import { GeneratingIndicator } from "./GeneratingIndicator"; |
| 6 | |
| 7 | const Container = styled.div` |
| 8 | display: flex; |
| 9 | justify-content: space-between; |
| 10 | align-items: center; |
| 11 | width: 100%; |
| 12 | `; |
| 13 | |
| 14 | const StopButton = styled.div` |
| 15 | font-size: ${getFontSize() - 3}px; |
| 16 | padding: 2px; |
| 17 | padding-right: 4px; |
| 18 | cursor: pointer; |
| 19 | `; |
| 20 | |
| 21 | export function TtsActiveToolbar() { |
| 22 | const ideMessenger = useContext(IdeMessengerContext); |
| 23 | |
| 24 | return ( |
| 25 | <Container> |
| 26 | <GeneratingIndicator /> |
| 27 | <StopButton |
| 28 | className="text-description" |
| 29 | onClick={() => { |
| 30 | ideMessenger.post("tts/kill", undefined); |
| 31 | }} |
| 32 | > |
| 33 | ■ Stop TTS |
| 34 | </StopButton> |
| 35 | </Container> |
| 36 | ); |
| 37 | } |