@@ -32,6 +32,17 @@ const styles = {
3232 float : 'right' ,
3333 paddingTop : '3px'
3434 } ,
35+ echo : {
36+ display : 'inline-block' ,
37+ paddingTop : '3px' ,
38+ paddingLeft : '16px'
39+ } ,
40+ echoOn : {
41+ color : '#000000'
42+ } ,
43+ echoOff : {
44+ color : '#888888'
45+ } ,
3546 rx : {
3647 backgroundColor : blue
3748 } ,
@@ -45,13 +56,15 @@ function applyStyles(el, stylesToApply){
4556}
4657
4758function rxtxBar ( app , opts , done ) {
59+ const { toggleEcho } = app . handlers ;
4860
4961 let bottomBar ;
5062 let rx ;
5163 let tx ;
64+ let echoContainer , echoLabel ;
5265
5366 function onConsoleChange ( ) {
54- const { rxtx } = consoleStore . getState ( ) ;
67+ const { rxtx, echo } = consoleStore . getState ( ) ;
5568 const { flashRx, flashTx } = rxtx ;
5669
5770 if ( flashRx ) {
@@ -65,6 +78,14 @@ function rxtxBar(app, opts, done){
6578 } else {
6679 tx . style . backgroundColor = styles . indicator . backgroundColor ;
6780 }
81+
82+ if ( echo ) {
83+ applyStyles ( echoContainer , styles . echoOn ) ;
84+ echoLabel . nodeValue = 'Echo On' ;
85+ } else {
86+ applyStyles ( echoContainer , styles . echoOff ) ;
87+ echoLabel . nodeValue = 'Echo Off' ;
88+ }
6889 }
6990
7091 app . view ( 'editor' , function ( el , cb ) {
@@ -73,6 +94,16 @@ function rxtxBar(app, opts, done){
7394 bottomBar = document . createElement ( 'div' ) ;
7495 applyStyles ( bottomBar , styles . bar ) ;
7596
97+ echoContainer = document . createElement ( 'span' ) ;
98+ applyStyles ( echoContainer , styles . echo ) ;
99+ applyStyles ( echoContainer , styles . echoOff ) ;
100+ bottomBar . appendChild ( echoContainer ) ;
101+
102+ echoLabel = document . createTextNode ( 'Echo Off' ) ;
103+ echoContainer . appendChild ( echoLabel ) ;
104+
105+ echoContainer . addEventListener ( 'click' , toggleEcho , false ) ;
106+
76107 const rxtxContainer = document . createElement ( 'span' ) ;
77108 applyStyles ( rxtxContainer , styles . rxtx ) ;
78109 bottomBar . appendChild ( rxtxContainer ) ;
0 commit comments