From 0a667052b9a8796217e90b9ea04003c997277a6f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 10 Apr 2020 19:32:16 -0500 Subject: [PATCH] Refactor links in tabs bar --- .../features/ui/components/tabs_bar.js | 74 ++++++------------- 1 file changed, 24 insertions(+), 50 deletions(-) diff --git a/app/gabsocial/features/ui/components/tabs_bar.js b/app/gabsocial/features/ui/components/tabs_bar.js index a088b9c8a..2971fba9e 100644 --- a/app/gabsocial/features/ui/components/tabs_bar.js +++ b/app/gabsocial/features/ui/components/tabs_bar.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { NavLink, withRouter } from 'react-router-dom'; +import { Link, NavLink, withRouter } from 'react-router-dom'; import { FormattedMessage, injectIntl } from 'react-intl'; import { throttle } from 'lodash'; import { connect } from 'react-redux'; @@ -57,66 +57,40 @@ class TabsBar extends React.PureComponent { this.window.removeEventListener('scroll', this.handleScroll); } - getPrivateLinks() { - const { intl: { formatMessage }, logo } = this.props; + getNavLinks() { + const { intl: { formatMessage }, logo, account } = this.props; let links = []; if (logo) { links.push( - + ) } links.push( - + - , - - - - - , - // - // - // - // , - - - - , - ); - return links.map((link) => - React.cloneElement(link, { - key: link.props.to, - 'aria-label': formatMessage({ - id: link.props['data-preview-title-id'] - }) - })); - } - - getPublicLinks() { - const { intl: { formatMessage }, logo } = this.props; - let links = []; - if (logo) { + ) + if (account) { links.push( - - - - ); + + + + + ) } links.push( - - - - , - + ); - return links.map((link, i) => React.cloneElement(link, { - key: i, - })) + return links.map((link) => + React.cloneElement(link, { + 'aria-label': formatMessage({ + id: link.props['data-preview-title-id'] + }) + })); } handleScroll = throttle(() => { @@ -152,7 +126,7 @@ class TabsBar extends React.PureComponent {