From 39e84efa81d778b2241dac6210899c5bb7a4da7e Mon Sep 17 00:00:00 2001 From: bsu3338 Date: Sun, 3 Sep 2023 22:35:48 -0500 Subject: [PATCH] Update SpeechSynthesis.tsx --- .../components/Messages/SpeechSynthesis.tsx | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/client/src/components/Messages/SpeechSynthesis.tsx b/client/src/components/Messages/SpeechSynthesis.tsx index cdc2b0354b..2908b3b03b 100644 --- a/client/src/components/Messages/SpeechSynthesis.tsx +++ b/client/src/components/Messages/SpeechSynthesis.tsx @@ -1,50 +1,17 @@ -//import { useState, useEffect } from 'react'; - function useSpeechSynthesis() { - //const [isSpeechEnabled, setIsSpeechEnabled] = useState(false); - //const [textToSpeak, setTextToSpeak] = useState(''); const synthesizeSpeech = (text) => { const synth = window.speechSynthesis; synth.cancel(); const utterance = new SpeechSynthesisUtterance(text); synth.speak(utterance); - //setTextToSpeak(text); }; - //const toggleSpeechSynthesis = () => { - // setIsSpeechEnabled(!isSpeechEnabled); - // console.log('Toggle Text-To-Speech', !isSpeechEnabled); - //}; - const cancelSpeech = () => { const synth = window.speechSynthesis; synth.cancel(); }; - //const handleKeyDown = (event) => { - // if (event.shiftKey && event.altKey && event.key === 'P') { - // toggleSpeechSynthesis(); - // } - //}; - - //useEffect(() => { - // window.addEventListener('keydown', handleKeyDown); - - // return () => { - // window.removeEventListener('keydown', handleKeyDown); - // }; - // }, [isSpeechEnabled]); - - //useEffect(() => { - // if (!isSpeechEnabled || !textToSpeak) return; - - // const synth = window.speechSynthesis; - // synth.cancel(); - // const utterance = new SpeechSynthesisUtterance(textToSpeak); - // synth.speak(utterance); - //}, [textToSpeak, isSpeechEnabled]); -// return { synthesizeSpeech, toggleSpeechSynthesis, cancelSpeech, isSpeechEnabled }; return { synthesizeSpeech, cancelSpeech }; }