Fixes NavLink highlighting

This commit is contained in:
Philipp Czora
2018-10-09 11:53:06 +02:00
parent 6475320e61
commit f95ffe25f3
2 changed files with 16 additions and 2 deletions

View File

@@ -70,6 +70,12 @@ class RepositoryRoot extends React.Component<Props> {
this.props.deleteRepo(repository, this.deleted);
};
matches = (route: any) => {
const url = this.matchedUrl();
const regex = new RegExp(`${url}/?[a-zA-Z0-9_%]*/changesets?.*`);
return route.location.pathname.match(regex);
};
render() {
const { loading, error, repository, t } = this.props;
@@ -131,6 +137,7 @@ class RepositoryRoot extends React.Component<Props> {
activeOnlyWhenExact={false}
to={`${url}/changesets`}
label={t("repository-root.history")}
activeWhenMatch={this.matches}
/>
<EditNavLink repository={repository} editUrl={`${url}/edit`} />
</Section>