@@ -18,6 +18,7 @@ limitations under the License.
1818
1919var q = require ( "q" ) ;
2020var React = require ( 'react' ) ;
21+ var classNames = require ( 'classnames' ) ;
2122var MatrixClientPeg = require ( 'matrix-react-sdk/lib/MatrixClientPeg' ) ;
2223
2324module . exports = React . createClass ( {
@@ -67,31 +68,52 @@ module.exports = React.createClass({
6768 _onToggle : function ( ev ) {
6869 switch ( ev . target . value ) {
6970 case "all" :
70- if ( this . props . onFinished ) {
71- this . _save ( false ) ;
72- this . props . onFinished ( ) ;
73- }
71+ this . _save ( false ) ;
7472 break ;
7573 case "mute" :
76- if ( this . props . onFinished ) {
77- this . _save ( true ) ;
78- this . props . onFinished ( ) ;
79- }
74+ this . _save ( true ) ;
8075 break ;
8176 }
77+
78+ if ( this . props . onFinished ) {
79+ this . props . onFinished ( ) ;
80+ } ;
81+ } ,
82+
83+ _onClickAllNotifs : function ( ) {
84+ this . _save ( false ) ;
85+ if ( this . props . onFinished ) {
86+ this . props . onFinished ( ) ;
87+ } ;
88+ } ,
89+
90+ _onClickMute : function ( ) {
91+ this . _save ( true ) ;
92+ if ( this . props . onFinished ) {
93+ this . props . onFinished ( ) ;
94+ } ;
8295 } ,
8396
8497 render : function ( ) {
8598 var cli = MatrixClientPeg . get ( ) ;
99+
100+ var allNotifsClasses = classNames ( {
101+ 'mx_ContextualMenu_field' : true ,
102+ 'mx_ContextualMenu_fieldSet' : ! this . state . areNotifsMuted ,
103+ } ) ;
104+
105+ var muteNotifsClasses = classNames ( {
106+ 'mx_ContextualMenu_field' : true ,
107+ 'mx_ContextualMenu_fieldSet' : this . state . areNotifsMuted ,
108+ } ) ;
109+
86110 return (
87111 < div >
88- < div className = "mx_ContextualMenu_field" >
89- < input disabled = { cli . isGuest ( ) } type = "radio" name = "notification_state" value = "all" onChange = { this . _onToggle } checked = { ! this . state . areNotifsMuted } />
90- All notifications
112+ < div className = { allNotifsClasses } onClick = { this . _onClickAllNotifs } >
113+ { ! this . state . areNotifsMuted ? "ON" : "OFF" } - All notifications
91114 </ div >
92- < div className = "mx_ContextualMenu_field" >
93- < input disabled = { cli . isGuest ( ) } type = "radio" name = "notification_state" value = "mute" onChange = { this . _onToggle } checked = { this . state . areNotifsMuted } />
94- Mute
115+ < div className = { muteNotifsClasses } onClick = { this . _onClickMute } >
116+ { this . state . areNotifsMuted ? "ON" : "OFF" } - Mute
95117 </ div >
96118 </ div >
97119 ) ;
0 commit comments