fix: use forumLocation everywhere (#39405)

* fix: use forumLocation everywhere
This commit is contained in:
Oliver Eyton-Williams
2020-08-14 11:56:14 +02:00
committed by GitHub
parent 42686db303
commit 5409e1e62e
4 changed files with 9 additions and 9 deletions

View File

@ -5,6 +5,8 @@ import TestRenderer from 'react-test-renderer';
import { UniversalNav } from './components/UniversalNav'; import { UniversalNav } from './components/UniversalNav';
import NavLinks from './components/NavLinks'; import NavLinks from './components/NavLinks';
import { forumLocation } from '../../../config/env.json';
describe('<UniversalNav />', () => { describe('<UniversalNav />', () => {
it('renders to the DOM', () => { it('renders to the DOM', () => {
const shallow = new ShallowRenderer(); const shallow = new ShallowRenderer();
@ -23,7 +25,7 @@ describe('<NavLinks />', () => {
return acc; return acc;
}, []); }, []);
const expectedLinks = ['/learn', '/news', 'https://forum.freecodecamp.org']; const expectedLinks = ['/learn', '/news', forumLocation];
it('renders to the DOM', () => { it('renders to the DOM', () => {
expect(root).toBeTruthy(); expect(root).toBeTruthy();

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { Link } from '../../helpers'; import { Link } from '../../helpers';
import { forumLocation } from '../../../../../config/env.json';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -17,11 +18,7 @@ function NavLinks({ displayMenu }) {
</Link> </Link>
</li> </li>
<li className='nav-forum'> <li className='nav-forum'>
<Link <Link external={true} sameTab={true} to={forumLocation}>
external={true}
sameTab={true}
to='https://forum.freecodecamp.org'
>
/forum /forum
</Link> </Link>
</li> </li>

View File

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Link, Spacer, Loader, FullWidthRow } from '../helpers'; import { Link, Spacer, Loader, FullWidthRow } from '../helpers';
import { Row, Col } from '@freecodecamp/react-bootstrap'; import { Row, Col } from '@freecodecamp/react-bootstrap';
import { apiLocation } from '../../../config/env.json'; import { apiLocation, forumLocation } from '../../../config/env.json';
import { randomQuote } from '../../utils/get-words'; import { randomQuote } from '../../utils/get-words';
import CurrentChallengeLink from '../helpers/CurrentChallengeLink'; import CurrentChallengeLink from '../helpers/CurrentChallengeLink';
@ -153,7 +153,7 @@ function Intro({
</p> </p>
<p> <p>
You can do this on Twitter and GitHub, and also on{' '} You can do this on Twitter and GitHub, and also on{' '}
<Link className='inline' to='/forum'> <Link className='inline' to={forumLocation}>
the freeCodeCamp forum the freeCodeCamp forum
</Link> </Link>
. .

View File

@ -6,6 +6,7 @@ import { Button, Modal } from '@freecodecamp/react-bootstrap';
import { createQuestion, closeModal, isHelpModalOpenSelector } from '../redux'; import { createQuestion, closeModal, isHelpModalOpenSelector } from '../redux';
import { executeGA } from '../../../redux'; import { executeGA } from '../../../redux';
import { forumLocation } from '../../../../config/env.json';
import './help-modal.css'; import './help-modal.css';
@ -23,7 +24,7 @@ const propTypes = {
isOpen: PropTypes.bool isOpen: PropTypes.bool
}; };
const RSA = 'https://forum.freecodecamp.org/t/19514'; const RSA = forumLocation + '/t/19514';
export class HelpModal extends Component { export class HelpModal extends Component {
render() { render() {