diff --git a/browser/main/Components/AddMemberModal.jsx b/browser/main/Components/AddMemberModal.jsx index 7b682156..ae6c254e 100644 --- a/browser/main/Components/AddMemberModal.jsx +++ b/browser/main/Components/AddMemberModal.jsx @@ -50,19 +50,24 @@ module.exports = React.createClass({ } }, handleSubmit: function () { - Hq - .addMember(this.props.team.name, { - userName: this.state.userName, - role: this.state.role - }) - .then(function (res) { - console.log(res.body) - UserStore.Actions.addMember(res.body) - this.props.close() - }.bind(this)) - .catch(function (err) { - console.error(err) - }) + this.setState({errorMessage: null}, function () { + Hq + .addMember(this.props.team.name, { + userName: this.state.userName, + role: this.state.role + }) + .then(function (res) { + console.log(res.body) + UserStore.Actions.addMember(res.body) + this.props.close() + }.bind(this)) + .catch(function (err) { + console.error(err) + if (err.status === 403) { + this.setState({errorMessage: err.response.body.message}) + } + }.bind(this)) + }) }, handleChange: function (value) { this.setState({userName: value}) @@ -88,6 +93,8 @@ module.exports = React.createClass({ role + {this.state.errorMessage != null ? (
{this.state.errorMessage}
) : null} + ) diff --git a/browser/main/Components/HomeNavigator.jsx b/browser/main/Components/HomeNavigator.jsx index c4ba5ca5..fae260d6 100644 --- a/browser/main/Components/HomeNavigator.jsx +++ b/browser/main/Components/HomeNavigator.jsx @@ -71,16 +71,6 @@ module.exports = React.createClass({ openPlanetCreateModal: function () { this.openModal(PlanetCreateModal, {transitionTo: this.transitionTo}) }, - handleKeyDown: function (e) { - if (this.state.currentUser == null) return - if (e.metaKey && e.keyCode > 48 && e.keyCode < 58) { - var planet = this.state.currentUser.Planets[e.keyCode - 49] - if (planet != null) { - this.transitionTo('planet', {userName: planet.userName, planetName: planet.name}) - } - e.preventDefault() - } - }, toggleProfilePopup: function () { this.openProfilePopup() }, diff --git a/browser/main/Components/PlanetCreateModal.jsx b/browser/main/Components/PlanetCreateModal.jsx index 2d396705..fa428082 100644 --- a/browser/main/Components/PlanetCreateModal.jsx +++ b/browser/main/Components/PlanetCreateModal.jsx @@ -42,21 +42,26 @@ module.exports = React.createClass({ } }, handleSubmit: function () { - Hq.createPlanet(this.state.ownerName, this.state.planet) - .then(function (res) { - var planet = res.body + this.setState({errorMessage: null}, function () { + Hq.createPlanet(this.state.ownerName, this.state.planet) + .then(function (res) { + var planet = res.body - PlanetStore.Actions.update(planet) + PlanetStore.Actions.update(planet) - if (this.props.transitionTo != null) { - this.props.transitionTo('planetHome', {userName: planet.userName, planetName: planet.name}) - } + if (this.props.transitionTo != null) { + this.props.transitionTo('planetHome', {userName: planet.userName, planetName: planet.name}) + } - this.props.close() - }.bind(this)) - .catch(function (err) { - console.error(err) - }) + this.props.close() + }.bind(this)) + .catch(function (err) { + console.error(err) + if (err.status === 403) { + this.setState({errorMessage: err.response.body.message}) + } + }.bind(this)) + }) }, render: function () { var teamOptions = this.state.user.Teams.map(function (team) { @@ -81,6 +86,8 @@ module.exports = React.createClass({ + {this.state.errorMessage != null ? ({this.state.errorMessage}
) : null} + diff --git a/browser/styles/shared/modal.styl b/browser/styles/shared/modal.styl index 056779fd..250de965 100644 --- a/browser/styles/shared/modal.styl +++ b/browser/styles/shared/modal.styl @@ -196,7 +196,6 @@ border-radius 5px float left - .LaunchModal .modal-tab text-align center @@ -314,6 +313,14 @@ height 55px circle() btnPrimary() + .errorAlert + alertError() + padding 12px 10px + border-radius 5px + text-align center + display block + width 360px + margin 0 auto 15px .ContactModal padding 15px diff --git a/main.js b/main.js index 41f24738..baef59fd 100644 --- a/main.js +++ b/main.js @@ -178,6 +178,10 @@ function makeNewMainWindow () { mainWindow.loadUrl('file://' + __dirname + '/browser/main/index.electron.html') + mainWindow.webContents.on('new-window', function (e) { + e.preventDefault() + }) + mainWindow.on('closed', function () { console.log('main closed') mainWindow = null diff --git a/package.json b/package.json index 01fbd22d..7a8d0f10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "boost", - "version": "0.2.3", + "version": "0.2.5", "description": "Boost App", "main": "main.js", "scripts": {