+ Failed to load the URL
+
+ { 'URL: ' }
+ { this.props.errorInfo.validatedURL }
+
+
+ { 'Error code: ' }
+ { this.props.errorInfo.errorCode }
+
+
+ { this.props.errorInfo.errorDescription }
+
+ Please check below. Then, reload this window. (Ctrl+R or Command+R)
+
+ Is your computer online?
+ Is the server alive?
+ Is the URL correct?
+
+
+ );
}
});
@@ -321,7 +373,9 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
// https://github.com/atom/electron/issues/4011
electron.ipcRenderer.send('win32-overlay', {
overlayDataURL: dataURL,
- description: description
+ description: description,
+ unreadCount: unreadCount,
+ mentionCount: mentionCount
});
};
@@ -332,7 +386,7 @@ var showUnreadBadgeWindows = function(unreadCount, mentionCount) {
const dataURL = badge.createDataURL('•');
sendBadge(dataURL, 'You have unread channels');
} else {
- remote.getCurrentWindow().setOverlayIcon(null, '');
+ sendBadge(null, 'You have no unread messages');
}
}
diff --git a/src/browser/js/badge.js b/src/browser/js/badge.js
index b77e1f22fc6..0b0b168e751 100644
--- a/src/browser/js/badge.js
+++ b/src/browser/js/badge.js
@@ -1,29 +1,29 @@
-'use strict';
-
-var createDataURL = function(text) {
- const scale = 2; // should rely display dpi
- const size = 16 * scale;
- const canvas = document.createElement('canvas');
- canvas.setAttribute('width', size);
- canvas.setAttribute('height', size);
- const ctx = canvas.getContext('2d');
-
- // circle
- ctx.fillStyle = "#FF1744"; // Material Red A400
- ctx.beginPath();
- ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);
- ctx.fill();
-
- // text
- ctx.fillStyle = "#ffffff"
- ctx.textAlign = 'center';
- ctx.textBaseline = 'middle';
- ctx.font = (11 * scale) + "px sans-serif";
- ctx.fillText(text, size / 2, size / 2, size);
-
- return canvas.toDataURL();
-};
-
-module.exports = {
- createDataURL: createDataURL
+'use strict';
+
+var createDataURL = function(text) {
+ const scale = 2; // should rely display dpi
+ const size = 16 * scale;
+ const canvas = document.createElement('canvas');
+ canvas.setAttribute('width', size);
+ canvas.setAttribute('height', size);
+ const ctx = canvas.getContext('2d');
+
+ // circle
+ ctx.fillStyle = "#FF1744"; // Material Red A400
+ ctx.beginPath();
+ ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);
+ ctx.fill();
+
+ // text
+ ctx.fillStyle = "#ffffff"
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'middle';
+ ctx.font = (11 * scale) + "px sans-serif";
+ ctx.fillText(text, size / 2, size / 2, size);
+
+ return canvas.toDataURL();
+};
+
+module.exports = {
+ createDataURL: createDataURL
};
diff --git a/src/browser/js/notification.js b/src/browser/js/notification.js
new file mode 100644
index 00000000000..f893d8794f8
--- /dev/null
+++ b/src/browser/js/notification.js
@@ -0,0 +1,80 @@
+const OriginalNotification = Notification;
+
+function override(eventHandlers) {
+ Notification = function(title, options) {
+ this.notification = new OriginalNotification(title, options);
+ if (eventHandlers.notification) {
+ eventHandlers.notification(title, options);
+ }
+ };
+
+ // static properties
+ Notification.__defineGetter__('permission', function() {
+ return OriginalNotification.permission;
+ });
+
+ // instance properties
+ var defineReadProperty = function(property) {
+ Notification.prototype.__defineGetter__(property, function() {
+ return this.notification[property];
+ });
+ };
+ defineReadProperty('title');
+ defineReadProperty('dir');
+ defineReadProperty('lang');
+ defineReadProperty('body');
+ defineReadProperty('tag');
+ defineReadProperty('icon');
+ defineReadProperty('data');
+ defineReadProperty('silent');
+
+ // unsupported properties
+ defineReadProperty('noscreen');
+ defineReadProperty('renotify');
+ defineReadProperty('sound');
+ defineReadProperty('sticky');
+ defineReadProperty('vibrate');
+
+ // event handlers
+ var defineEventHandler = function(event, callback) {
+ defineReadProperty(event);
+ Notification.prototype.__defineSetter__(event, function(originalCallback) {
+ this.notification[event] = function() {
+ callbackevent = {
+ preventDefault: function() {
+ this.isPrevented = true;
+ }
+ };
+ if (callback) {
+ callback(callbackevent);
+ if (!callbackevent.isPrevented) {
+ originalCallback();
+ }
+ }
+ else {
+ originalCallback();
+ }
+ }
+ });
+ }
+ defineEventHandler('onclick', eventHandlers.onclick);
+ defineEventHandler('onerror', eventHandlers.onerror);
+
+ // obsolete handlers
+ defineEventHandler('onclose', eventHandlers.onclose);
+ defineEventHandler('onshow', eventHandlers.onshow);
+
+ // static methods
+ Notification.requestPermission = function(callback) {
+ OriginalNotification.requestPermission(callback);
+ };
+
+ // instance methods
+ Notification.prototype.close = function() {
+ this.notification.close();
+ };
+}
+
+module.exports = {
+ override: override
+};
diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx
index 850ccceea3e..59a085002da 100644
--- a/src/browser/settings.jsx
+++ b/src/browser/settings.jsx
@@ -169,8 +169,8 @@ var TeamListItemNew = React.createClass({
console.log('submit');
e.preventDefault();
this.props.onTeamAdd({
- name: this.state.name,
- url: this.state.url
+ name: this.state.name.trim(),
+ url: this.state.url.trim()
});
this.setState(this.getInitialState());
},
@@ -186,6 +186,9 @@ var TeamListItemNew = React.createClass({
url: e.target.value
});
},
+ shouldEnableAddButton: function() {
+ return (this.state.name.trim() !== '') && (this.state.url.trim() !== '');
+ },
render: function() {
return (