- </ul>
- )}
- </>
- )}
- <button
- className="navbar-toggler border-0 p-1"
- type="button"
- aria-label="menu"
- onClick={linkEvent(this, this.handleToggleExpandNavbar)}
- data-tippy-content={i18n.t("expand_here")}
- >
- <Icon icon="menu" />
- </button>
- <div
- className={`${!this.state.expanded && "collapse"} navbar-collapse`}
- >
- <ul className="navbar-nav my-2 mr-auto">
- <li className="nav-item">
- <NavLink
- to="/communities"
- className="nav-link"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("communities")}
- >
- {i18n.t("communities")}
- </NavLink>
- </li>
- <li className="nav-item">
- {/* TODO make sure this works: https://github.com/infernojs/inferno/issues/1608 */}
- <NavLink
- to={{
- pathname: "/create_post",
- search: "",
- hash: "",
- key: "",
- state: { prevPath: this.currentLocation },
- }}
- className="nav-link"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("create_post")}
- >
- {i18n.t("create_post")}
- </NavLink>
- </li>
- {canCreateCommunity(this.props.siteRes) && (
- <li className="nav-item">
- <NavLink
- to="/create_community"
- className="nav-link"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("create_community")}
- >
- {i18n.t("create_community")}
- </NavLink>
- </li>
- )}
- <li className="nav-item">
- <a
- className="nav-link"
- title={i18n.t("support_lemmy")}
- href={donateLemmyUrl}
- >
- <Icon icon="heart" classes="small" />
- </a>
- </li>
- </ul>
- <ul className="navbar-nav my-2">
- {amAdmin() && (
- <li className="nav-item">
- <NavLink
- to="/admin"
- className="nav-link"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("admin_settings")}
- >
- <Icon icon="settings" />
- </NavLink>
- </li>
- )}
- </ul>
- {!this.context.router.history.location.pathname.match(
- /^\/search/
- ) && (
- <ul className="navbar-nav">
- <li className="nav-item">
- <NavLink
- to="/search"
- className="nav-link"
- title={i18n.t("search")}
- >
- <Icon icon="search" />
- </NavLink>
- </li>
- </ul>
- )}
- {UserService.Instance.myUserInfo ? (
- <>
- <ul className="navbar-nav my-2">
- <li className="nav-item">
- <NavLink
- className="nav-link"
- to="/inbox"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("unread_messages", {
- count: Number(this.state.unreadInboxCount),
- formattedCount: numToSI(this.state.unreadInboxCount),
- })}
- >
- <Icon icon="bell" />
- {this.state.unreadInboxCount > 0 && (
- <span className="ml-1 badge badge-light">
- {numToSI(this.state.unreadInboxCount)}
- </span>
- )}
- </NavLink>
- </li>
- </ul>
- {this.moderatesSomething && (
- <ul className="navbar-nav my-2">
- <li className="nav-item">
- <NavLink
- className="nav-link"
- to="/reports"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("unread_reports", {
- count: Number(this.state.unreadReportCount),
- formattedCount: numToSI(this.state.unreadReportCount),
- })}
- >
- <Icon icon="shield" />
- {this.state.unreadReportCount > 0 && (
- <span className="ml-1 badge badge-light">
- {numToSI(this.state.unreadReportCount)}
- </span>
- )}
- </NavLink>
- </li>
- </ul>
- )}
- {amAdmin() && (
- <ul className="navbar-nav my-2">
- <li className="nav-item">
- <NavLink
- to="/registration_applications"
- className="nav-link"
- onMouseUp={linkEvent(this, this.handleHideExpandNavbar)}
- title={i18n.t("unread_registration_applications", {
- count: Number(this.state.unreadApplicationCount),
- formattedCount: numToSI(
- this.state.unreadApplicationCount
- ),
- })}
- >
- <Icon icon="clipboard" />
- {this.state.unreadApplicationCount > 0 && (
- <span className="mx-1 badge badge-light">
- {numToSI(this.state.unreadApplicationCount)}
- </span>
- )}
- </NavLink>
- </li>
- </ul>