Skip to content
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

Added ava-analytics link to navbar #167

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions src/components/MainView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { isAdmin } from "../utils/SecurityUtils";
import Messages from "./message/Messages";
import Footer from "../Footer";
import PropTypes from "prop-types";
import { ANALYTICS_URL } from "../../config/index.js";

class MainView extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -61,6 +62,26 @@ class MainView extends React.Component {
}
}

_renderStatisticsNavLink(path) {
return (
<>
{ANALYTICS_URL === "" ? (
<NavLink
className="nav-link"
isActive={() => path.startsWith(Routes.statistics.path)}
to={Routes.statistics.path}
>
{this.i18n("statistics.panel-title")}
</NavLink>
) : (
<Nav.Link className="nav-link" href={ANALYTICS_URL}>
{this.i18n("statistics.panel-title")}
</Nav.Link>
)}
</>
);
}

render() {
if (this.props.status === ACTION_STATUS.PENDING) {
return <LoaderMask />;
Expand Down Expand Up @@ -120,15 +141,7 @@ class MainView extends React.Component {
</NavItem>
</IfGranted>
<IfGranted expected={ROLE.ADMIN} actual={user.role}>
<NavItem>
<NavLink
className="nav-link"
isActive={() => path.startsWith(Routes.statistics.path)}
to={Routes.statistics.path}
>
{this.i18n("statistics.panel-title")}
</NavLink>
</NavItem>
<NavItem>{this._renderStatisticsNavLink(path)}</NavItem>
</IfGranted>
<IfGranted expected={ROLE.ADMIN} actual={user.role}>
<NavItem>
Expand Down
Loading