TabsBar: display counters only on profile pages where they're needed
This commit is contained in:
parent
65b7bc6ad0
commit
001aae849b
|
@ -53,9 +53,19 @@ class TabsBar extends React.PureComponent {
|
||||||
return pathname === '/' || pathname.startsWith('/timeline/');
|
return pathname === '/' || pathname.startsWith('/timeline/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onProfilePage = () => {
|
||||||
|
try {
|
||||||
|
const { pathname } = this.context.router.route.location;
|
||||||
|
return pathname.startsWith('/@') && !pathname.includes('/posts/');
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, account, logo, onOpenCompose, onOpenSidebar, features, dashboardCount, notificationCount, chatsCount } = this.props;
|
const { intl, account, logo, onOpenCompose, onOpenSidebar, features, dashboardCount, notificationCount, chatsCount } = this.props;
|
||||||
const { collapsed } = this.state;
|
const { collapsed } = this.state;
|
||||||
|
const profilePage = this.onProfilePage();
|
||||||
|
|
||||||
const classes = classNames('tabs-bar', {
|
const classes = classNames('tabs-bar', {
|
||||||
'tabs-bar--collapsed': collapsed,
|
'tabs-bar--collapsed': collapsed,
|
||||||
|
@ -83,6 +93,8 @@ class TabsBar extends React.PureComponent {
|
||||||
</div>
|
</div>
|
||||||
<div className='tabs-bar__split tabs-bar__split--right'>
|
<div className='tabs-bar__split tabs-bar__split--right'>
|
||||||
{account ? (
|
{account ? (
|
||||||
|
<>
|
||||||
|
{profilePage && (
|
||||||
<>
|
<>
|
||||||
<NavLink key='notifications' className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications'>
|
<NavLink key='notifications' className='tabs-bar__link' to='/notifications' data-preview-title-id='column.notifications'>
|
||||||
<IconWithCounter
|
<IconWithCounter
|
||||||
|
@ -117,6 +129,8 @@ class TabsBar extends React.PureComponent {
|
||||||
<span><FormattedMessage id='tabs_bar.dashboard' defaultMessage='Dashboard' /></span>
|
<span><FormattedMessage id='tabs_bar.dashboard' defaultMessage='Dashboard' /></span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
<div className='tabs-bar__profile'>
|
<div className='tabs-bar__profile'>
|
||||||
|
|
Loading…
Reference in New Issue