feat(stage-tamagotchi): universal TTS stop button in controls island (#2072)
Co-authored-by: RainbowBird <git@luoling.moe>
This commit is contained in:
@@ -55,4 +55,18 @@ describe('useStopSpeakingButton', () => {
|
||||
reason: 'manual-chat',
|
||||
})
|
||||
})
|
||||
|
||||
it('requests a manual-all stop without touching chat input state', () => {
|
||||
requestStopSpeakingMock.mockClear()
|
||||
trackTtsStopClickedMock.mockClear()
|
||||
|
||||
const { stopAllSpeaking } = useStopSpeakingButton()
|
||||
|
||||
stopAllSpeaking()
|
||||
|
||||
expect(requestStopSpeakingMock).toHaveBeenCalledWith('manual-all')
|
||||
expect(trackTtsStopClickedMock).toHaveBeenCalledWith({
|
||||
reason: 'manual-all',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ import { computed } from 'vue'
|
||||
* - A Stage instance is mounted and consumes speech output stop requests.
|
||||
*
|
||||
* Returns:
|
||||
* - Visibility state for the button and a click handler for manual chat stops.
|
||||
* - Visibility state for the button and click handlers for manual stops.
|
||||
*/
|
||||
export function useStopSpeakingButton() {
|
||||
const { nowSpeaking } = storeToRefs(useSpeakingStore())
|
||||
@@ -28,8 +28,14 @@ export function useStopSpeakingButton() {
|
||||
speechOutputControlStore.requestStopSpeaking('manual-chat')
|
||||
}
|
||||
|
||||
function stopAllSpeaking() {
|
||||
trackTtsStopClicked({ reason: 'manual-all' })
|
||||
speechOutputControlStore.requestStopSpeaking('manual-all')
|
||||
}
|
||||
|
||||
return {
|
||||
showStopSpeakingButton,
|
||||
stopSpeakingFromChat,
|
||||
stopAllSpeaking,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user