From 15f9f5dbe80cf86d112128e3051ecb53468821a0 Mon Sep 17 00:00:00 2001 From: wmwragg Date: Tue, 26 Jul 2016 17:24:45 +0100 Subject: [PATCH] Doing the state change via onClick events rather than radio buttons, as they were causeing untraceable react errros for some reason --- .../rooms/NotificationStateContextMenu.js | 50 +++++++++++++------ src/skins/vector/css/common.css | 5 ++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/components/views/rooms/NotificationStateContextMenu.js b/src/components/views/rooms/NotificationStateContextMenu.js index 3d125d2c..d8a79b30 100644 --- a/src/components/views/rooms/NotificationStateContextMenu.js +++ b/src/components/views/rooms/NotificationStateContextMenu.js @@ -18,6 +18,7 @@ limitations under the License. var q = require("q"); var React = require('react'); +var classNames = require('classnames'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); module.exports = React.createClass({ @@ -67,31 +68,52 @@ module.exports = React.createClass({ _onToggle: function(ev) { switch (ev.target.value) { case "all": - if (this.props.onFinished) { - this._save(false); - this.props.onFinished(); - } + this._save(false); break; case "mute": - if (this.props.onFinished) { - this._save(true); - this.props.onFinished(); - } + this._save(true); break; } + + if (this.props.onFinished) { + this.props.onFinished(); + }; + }, + + _onClickAllNotifs: function() { + this._save(false); + if (this.props.onFinished) { + this.props.onFinished(); + }; + }, + + _onClickMute: function() { + this._save(true); + if (this.props.onFinished) { + this.props.onFinished(); + }; }, render: function() { var cli = MatrixClientPeg.get(); + + var allNotifsClasses = classNames({ + 'mx_ContextualMenu_field': true, + 'mx_ContextualMenu_fieldSet': !this.state.areNotifsMuted, + }); + + var muteNotifsClasses = classNames({ + 'mx_ContextualMenu_field': true, + 'mx_ContextualMenu_fieldSet': this.state.areNotifsMuted, + }); + return (
-
- - All notifications +
+ { !this.state.areNotifsMuted ? "ON" : "OFF" } - All notifications
-
- - Mute +
+ { this.state.areNotifsMuted ? "ON" : "OFF" } - Mute
); diff --git a/src/skins/vector/css/common.css b/src/skins/vector/css/common.css index b9dab270..bca19493 100644 --- a/src/skins/vector/css/common.css +++ b/src/skins/vector/css/common.css @@ -103,6 +103,7 @@ input[type=text]:focus, textarea:focus { position: fixed; z-index: 2001; padding: 6px; + font-size: 14px; } .mx_ContextualMenu_chevron_right { @@ -156,6 +157,10 @@ input[type=text]:focus, textarea:focus { cursor: pointer; } +.mx_ContextualMenu_field.mx_ContextualMenu_fieldSet { + font-weight: bold; +} + .mx_ContextualMenu_spinner { display: block; margin: 0 auto;