Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support User: Highlight Masterbar when active #2975

Merged
merged 4 commits into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ Layout = React.createClass( {
<MasterbarLoggedIn
user={ this.props.user }
section={ this.props.section }
sites={ this.props.sites } />
sites={ this.props.sites }
isSupportUser={ config.isEnabled( 'support-user' ) && this.props.isSupportUser } />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't pass this as a prop. I'd set a class on layout and use that as .layout .masterbar {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the is-support-user class in 3fabde3

);
},

Expand Down Expand Up @@ -143,8 +144,10 @@ Layout = React.createClass( {
export default connect(
( state ) => {
const { isLoading, section, hasSidebar, chunkName } = state.ui;
const isSupportUser = state.support.isSupportUser;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this here, it should probably be a selector: isSupportUser( state )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - see 6d1ee3f

return {
isLoading,
isSupportUser,
section,
hasSidebar,
chunkName,
Expand Down
2 changes: 1 addition & 1 deletion client/layout/masterbar/logged-in.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default React.createClass( {

render() {
return (
<Masterbar>
<Masterbar className={ this.props.isSupportUser ? 'masterbar__support-user' : null }>
<Stats
icon={ this.wordpressIcon() }
onClick={ this.clickMySites }
Expand Down
5 changes: 3 additions & 2 deletions client/layout/masterbar/masterbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* External dependencies
*/
import React from 'react';
import classNames from 'classnames';

const Masterbar = ( { children } ) => (
<header id="header" className="masterbar">
const Masterbar = ( { children, className } ) => (
<header id="header" className={ classNames( 'masterbar', className ) }>
{ children }
</header>
);
Expand Down
8 changes: 8 additions & 0 deletions client/layout/masterbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ $autobar-height: 20px;
}
}

.masterbar__support-user {
background-color: $orange-jazzy;

.masterbar__item.is-active {
background-color: darken( $orange-jazzy, 10% );
}
}

@keyframes bubble-unread-indication {
30% {
transform: scale(1.5);
Expand Down
11 changes: 11 additions & 0 deletions client/state/support/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import {
SUPPORT_USER_RESTORE,
} from 'state/action-types';

export function isSupportUser( state = false, action ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a selector instead?

switch ( action.type ) {
case SUPPORT_USER_TOKEN_SET:
return !! ( action.supportUser && action.supportToken );
case SUPPORT_USER_RESTORE:
return false;
}
return state;
}

export function supportUser( state = '', action ) {
switch ( action.type ) {
case SUPPORT_USER_TOKEN_SET:
Expand All @@ -30,6 +40,7 @@ export function supportToken( state = '', action ) {
}

export default combineReducers( {
isSupportUser,
supportUser,
supportToken,
} );