Fixing nav-link

This commit is contained in:
Dessalines 2021-11-15 13:13:36 -05:00
commit b4837add6e
2 changed files with 32 additions and 32 deletions

View file

@ -1,5 +1,5 @@
import { Component } from "inferno"; import { Component } from "inferno";
import { Link } from "inferno-router"; import { NavLink } from "inferno-router";
import { GetSiteResponse } from "lemmy-js-client"; import { GetSiteResponse } from "lemmy-js-client";
import { i18n } from "../../i18next"; import { i18n } from "../../i18next";
import { docsUrl, joinLemmyUrl, repoUrl } from "../../utils"; import { docsUrl, joinLemmyUrl, repoUrl } from "../../utils";
@ -28,15 +28,15 @@ export class Footer extends Component<FooterProps, any> {
<span class="nav-link">BE: {this.props.site.version}</span> <span class="nav-link">BE: {this.props.site.version}</span>
</li> </li>
<li className="nav-item"> <li className="nav-item">
<Link className="nav-link" to="/modlog"> <NavLink className="nav-link" to="/modlog">
{i18n.t("modlog")} {i18n.t("modlog")}
</Link> </NavLink>
</li> </li>
{this.props.site.federated_instances && ( {this.props.site.federated_instances && (
<li class="nav-item"> <li class="nav-item">
<Link className="nav-link" to="/instances"> <NavLink className="nav-link" to="/instances">
{i18n.t("instances")} {i18n.t("instances")}
</Link> </NavLink>
</li> </li>
)} )}
<li class="nav-item"> <li class="nav-item">

View file

@ -1,5 +1,5 @@
import { Component, createRef, linkEvent, RefObject } from "inferno"; import { Component, createRef, linkEvent, RefObject } from "inferno";
import { Link } from "inferno-router"; import { NavLink } from "inferno-router";
import { import {
CommentResponse, CommentResponse,
GetReportCount, GetReportCount,
@ -155,7 +155,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
<nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3"> <nav class="navbar navbar-expand-lg navbar-light shadow-sm p-0 px-3">
<div class="container"> <div class="container">
{this.props.site_res.site_view && ( {this.props.site_res.site_view && (
<Link <NavLink
to="/" to="/"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={ title={
@ -171,13 +171,13 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
/> />
)} )}
{this.props.site_res.site_view.site.name} {this.props.site_res.site_view.site.name}
</Link> </NavLink>
)} )}
{this.state.isLoggedIn && ( {this.state.isLoggedIn && (
<> <>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/inbox" to="/inbox"
className="p-1 navbar-toggler nav-link border-0" className="p-1 navbar-toggler nav-link border-0"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
@ -192,13 +192,13 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
{numToSI(this.state.unreadInboxCount)} {numToSI(this.state.unreadInboxCount)}
</span> </span>
)} )}
</Link> </NavLink>
</li> </li>
</ul> </ul>
{UserService.Instance.myUserInfo?.moderates.length > 0 && ( {UserService.Instance.myUserInfo?.moderates.length > 0 && (
<ul class="navbar-nav ml-1"> <ul class="navbar-nav ml-1">
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/reports" to="/reports"
className="p-1 navbar-toggler nav-link border-0" className="p-1 navbar-toggler nav-link border-0"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
@ -213,7 +213,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
{numToSI(this.state.unreadReportCount)} {numToSI(this.state.unreadReportCount)}
</span> </span>
)} )}
</Link> </NavLink>
</li> </li>
</ul> </ul>
)} )}
@ -233,17 +233,17 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
> >
<ul class="navbar-nav my-2 mr-auto"> <ul class="navbar-nav my-2 mr-auto">
<li class="nav-item"> <li class="nav-item">
<Link <NavLink
to="/communities" to="/communities"
className="nav-link" className="nav-link"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={i18n.t("communities")} title={i18n.t("communities")}
> >
{i18n.t("communities")} {i18n.t("communities")}
</Link> </NavLink>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<Link <NavLink
to={{ to={{
pathname: "/create_post", pathname: "/create_post",
prevPath: this.currentLocation, prevPath: this.currentLocation,
@ -253,18 +253,18 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
title={i18n.t("create_post")} title={i18n.t("create_post")}
> >
{i18n.t("create_post")} {i18n.t("create_post")}
</Link> </NavLink>
</li> </li>
{this.canCreateCommunity && ( {this.canCreateCommunity && (
<li class="nav-item"> <li class="nav-item">
<Link <NavLink
to="/create_community" to="/create_community"
className="nav-link" className="nav-link"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={i18n.t("create_community")} title={i18n.t("create_community")}
> >
{i18n.t("create_community")} {i18n.t("create_community")}
</Link> </NavLink>
</li> </li>
)} )}
<li class="nav-item"> <li class="nav-item">
@ -280,14 +280,14 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
<ul class="navbar-nav my-2"> <ul class="navbar-nav my-2">
{this.canAdmin && ( {this.canAdmin && (
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/admin" to="/admin"
className="nav-link" className="nav-link"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={i18n.t("admin_settings")} title={i18n.t("admin_settings")}
> >
<Icon icon="settings" /> <Icon icon="settings" />
</Link> </NavLink>
</li> </li>
)} )}
</ul> </ul>
@ -328,7 +328,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
<> <>
<ul class="navbar-nav my-2"> <ul class="navbar-nav my-2">
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
className="nav-link" className="nav-link"
to="/inbox" to="/inbox"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
@ -343,13 +343,13 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
{numToSI(this.state.unreadInboxCount)} {numToSI(this.state.unreadInboxCount)}
</span> </span>
)} )}
</Link> </NavLink>
</li> </li>
</ul> </ul>
{UserService.Instance.myUserInfo?.moderates.length > 0 && ( {UserService.Instance.myUserInfo?.moderates.length > 0 && (
<ul class="navbar-nav my-2"> <ul class="navbar-nav my-2">
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
className="nav-link" className="nav-link"
to="/reports" to="/reports"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
@ -364,7 +364,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
{numToSI(this.state.unreadReportCount)} {numToSI(this.state.unreadReportCount)}
</span> </span>
)} )}
</Link> </NavLink>
</li> </li>
</ul> </ul>
)} )}
@ -395,24 +395,24 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
)} )}
> >
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to={`/u/${UserService.Instance.myUserInfo.local_user_view.person.name}`} to={`/u/${UserService.Instance.myUserInfo.local_user_view.person.name}`}
className="nav-link" className="nav-link"
title={i18n.t("profile")} title={i18n.t("profile")}
> >
<Icon icon="user" classes="mr-1" /> <Icon icon="user" classes="mr-1" />
{i18n.t("profile")} {i18n.t("profile")}
</Link> </NavLink>
</li> </li>
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/settings" to="/settings"
className="nav-link" className="nav-link"
title={i18n.t("settings")} title={i18n.t("settings")}
> >
<Icon icon="settings" classes="mr-1" /> <Icon icon="settings" classes="mr-1" />
{i18n.t("settings")} {i18n.t("settings")}
</Link> </NavLink>
</li> </li>
<li> <li>
<hr class="dropdown-divider" /> <hr class="dropdown-divider" />
@ -435,24 +435,24 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
) : ( ) : (
<ul class="navbar-nav my-2"> <ul class="navbar-nav my-2">
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/login" to="/login"
className="nav-link" className="nav-link"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={i18n.t("login")} title={i18n.t("login")}
> >
{i18n.t("login")} {i18n.t("login")}
</Link> </NavLink>
</li> </li>
<li className="nav-item"> <li className="nav-item">
<Link <NavLink
to="/signup" to="/signup"
className="nav-link" className="nav-link"
onMouseUp={linkEvent(this, this.handleHideExpandNavbar)} onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
title={i18n.t("sign_up")} title={i18n.t("sign_up")}
> >
{i18n.t("sign_up")} {i18n.t("sign_up")}
</Link> </NavLink>
</li> </li>
</ul> </ul>
)} )}