From 7f23c496a2ba62b3f6f03f87eceed209af8a1c83 Mon Sep 17 00:00:00 2001
From: Yuya Ochiai
Date: Mon, 12 Sep 2016 00:18:09 +0900
Subject: [PATCH] Improve settings UI
---
src/browser/settings.jsx | 118 +++++++++++-----------------
test/specs/browser/settings_test.js | 4 +-
2 files changed, 47 insertions(+), 75 deletions(-)
diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx
index 6ecb35d2..65b1f5fa 100644
--- a/src/browser/settings.jsx
+++ b/src/browser/settings.jsx
@@ -9,7 +9,7 @@ const settings = require('../common/settings');
const React = require('react');
const ReactDOM = require('react-dom');
-const {Grid, Row, Col, Input, Button, ListGroup, ListGroupItem, Glyphicon, HelpBlock} = require('react-bootstrap');
+const {Grid, Row, Col, Input, Button, ListGroup, ListGroupItem, Glyphicon, HelpBlock, Navbar, Nav} = require('react-bootstrap');
var AutoLaunch = require('auto-launch');
@@ -140,10 +140,10 @@ var SettingsPage = React.createClass({
showAddTeamForm: !this.state.showAddTeamForm
});
},
- handleFlashWindowSetting: function(item) {
+ handleFlashWindow: function() {
this.setState({
notifications: {
- flashWindow: item.state
+ flashWindow: this.refs.flashWindow.getChecked() ? 2 : 0
}
});
},
@@ -199,78 +199,54 @@ var SettingsPage = React.createClass({
checked={ this.state.showUnreadBadge } onChange={ this.handleShowUnreadBadge } />);
}
+ if (process.platform === 'win32' || process.platform === 'linux') {
+ options.push();
+ }
+
var options_row = (options.length > 0) ? (
- Options
+ App options
{ options }
) : null;
- var notifications_row = null;
- if (process.platform === 'win32' || process.platform === 'linux') {
- var notificationSettings = [
- {
- label: 'Never',
- state: 0
- },
- /* ToDo: Idle isn't implemented yet
- {
- label: 'Only when idle (after 10 seconds)',
- state: 1
- },*/
- {
- label: 'Always',
- state: 2
- }
- ];
-
- var that = this;
- var notificationElements = notificationSettings.map(function(item) {
- var boundClick = that.handleFlashWindowSetting.bind(that, item);
- return (
-
- );
- });
-
- notifications_row = (
-
-
- Notifications
Flash the taskbar icon when a new message is received.
- { notificationElements }
-
-
- );
- }
-
return (
-
-
-
- Teams
-
-
-
-
-
- { teams_row }
- { options_row }
- { notifications_row }
-
-
-
-
-
-
- { ' ' }
-
-
-
-
+
+
+
+ Settings
+
+
+
+
+
+ Team Management
+
+
+ ⊞ Add new team
+
+
+ { teams_row }
+ { options_row }
+
+
+
+
+
+
+
+
+
+
+
+
);
}
});
@@ -380,13 +356,9 @@ var TeamListItem = React.createClass({
);
diff --git a/test/specs/browser/settings_test.js b/test/specs/browser/settings_test.js
index 4301bf33..8a156232 100644
--- a/test/specs/browser/settings_test.js
+++ b/test/specs/browser/settings_test.js
@@ -171,13 +171,13 @@ describe('browser/settings.html', function() {
});
});
- describe('Notifications', function() {
+ describe('Flash taskbar icon on new messages', function() {
it('should appear on win32 and linux', function() {
const expected = (process.platform === 'win32' || process.platform === 'linux');
env.addClientCommands(this.app.client);
return this.app.client
.loadSettingsPage()
- .isExisting('#notificationsRow').should.eventually.equal(expected)
+ .isExisting('#inputflashWindow').should.eventually.equal(expected)
});
});