-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Changes from 1 commit
adea312
6d1ee3f
3fabde3
95cec5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 } /> | ||
); | ||
}, | ||
|
||
|
@@ -143,8 +144,10 @@ Layout = React.createClass( { | |
export default connect( | ||
( state ) => { | ||
const { isLoading, section, hasSidebar, chunkName } = state.ui; | ||
const isSupportUser = state.support.isSupportUser; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at this here, it should probably be a selector: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done - see 6d1ee3f |
||
return { | ||
isLoading, | ||
isSupportUser, | ||
section, | ||
hasSidebar, | ||
chunkName, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,16 @@ import { | |
SUPPORT_USER_RESTORE, | ||
} from 'state/action-types'; | ||
|
||
export function isSupportUser( state = false, action ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
@@ -30,6 +40,7 @@ export function supportToken( state = '', action ) { | |
} | ||
|
||
export default combineReducers( { | ||
isSupportUser, | ||
supportUser, | ||
supportToken, | ||
} ); |
There was a problem hiding this comment.
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 {}
There was a problem hiding this comment.
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