@@ -10,6 +10,7 @@ import FailedModal from "../../components/FailedModal";
1010import Loading from "../../components/Loading" ;
1111import Perform from "../../components/Perform" ;
1212import WarningModal from "../../components/WarningModal" ;
13+ import TextModal from "../../components/TextModal" ;
1314import { useSettings } from "../../context/userContext" ;
1415import { getStaticPaths , makeStaticProperties } from "../../lib/get-static" ;
1516import Ipc from "../../lib/ipc" ;
@@ -38,6 +39,7 @@ function Stream() {
3839 const [ showWarning , setShowWarning ] = useState ( false ) ;
3940 const [ showDisplay , setShowDisplay ] = useState ( false ) ;
4041 const [ showAudio , setShowAudio ] = useState ( false ) ;
42+ const [ showTextModal , setShowTextModal ] = useState ( false ) ;
4143 const [ volume , setVolume ] = useState ( 1 ) ;
4244 const [ streamingType , setStreamingType ] = useState ( '' ) ;
4345 const [ consoleId , setConsoleId ] = useState ( '' ) ;
@@ -484,6 +486,13 @@ function Stream() {
484486 } ) ;
485487 }
486488
489+ const handleSendText = ( text : string ) => {
490+ Ipc . send ( "consoles" , "sendText" , {
491+ consoleId,
492+ text
493+ } ) ;
494+ }
495+
487496 const onDisconnect = ( ) => {
488497 setLoading ( true ) ;
489498 setShowPerformance ( false ) ;
@@ -558,6 +567,7 @@ function Stream() {
558567 } }
559568 onDisplay = { ( ) => setShowDisplay ( true ) }
560569 onAudio = { ( ) => setShowAudio ( true ) }
570+ onText = { ( ) => setShowTextModal ( true ) }
561571 onPressNexus = { handlePressNexus }
562572 onLongPressNexus = { handleLongPressNexus }
563573 />
@@ -592,6 +602,22 @@ function Stream() {
592602 />
593603 ) }
594604
605+ {
606+ showTextModal && (
607+ < TextModal
608+ onClose = { ( ) => setShowTextModal ( false ) }
609+ onConfirm = { value => {
610+ let text = value . trim ( )
611+ if ( ! text ) return
612+ if ( text . length > 150 ) {
613+ text = text . substring ( 0 , 150 ) ;
614+ }
615+ handleSendText ( text )
616+ } }
617+ />
618+ )
619+ }
620+
595621 { showAudio && (
596622 < Audio
597623 volume = { volume }
0 commit comments