diff --git a/browser/main/Components/PlanetHeader.jsx b/browser/main/Components/PlanetHeader.jsx index 515cd489..8f290389 100644 --- a/browser/main/Components/PlanetHeader.jsx +++ b/browser/main/Components/PlanetHeader.jsx @@ -8,24 +8,12 @@ var PlanetHeader = React.createClass({ }, getInitialState: function () { return { - isMenuDropDownOpen: false, search: '' } }, componentDidMount: function () { React.findDOMNode(this.refs.search).focus() }, - toggleMenuDropDown: function () { - this.setState({isMenuDropDownOpen: !this.state.isMenuDropDownOpen}, function () { - if (this.state.isMenuDropDownOpen) { - document.body.onclick = function () { - this.setState({isMenuDropDownOpen: false}, function () { - document.body.onclick = null - }) - }.bind(this) - } - }) - }, interceptClick: function (e) { e.stopPropagation() }, @@ -40,23 +28,25 @@ var PlanetHeader = React.createClass({ }, render: function () { var currentPlanetName = this.props.currentPlanet.name + var currentUserName = this.props.currentUser.name return (
- {currentPlanetName} - -
- Planet Setting - Manage member - Delete Planet +
+ {currentUserName}
+ / + {currentPlanetName} + +
+
+ + + + + Download Mac app
- - - - - Download Mac app
) } diff --git a/browser/main/Containers/PlanetContainer.jsx b/browser/main/Containers/PlanetContainer.jsx index 5183a838..41517f29 100644 --- a/browser/main/Containers/PlanetContainer.jsx +++ b/browser/main/Containers/PlanetContainer.jsx @@ -250,7 +250,7 @@ module.exports = React.createClass({ this.setState({isDeleteModalOpen: false}) }, handleKeyDown: function (e) { - console.log(e.keyCode) + // Bypath for modal open state if (this.state.isLaunchModalOpen) { if (e.keyCode === 27) this.closeLaunchModal() return @@ -264,10 +264,13 @@ module.exports = React.createClass({ return } + // LaunchModal if ((e.keyCode === 13 && e.metaKey)) { e.preventDefault() this.openLaunchModal() } + + // Focus(blur) search input var searchInput = React.findDOMNode(this).querySelector('.PlanetHeader .searchInput input') if (document.activeElement === searchInput) { @@ -287,6 +290,7 @@ module.exports = React.createClass({ return } + // Article indexing if (document.activeElement !== searchInput) { switch (e.keyCode) { case 38: @@ -302,6 +306,7 @@ module.exports = React.createClass({ break } + // Other hotkeys switch (e.keyCode) { case 65: e.preventDefault() diff --git a/browser/main/Containers/UserSettingContainer.jsx b/browser/main/Containers/UserSettingContainer.jsx index fde4dcd0..3ce23269 100644 --- a/browser/main/Containers/UserSettingContainer.jsx +++ b/browser/main/Containers/UserSettingContainer.jsx @@ -1,13 +1,51 @@ var React = require('react/addons') var ReactRouter = require('react-router') +var ModalBase = require('../Components/ModalBase') + var AuthActions = require('../Actions/AuthActions') -var currentUser = { - name: 'testcat', - email: 'testcat@example.com', - profileName: 'Test Cat' -} +var AuthStore = require('../Stores/AuthStore') + +var LogOutModal = React.createClass({ + propTypes: { + close: React.PropTypes.func + }, + componentDidMount: function () { + React.findDOMNode(this.refs.cancel).focus() + }, + submit: function () { + AuthActions.logout() + }, + handleKeyDown: function (e) { + if (e.keyCode === 13 && e.metaKey) { + this.submit() + return + } + if (e.keyCode === 27) { + this.props.close() + return + } + }, + render: function () { + return ( +
+
+

Logout

+
+
+

Are you sure to log out?

+
+
+
+ + +
+
+
+ ) + } +}) var UserSettingNavigation = React.createClass({ propTypes: { @@ -17,13 +55,21 @@ var UserSettingNavigation = React.createClass({ current: React.PropTypes.string, changeCurrent: React.PropTypes.func }, + getInitialState: function () { + return { + isLogOutModalOpen: false + } + }, changeFactory: function (current) { return function () { this.props.changeCurrent(current) }.bind(this) }, - logOut: function () { - AuthActions.logout() + openLogOutModal: function () { + this.setState({isLogOutModalOpen: true}) + }, + closeLogOutModal: function () { + this.setState({isLogOutModalOpen: false}) }, render: function () { return ( @@ -34,8 +80,11 @@ var UserSettingNavigation = React.createClass({ Setting Integration Help - Logout + Logout + + +
) } @@ -112,6 +161,8 @@ module.exports = React.createClass({ }) }, render: function () { + var currentUser = AuthStore.getUser() + return (
diff --git a/browser/styles/main/containers/PlanetContainer.styl b/browser/styles/main/containers/PlanetContainer.styl index 9ade02d6..2acd7629 100644 --- a/browser/styles/main/containers/PlanetContainer.styl +++ b/browser/styles/main/containers/PlanetContainer.styl @@ -20,86 +20,81 @@ box-sizing border-box padding 5px 15px clearfix() - .planetName - line-height 30px - font-size 2em - color brandColor - line-height 55px - padding 0 20px - .menuBtn + .headerLabel + absolute top left bottom + overflow hidden display inline-block - position relative - top -5px - font-size 0.8em - color lightButtonColor - border solid 1px lightButtonColor - box-sizing border-box - circle() - background-image none - background-color transparent - width 30px - height 30px - text-align center - cursor pointer - transition 0.1s - transform scale(0.8) - &:focus, &.focus - outline none - &:hover, &.hover, &:focus, &.focus - border-color darken(lightButtonColor, 50%) - color darken(lightButtonColor, 50%) - &:active, &.active - border-color darken(brandBorderColor, 10%) - background-color brandColor - color white - .searchInput - display inline-block - position relative - top -3px - margin-left 15px - input - padding-left 32px - .fa - position absolute - top 7px - left 10px - .downloadButtton - position relative - float right - top 5px - padding 7px 25px - box-sizing border-box - line-height 30px - font-size 1em - border-radius 22px - .dropDown - z-index 500 - position fixed - background white width 200px - border solid 1px borderColor - box-sizing border-box - margin-top -5px - margin-left 125px - box-shadow popupShadow - &.hide - visibility hidden - a - color textColor - display block - width 100% - padding 15px + .userName + position absolute + left 15px + top 5px + font-size 1.2em + color brandColor + .divider + position absolute + top 25px + left 15px + font-size 2em + .planetName + position absolute + top 28px + left 30px + width 130px + font-size 1.5em + color brandColor + overflow-x hidden + text-overflow ellipsis + white-space nowrap + .menuBtn + position absolute + top 10px + right 0 + font-size 1em + color lightButtonColor + border none box-sizing border-box - border-bottom solid 1px borderColor - text-decoration none - &:hover, &.hover - background-color hoverBackgroundColor + circle() + background-image none + background-color transparent + width 44px + height 44px + text-align center + cursor pointer + transition 0.1s + transform scale(0.8) &:focus, &.focus - color black + outline none + &:hover, &.hover, &:focus, &.focus + border-color darken(lightButtonColor, 50%) + color darken(lightButtonColor, 50%) &:active, &.active - color brandColor - &:last-child - border-bottom none + border-color darken(brandBorderColor, 10%) + background-color brandColor + color white + .headerControl + absolute top bottom right + left 200px + .searchInput + display block + position absolute + top 14px + left 0 + input + padding-left 32px + .fa + position absolute + top 8px + left 12px + .downloadButtton + position absolute + right 5px + top 10px + padding 7px 25px + box-sizing border-box + line-height 25px + font-size 1em + border-radius 22px .PlanetNavigator absolute bottom left