fix(client): clean up nav menu (#40864)
This commit is contained in:
@ -1,23 +1,16 @@
|
|||||||
/* eslint-disable react/sort-prop-types */
|
/* eslint-disable react/sort-prop-types */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import { Link, borderColorPicker, AvatarRenderer } from '../../helpers';
|
||||||
Link,
|
|
||||||
borderColorPicker,
|
|
||||||
SkeletonSprite,
|
|
||||||
AvatarRenderer
|
|
||||||
} from '../../helpers';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import Login from '../components/Login';
|
import Login from '../components/Login';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
pending: PropTypes.bool,
|
|
||||||
pathName: PropTypes.string.isRequired,
|
|
||||||
user: PropTypes.object
|
user: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export function AuthOrProfile({ user, pathName, pending }) {
|
export function AuthOrProfile({ user }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const isUserDonating = user && user.isDonating;
|
const isUserDonating = user && user.isDonating;
|
||||||
const isUserSignedIn = user && user.username;
|
const isUserSignedIn = user && user.username;
|
||||||
@ -26,13 +19,7 @@ export function AuthOrProfile({ user, pathName, pending }) {
|
|||||||
|
|
||||||
const badgeColorClass = borderColorPicker(isUserDonating, isTopContributor);
|
const badgeColorClass = borderColorPicker(isUserDonating, isTopContributor);
|
||||||
|
|
||||||
if (pending && pathName !== '/') {
|
if (!isUserSignedIn) {
|
||||||
return (
|
|
||||||
<div className='nav-skeleton'>
|
|
||||||
<SkeletonSprite />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
} else if (pathName === '/' || !isUserSignedIn) {
|
|
||||||
return (
|
return (
|
||||||
<Login data-test-label='landing-small-cta'>{t('buttons.sign-in')}</Login>
|
<Login data-test-label='landing-small-cta'>{t('buttons.sign-in')}</Login>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user