chore(client) remove contextual navigation (#41919)

This commit is contained in:
Sem Bauke
2021-04-28 15:10:43 +02:00
committed by GitHub
parent a0463d2c99
commit 20cbfce484
9 changed files with 13 additions and 93 deletions

View File

@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { Grid, Button } from '@freecodecamp/react-bootstrap'; import { Grid } from '@freecodecamp/react-bootstrap';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import envData from '../../../config/env.json'; import envData from '../../../config/env.json';
@ -16,7 +16,7 @@ import { submitNewAbout, updateUserFlag, verifyCert } from '../redux/settings';
import { createFlashMessage } from '../components/Flash/redux'; import { createFlashMessage } from '../components/Flash/redux';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FullWidthRow, Loader, Spacer } from '../components/helpers'; import { Loader, Spacer } from '../components/helpers';
import About from '../components/settings/About'; import About from '../components/settings/About';
import Privacy from '../components/settings/Privacy'; import Privacy from '../components/settings/Privacy';
import Email from '../components/settings/Email'; import Email from '../components/settings/Email';
@ -132,18 +132,6 @@ export function ShowSettings(props) {
<Grid> <Grid>
<main> <main>
<Spacer size={2} /> <Spacer size={2} />
<FullWidthRow>
<Button
block={true}
bsSize='lg'
bsStyle='primary'
className='btn-invert'
href={`${apiLocation}/signout`}
>
{t('buttons.sign-me-out')}
</Button>
</FullWidthRow>
<Spacer />
<h1 className='text-center' style={{ overflowWrap: 'break-word' }}> <h1 className='text-center' style={{ overflowWrap: 'break-word' }}>
{t('settings.for', { username: username })} {t('settings.for', { username: username })}
</h1> </h1>

View File

@ -48,9 +48,6 @@ function Intro({
</h1> </h1>
<Spacer /> <Spacer />
<FullWidthRow> <FullWidthRow>
<Link className='btn btn-lg btn-primary btn-block' to='/settings'>
{t('buttons.update-settings')}
</Link>
{completedChallengeCount > 0 ? ( {completedChallengeCount > 0 ? (
<CurrentChallengeLink isLargeBtn={true}> <CurrentChallengeLink isLargeBtn={true}>
{t('buttons.current-challenge')} {t('buttons.current-challenge')}

View File

@ -1,6 +1,6 @@
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Grid, Row, Button } from '@freecodecamp/react-bootstrap'; import { Grid, Row } from '@freecodecamp/react-bootstrap';
import Helmet from 'react-helmet'; import Helmet from 'react-helmet';
import Link from '../helpers/Link'; import Link from '../helpers/Link';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -11,9 +11,6 @@ import HeatMap from './components/HeatMap';
import Certifications from './components/Certifications'; import Certifications from './components/Certifications';
import Portfolio from './components/Portfolio'; import Portfolio from './components/Portfolio';
import Timeline from './components/TimeLine'; import Timeline from './components/TimeLine';
import envData from '../../../../config/env.json';
const { apiLocation } = envData;
const propTypes = { const propTypes = {
isSessionUser: PropTypes.bool, isSessionUser: PropTypes.bool,
@ -166,22 +163,6 @@ function Profile({ user, isSessionUser }) {
</Helmet> </Helmet>
<Spacer /> <Spacer />
<Grid> <Grid>
{isSessionUser ? (
<FullWidthRow className='button-group'>
<Link className='btn btn-lg btn-primary btn-block' to='/settings'>
{t('buttons.update-settings')}
</Link>
<Button
block={true}
bsSize='lg'
bsStyle='primary'
className='btn-invert'
href={`${apiLocation}/signout`}
>
{t('buttons.sign-me-out')}
</Button>
</FullWidthRow>
) : null}
<Spacer /> <Spacer />
{isLocked ? renderMessage(isSessionUser, username, t) : null} {isLocked ? renderMessage(isSessionUser, username, t) : null}
{!isLocked || isSessionUser ? renderProfile(user) : null} {!isLocked || isSessionUser ? renderProfile(user) : null}

View File

@ -47,26 +47,12 @@ const userProps = {
navigate: () => {} navigate: () => {}
}; };
const myProfileProps = {
isSessionUser: true,
...userProps
};
const notMyProfileProps = { const notMyProfileProps = {
isSessionUser: false, isSessionUser: false,
...userProps ...userProps
}; };
describe('<Profile/>', () => { describe('<Profile/>', () => {
it('renders the settings button on your own profile', () => {
const { getByText } = render(<Profile {...myProfileProps} />);
expect(getByText('buttons.update-settings')).toHaveAttribute(
'href',
'/settings'
);
});
it('renders the report button on another persons profile', () => { it('renders the report button on another persons profile', () => {
const { getByText } = render(<Profile {...notMyProfileProps} />); const { getByText } = render(<Profile {...notMyProfileProps} />);

View File

@ -3,9 +3,8 @@
describe('A certification,', function () { describe('A certification,', function () {
describe('while viewing your own,', function () { describe('while viewing your own,', function () {
before(() => { before(() => {
cy.visit('/'); cy.login();
cy.contains("Get started (it's free)").click({ force: true }); cy.visit('/settings');
cy.contains('Update my account settings').click({ force: true });
// set user settings to public to claim a cert // set user settings to public to claim a cert
cy.get('label:contains(Public)>input').each(el => { cy.get('label:contains(Public)>input').each(el => {
@ -81,7 +80,8 @@ describe('A certification,', function () {
describe("while viewing someone else's,", function () { describe("while viewing someone else's,", function () {
before(() => { before(() => {
cy.go('back'); cy.go('back');
cy.contains('Sign me out of freeCodeCamp').click({ force: true }); cy.get('.toggle-button-nav').click();
cy.get('.nav-list').contains('Sign out').click();
cy.visit('/certification/developmentuser/legacy-front-end'); cy.visit('/certification/developmentuser/legacy-front-end');
}); });

View File

@ -89,7 +89,6 @@ describe('Navbar', () => {
it('Should have `Profile` link when user is signed in', () => { it('Should have `Profile` link when user is signed in', () => {
cy.login(); cy.login();
cy.get('a[href*="/settings"]').should('be.visible');
cy.get(selectors.menuButton).click(); cy.get(selectors.menuButton).click();
cy.get(selectors.navigationLinks).contains('Profile').click(); cy.get(selectors.navigationLinks).contains('Profile').click();
cy.url().should('include', '/developmentuser'); cy.url().should('include', '/developmentuser');

View File

@ -1,12 +0,0 @@
/* global cy */
describe('The `Update my account settings` button works properly', function () {
beforeEach(() => {
cy.login();
});
it('Should take user to their account settings when clicked', function () {
cy.contains('Update my account settings').click();
cy.url().should('include', '/settings');
});
});

View File

@ -5,9 +5,8 @@ import '@testing-library/cypress/add-commands';
describe('Settings certifications area', () => { describe('Settings certifications area', () => {
before(() => { before(() => {
cy.exec('npm run seed'); cy.exec('npm run seed');
cy.visit('/'); cy.login();
cy.contains("Get started (it's free)").click({ force: true }); cy.visit('/settings');
cy.contains('Update my account settings').click({ force: true });
}); });
describe('initially', () => { describe('initially', () => {
@ -37,8 +36,8 @@ describe('Settings certifications area', () => {
describe('after isHonest', () => { describe('after isHonest', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/'); cy.visit('/');
cy.contains("Get started (it's free)").click({ force: true }); cy.login();
cy.contains('Update my account settings').click({ force: true }); cy.visit('/settings');
}); });
it('Should render "You have accepted our Academic Honesty Policy." button after clicking "Agree"', () => { it('Should render "You have accepted our Academic Honesty Policy." button after clicking "Agree"', () => {

View File

@ -1,26 +1,8 @@
/* global cy expect */ /* global cy */
describe('Settings', () => { describe('Settings', () => {
beforeEach(() => { it('should be possible to visit the settings page', () => {
cy.visit('/'); cy.visit('/');
cy.contains("Get started (it's free)").click({ force: true }); cy.contains("Get started (it's free)").click({ force: true });
cy.visit('/settings'); cy.visit('/settings');
}); });
describe('The `Sign me out of freeCodeCamp` button works properly', () => {
it('Should get rendered properly', () => {
cy.contains('Sign me out of freeCodeCamp')
.should('be.visible')
// We are checking for classes here to check for proper styling
// This will be replaces with Percy in the future
.should('have.class', 'btn-invert btn btn-lg btn-primary btn-block');
});
it('Should take to the landing page when clicked', () => {
cy.contains('Sign me out of freeCodeCamp').click({ force: true });
cy.location().should(loc => {
expect(loc.pathname).to.eq('/');
});
});
});
}); });