| 1 | <div x-data> |
| 2 | <style> |
| 3 | #microphone-button { |
| 4 | order: 1; |
| 5 | border-color: transparent; |
| 6 | border-radius: 12px; |
| 7 | background-color: transparent; |
| 8 | color: grey; |
| 9 | transition: |
| 10 | background-color 0.2s ease, |
| 11 | border-color 0.2s ease, |
| 12 | box-shadow 0.12s ease-in-out, |
| 13 | color 0.2s ease, |
| 14 | opacity 0.12s ease-in-out; |
| 15 | } |
| 16 | |
| 17 | #microphone-button svg { |
| 18 | transform-origin: center; |
| 19 | transition: color 0.2s ease, transform 0.12s ease-in-out; |
| 20 | } |
| 21 | |
| 22 | #microphone-button.mic-disabled { |
| 23 | color: #5f6368; |
| 24 | cursor: not-allowed; |
| 25 | opacity: 0.58; |
| 26 | } |
| 27 | |
| 28 | #microphone-button.mic-inactive { |
| 29 | color: grey; |
| 30 | } |
| 31 | |
| 32 | #microphone-button.mic-activating { |
| 33 | color: silver; |
| 34 | } |
| 35 | |
| 36 | #microphone-button.mic-listening { |
| 37 | color: red; |
| 38 | } |
| 39 | |
| 40 | #microphone-button.mic-recording { |
| 41 | color: green; |
| 42 | } |
| 43 | |
| 44 | #microphone-button.mic-waiting { |
| 45 | color: teal; |
| 46 | } |
| 47 | |
| 48 | #microphone-button.mic-processing { |
| 49 | color: darkcyan; |
| 50 | } |
| 51 | |
| 52 | #microphone-button.mic-activating svg, |
| 53 | #microphone-button.mic-processing svg { |
| 54 | animation: whisper-stt-mic-pulse 0.8s infinite; |
| 55 | } |
| 56 | |
| 57 | @media (hover: hover) { |
| 58 | #microphone-button:not(.mic-disabled):hover { |
| 59 | box-shadow: none; |
| 60 | } |
| 61 | |
| 62 | #microphone-button:not(.mic-disabled):hover svg { |
| 63 | transform: scale(1.08); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | #microphone-button:not(.mic-disabled):active { |
| 68 | box-shadow: none; |
| 69 | } |
| 70 | |
| 71 | #microphone-button:not(.mic-disabled):active svg { |
| 72 | transform: scale(0.92); |
| 73 | } |
| 74 | |
| 75 | @keyframes whisper-stt-mic-pulse { |
| 76 | 0% { |
| 77 | transform: scale(1); |
| 78 | } |
| 79 | 50% { |
| 80 | transform: scale(1.1); |
| 81 | } |
| 82 | 100% { |
| 83 | transform: scale(1); |
| 84 | } |
| 85 | } |
| 86 | </style> |
| 87 | <template x-if="$store.whisperStt"> |
| 88 | <template x-teleport="#chat-buttons-wrapper"> |
| 89 | <button |
| 90 | class="chat-button mic-inactive" |
| 91 | id="microphone-button" |
| 92 | data-whisper-microphone |
| 93 | aria-label="Start/Stop recording" |
| 94 | @click="$store.whisperStt.handleMicrophoneClick()" |
| 95 | x-init="$store.whisperStt.updateMicrophoneButtonUI()" |
| 96 | x-effect="$store.whisperStt.updateMicrophoneButtonUI()" |
| 97 | > |
| 98 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 18" fill="currentColor"> |
| 99 | <path d="m8,12c1.66,0,3-1.34,3-3V3c0-1.66-1.34-3-3-3s-3,1.34-3,3v6c0,1.66,1.34,3,3,3Zm-1,1.9c-2.7-.4-4.8-2.6-5-5.4H0c.2,3.8,3.1,6.9,7,7.5v2h2v-2c3.9-.6,6.8-3.7,7-7.5h-2c-.2,2.8-2.3,5-5,5.4h-2Z" /> |
| 100 | </svg> |
| 101 | </button> |
| 102 | </template> |
| 103 | </template> |
| 104 | </div> |