make header user icon reflect comment identity
This commit is contained in:
parent
3c448d3d27
commit
ed61ac44bf
2 changed files with 14 additions and 3 deletions
|
@ -7,6 +7,7 @@ import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import { doSignOut, doOpenModal } from 'redux/actions/app';
|
import { doSignOut, doOpenModal } from 'redux/actions/app';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
|
import { selectCommentChannel } from 'redux/selectors/comments';
|
||||||
import Header from './view';
|
import Header from './view';
|
||||||
import { selectHasNavigated } from 'redux/selectors/app';
|
import { selectHasNavigated } from 'redux/selectors/app';
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ const select = state => ({
|
||||||
hasNavigated: selectHasNavigated(state),
|
hasNavigated: selectHasNavigated(state),
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
myChannels: selectMyChannelClaims(state),
|
myChannels: selectMyChannelClaims(state),
|
||||||
|
commentChannel: selectCommentChannel(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -61,6 +61,7 @@ type Props = {
|
||||||
isAbsoluteSideNavHidden: boolean,
|
isAbsoluteSideNavHidden: boolean,
|
||||||
hideCancel: boolean,
|
hideCancel: boolean,
|
||||||
myChannels: ?Array<ChannelClaim>,
|
myChannels: ?Array<ChannelClaim>,
|
||||||
|
commentChannel: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Header = (props: Props) => {
|
const Header = (props: Props) => {
|
||||||
|
@ -87,6 +88,7 @@ const Header = (props: Props) => {
|
||||||
user,
|
user,
|
||||||
hideCancel,
|
hideCancel,
|
||||||
myChannels,
|
myChannels,
|
||||||
|
commentChannel,
|
||||||
} = props;
|
} = props;
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
// on the verify page don't let anyone escape other than by closing the tab to keep session data consistent
|
// on the verify page don't let anyone escape other than by closing the tab to keep session data consistent
|
||||||
|
@ -98,9 +100,16 @@ const Header = (props: Props) => {
|
||||||
const { backLabel, backNavDefault, title: backTitle, simpleTitle: simpleBackTitle } = backout || {};
|
const { backLabel, backNavDefault, title: backTitle, simpleTitle: simpleBackTitle } = backout || {};
|
||||||
const notificationsEnabled = user && user.experimental_ui;
|
const notificationsEnabled = user && user.experimental_ui;
|
||||||
let channelUrl;
|
let channelUrl;
|
||||||
if (myChannels && myChannels.length === 1) {
|
let identityChannel;
|
||||||
const channel = myChannels[0];
|
if (myChannels && myChannels.length > 1) {
|
||||||
channelUrl = channel.permanent_url || channel.canonical_url;
|
if (myChannels.length === 1) {
|
||||||
|
identityChannel = myChannels[0];
|
||||||
|
} else if (commentChannel) {
|
||||||
|
identityChannel = myChannels.find(chan => chan.name === commentChannel);
|
||||||
|
} else {
|
||||||
|
identityChannel = myChannels[0];
|
||||||
|
}
|
||||||
|
channelUrl = identityChannel && (identityChannel.permanent_url || identityChannel.canonical_url);
|
||||||
}
|
}
|
||||||
// Sign out if they click the "x" when they are on the password prompt
|
// Sign out if they click the "x" when they are on the password prompt
|
||||||
const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' };
|
const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' };
|
||||||
|
|
Loading…
Reference in a new issue