Fix “Toots” tab highlighting for replies and media timelines (#8715)

master
ThibG 6 years ago committed by Eugen Rochko
parent 9b32898e3c
commit f8b54d229f
  1. 9
      app/javascript/mastodon/features/account/components/action_bar.js
  2. 2
      app/views/accounts/_header.html.haml

@ -60,6 +60,13 @@ class ActionBar extends React.PureComponent {
}); });
} }
isStatusesPageActive = (match, location) => {
if (!match) {
return false;
}
return !location.pathname.match(/\/(followers|following)\/?$/);
}
render () { render () {
const { account, intl } = this.props; const { account, intl } = this.props;
@ -147,7 +154,7 @@ class ActionBar extends React.PureComponent {
<div className='account__action-bar'> <div className='account__action-bar'>
<div className='account__action-bar-links'> <div className='account__action-bar-links'>
<NavLink exact activeClassName='active' className='account__action-bar__tab' to={`/accounts/${account.get('id')}`} title={intl.formatNumber(account.get('statuses_count'))}> <NavLink isActive={this.isStatusesPageActive} activeClassName='active' className='account__action-bar__tab' to={`/accounts/${account.get('id')}`} title={intl.formatNumber(account.get('statuses_count'))}>
<FormattedMessage id='account.posts' defaultMessage='Toots' /> <FormattedMessage id='account.posts' defaultMessage='Toots' />
<strong>{shortNumberFormat(account.get('statuses_count'))}</strong> <strong>{shortNumberFormat(account.get('statuses_count'))}</strong>
</NavLink> </NavLink>

@ -16,7 +16,7 @@
= fa_icon('lock') if account.locked? = fa_icon('lock') if account.locked?
.public-account-header__tabs__tabs .public-account-header__tabs__tabs
.details-counters .details-counters
.counter{ class: active_nav_class(short_account_url(account)) } .counter{ class: active_nav_class(short_account_url(account)) + active_nav_class(short_account_with_replies_url(account)) + active_nav_class(short_account_media_url(account)) }
= link_to short_account_url(account), class: 'u-url u-uid', title: number_with_delimiter(account.statuses_count) do = link_to short_account_url(account), class: 'u-url u-uid', title: number_with_delimiter(account.statuses_count) do
%span.counter-number= number_to_human account.statuses_count, strip_insignificant_zeros: true %span.counter-number= number_to_human account.statuses_count, strip_insignificant_zeros: true
%span.counter-label= t('accounts.posts', count: account.statuses_count) %span.counter-label= t('accounts.posts', count: account.statuses_count)

Loading…
Cancel
Save