From 71ab644aeb4f13fdd18091e4a9c150ae9bdff0a2 Mon Sep 17 00:00:00 2001
From: Asaad Mahmood
Date: Mon, 12 Sep 2016 20:53:45 +0500
Subject: [PATCH] UI Improvements for settings page
---
src/browser/settings.jsx | 144 ++++++++++++++--------------
test/specs/browser/settings_test.js | 6 +-
2 files changed, 73 insertions(+), 77 deletions(-)
diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx
index 6ecb35d2..c9120c42 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,78 @@ var SettingsPage = React.createClass({
checked={ this.state.showUnreadBadge } onChange={ this.handleShowUnreadBadge } />);
}
+ if (process.platform === 'win32' || process.platform === 'linux') {
+ options.push();
+ }
+
+ const settingsPage = {
+ navbar: {
+ backgroundColor: '#fff'
+ },
+ heading: {
+ textAlign: 'center',
+ fontSize: '24px',
+ margin: '0',
+ padding: '1em 0'
+ },
+ sectionHeading: {
+ fontSize: '20px',
+ margin: '0',
+ padding: '1em 0'
+ },
+ sectionHeadingLink: {
+ marginTop: '24px',
+ display: 'inline-block',
+ fontSize: '15px'
+ },
+ footer: {
+ padding: '0.4em 0'
+ }
+ }
+
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 +380,9 @@ var TeamListItem = React.createClass({
);
@@ -521,4 +517,4 @@ window.addEventListener('contextmenu', function(e) {
ReactDOM.render(
,
document.getElementById('content')
-);
+);
\ No newline at end of file
diff --git a/test/specs/browser/settings_test.js b/test/specs/browser/settings_test.js
index 4301bf33..92e174ae 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)
});
});
@@ -191,4 +191,4 @@ describe('browser/settings.html', function() {
});
});
});
-});
+});
\ No newline at end of file