fix: rollback react-hotkeys and remove buttons
This commit is contained in:
committed by
mrugesh
parent
465f206a9d
commit
cd3ef998a6
6
client/package-lock.json
generated
6
client/package-lock.json
generated
@ -16613,9 +16613,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-hotkeys": {
|
"react-hotkeys": {
|
||||||
"version": "2.0.0-pre9",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-hotkeys/-/react-hotkeys-2.0.0-pre9.tgz",
|
"resolved": "https://registry.npmjs.org/react-hotkeys/-/react-hotkeys-2.0.0.tgz",
|
||||||
"integrity": "sha512-YujzB+kGB5F6rq6/NkNN2t3uSwYfBsC9qWligGKyDe7roMSmzFYO2N88mwSc+9zmHhy/ZrDyB+aqbzVIaK8haw==",
|
"integrity": "sha512-3n3OU8vLX/pfcJrR3xJ1zlww6KS1kEJt0Whxc4FiGV+MJrQ1mYSYI3qS/11d2MJDFm8IhOXMTFQirfu6AVOF6Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"prop-types": "^15.6.1"
|
"prop-types": "^15.6.1"
|
||||||
},
|
},
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"react-final-form": "^6.3.0",
|
"react-final-form": "^6.3.0",
|
||||||
"react-ga": "^2.6.0",
|
"react-ga": "^2.6.0",
|
||||||
"react-helmet": "^5.2.1",
|
"react-helmet": "^5.2.1",
|
||||||
"react-hotkeys": "^2.0.0-pre9",
|
"react-hotkeys": "^2.0.0",
|
||||||
"react-identicons": "^1.1.7",
|
"react-identicons": "^1.1.7",
|
||||||
"react-instantsearch-dom": "^5.7.0",
|
"react-instantsearch-dom": "^5.7.0",
|
||||||
"react-monaco-editor": "^0.30.1",
|
"react-monaco-editor": "^0.30.1",
|
||||||
|
@ -199,12 +199,6 @@ class ShowClassic extends Component {
|
|||||||
instructions
|
instructions
|
||||||
} = this.getChallenge();
|
} = this.getChallenge();
|
||||||
|
|
||||||
const {
|
|
||||||
introPath,
|
|
||||||
nextChallengePath,
|
|
||||||
prevChallengePath
|
|
||||||
} = this.props.pageContext.challengeMeta;
|
|
||||||
|
|
||||||
const { forumTopicId, title } = this.getChallenge();
|
const { forumTopicId, title } = this.getChallenge();
|
||||||
return (
|
return (
|
||||||
<SidePanel
|
<SidePanel
|
||||||
@ -212,11 +206,7 @@ class ShowClassic extends Component {
|
|||||||
description={description}
|
description={description}
|
||||||
guideUrl={getGuideUrl({ forumTopicId, title })}
|
guideUrl={getGuideUrl({ forumTopicId, title })}
|
||||||
instructions={instructions}
|
instructions={instructions}
|
||||||
introPath={introPath}
|
|
||||||
nextChallengePath={nextChallengePath}
|
|
||||||
prevChallengePath={prevChallengePath}
|
|
||||||
section={dasherize(blockName)}
|
section={dasherize(blockName)}
|
||||||
showPrevNextBtns={true}
|
|
||||||
showToolPanel={showToolPanel}
|
showToolPanel={showToolPanel}
|
||||||
title={this.getBlockNameTitle()}
|
title={this.getBlockNameTitle()}
|
||||||
videoUrl={this.getVideoUrl()}
|
videoUrl={this.getVideoUrl()}
|
||||||
|
@ -1,38 +1,16 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Link from '../../../components/helpers/Link';
|
|
||||||
|
|
||||||
import './challenge-title.css';
|
import './challenge-title.css';
|
||||||
import GreenPass from '../../../assets/icons/GreenPass';
|
import GreenPass from '../../../assets/icons/GreenPass';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
children: PropTypes.string,
|
children: PropTypes.string,
|
||||||
introPath: PropTypes.string,
|
isCompleted: PropTypes.bool
|
||||||
isCompleted: PropTypes.bool,
|
|
||||||
nextChallengePath: PropTypes.string,
|
|
||||||
prevChallengePath: PropTypes.string,
|
|
||||||
showPrevNextBtns: PropTypes.bool
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChallengeTitle({
|
function ChallengeTitle({ children, isCompleted }) {
|
||||||
children,
|
|
||||||
introPath,
|
|
||||||
isCompleted,
|
|
||||||
nextChallengePath,
|
|
||||||
prevChallengePath,
|
|
||||||
showPrevNextBtns
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div className='challenge-title-wrap'>
|
|
||||||
{showPrevNextBtns ? (
|
|
||||||
<Link
|
|
||||||
aria-label='Previous lesson'
|
|
||||||
className='btn-invert btn btn-primary'
|
|
||||||
to={prevChallengePath}
|
|
||||||
>
|
|
||||||
<
|
|
||||||
</Link>
|
|
||||||
) : null}
|
|
||||||
<h2 className='text-center challenge-title'>
|
<h2 className='text-center challenge-title'>
|
||||||
{children || 'Happy Coding!'}
|
{children || 'Happy Coding!'}
|
||||||
{isCompleted ? (
|
{isCompleted ? (
|
||||||
@ -41,16 +19,6 @@ function ChallengeTitle({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</h2>
|
</h2>
|
||||||
{showPrevNextBtns ? (
|
|
||||||
<Link
|
|
||||||
aria-label='Next lesson'
|
|
||||||
className='btn-invert btn btn-primary'
|
|
||||||
to={introPath ? introPath : nextChallengePath}
|
|
||||||
>
|
|
||||||
>
|
|
||||||
</Link>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,71 +1,16 @@
|
|||||||
/* global expect */
|
/* global expect */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Enzyme, { shallow } from 'enzyme';
|
|
||||||
import Adapter from 'enzyme-adapter-react-16';
|
|
||||||
import Link from '../../../components/helpers/Link';
|
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
import ChallengeTitle from './Challenge-Title';
|
import ChallengeTitle from './Challenge-Title';
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
|
||||||
|
|
||||||
const baseProps = {
|
const baseProps = {
|
||||||
children: 'title text',
|
children: 'title text',
|
||||||
introPath: '/intro/path',
|
isCompleted: true
|
||||||
isCompleted: true,
|
|
||||||
nextChallengePath: '/next',
|
|
||||||
prevChallengePath: '/prev',
|
|
||||||
showPrevNextBtns: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('<ChallengeTitle/>', () => {
|
describe('<ChallengeTitle/>', () => {
|
||||||
it('renders 0 <Link/>s by default', () => {
|
|
||||||
const titleToRender = <ChallengeTitle />;
|
|
||||||
const title = shallow(titleToRender);
|
|
||||||
expect(title.find(Link).length).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders a previous and a next <Link/>', () => {
|
|
||||||
const titleToRender = <ChallengeTitle {...baseProps} />;
|
|
||||||
const title = shallow(titleToRender);
|
|
||||||
expect(title.find(Link).length).toBe(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has a link to the previous challenge', () => {
|
|
||||||
const titleToRender = <ChallengeTitle {...baseProps} />;
|
|
||||||
const title = shallow(titleToRender);
|
|
||||||
expect(
|
|
||||||
title
|
|
||||||
.find(Link)
|
|
||||||
.first()
|
|
||||||
.prop('to')
|
|
||||||
).toBe('/prev');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has a link to the next introduction if there is one', () => {
|
|
||||||
const titleToRender = <ChallengeTitle {...baseProps} />;
|
|
||||||
const title = shallow(titleToRender);
|
|
||||||
expect(
|
|
||||||
title
|
|
||||||
.find(Link)
|
|
||||||
.last()
|
|
||||||
.prop('to')
|
|
||||||
).toBe('/intro/path');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has a link to the next challenge otherwise', () => {
|
|
||||||
const props = { ...baseProps, introPath: null };
|
|
||||||
const titleToRender = <ChallengeTitle {...props} />;
|
|
||||||
const title = shallow(titleToRender);
|
|
||||||
expect(
|
|
||||||
title
|
|
||||||
.find(Link)
|
|
||||||
.last()
|
|
||||||
.prop('to')
|
|
||||||
).toBe('/next');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('renders correctly', () => {
|
it('renders correctly', () => {
|
||||||
const tree = renderer.create(<ChallengeTitle {...baseProps} />).toJSON();
|
const tree = renderer.create(<ChallengeTitle {...baseProps} />).toJSON();
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
|
@ -26,12 +26,8 @@ const propTypes = {
|
|||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
guideUrl: PropTypes.string,
|
guideUrl: PropTypes.string,
|
||||||
instructions: PropTypes.string,
|
instructions: PropTypes.string,
|
||||||
introPath: PropTypes.string,
|
|
||||||
isChallengeCompleted: PropTypes.bool,
|
isChallengeCompleted: PropTypes.bool,
|
||||||
nextChallengePath: PropTypes.string,
|
|
||||||
prevChallengePath: PropTypes.string,
|
|
||||||
section: PropTypes.string,
|
section: PropTypes.string,
|
||||||
showPrevNextBtns: PropTypes.bool,
|
|
||||||
showToolPanel: PropTypes.bool,
|
showToolPanel: PropTypes.bool,
|
||||||
tests: PropTypes.arrayOf(PropTypes.object),
|
tests: PropTypes.arrayOf(PropTypes.object),
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
@ -61,27 +57,17 @@ export class SidePanel extends Component {
|
|||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
instructions,
|
instructions,
|
||||||
introPath,
|
|
||||||
isChallengeCompleted,
|
isChallengeCompleted,
|
||||||
guideUrl,
|
guideUrl,
|
||||||
nextChallengePath,
|
|
||||||
prevChallengePath,
|
|
||||||
tests,
|
tests,
|
||||||
section,
|
section,
|
||||||
showPrevNextBtns,
|
|
||||||
showToolPanel,
|
showToolPanel,
|
||||||
videoUrl
|
videoUrl
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
<div className='instructions-panel' role='complementary'>
|
<div className='instructions-panel' role='complementary'>
|
||||||
<div>
|
<div>
|
||||||
<ChallengeTitle
|
<ChallengeTitle isCompleted={isChallengeCompleted}>
|
||||||
introPath={introPath}
|
|
||||||
isCompleted={isChallengeCompleted}
|
|
||||||
nextChallengePath={nextChallengePath}
|
|
||||||
prevChallengePath={prevChallengePath}
|
|
||||||
showPrevNextBtns={showPrevNextBtns}
|
|
||||||
>
|
|
||||||
{title}
|
{title}
|
||||||
</ChallengeTitle>
|
</ChallengeTitle>
|
||||||
<ChallengeDescription
|
<ChallengeDescription
|
||||||
|
@ -1,19 +1,9 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<ChallengeTitle/> renders correctly 1`] = `
|
exports[`<ChallengeTitle/> renders correctly 1`] = `
|
||||||
<div
|
<h2
|
||||||
className="challenge-title-wrap"
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
aria-label="Previous lesson"
|
|
||||||
className="btn-invert btn btn-primary"
|
|
||||||
href="/prev"
|
|
||||||
>
|
|
||||||
<
|
|
||||||
</a>
|
|
||||||
<h2
|
|
||||||
className="text-center challenge-title"
|
className="text-center challenge-title"
|
||||||
>
|
>
|
||||||
title text
|
title text
|
||||||
<span
|
<span
|
||||||
className="sr-only"
|
className="sr-only"
|
||||||
@ -73,13 +63,5 @@ exports[`<ChallengeTitle/> renders correctly 1`] = `
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</h2>
|
</h2>
|
||||||
<a
|
|
||||||
aria-label="Next lesson"
|
|
||||||
className="btn-invert btn btn-primary"
|
|
||||||
href="/intro/path"
|
|
||||||
>
|
|
||||||
>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
|
@ -1,15 +1,3 @@
|
|||||||
.challenge-title-wrap {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 1.45rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.challenge-title {
|
.challenge-title {
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.challenge-title-wrap > a {
|
|
||||||
margin-top: 10px;
|
|
||||||
align-self: flex-start;
|
|
||||||
}
|
|
||||||
|
25
client/src/templates/Challenges/project/Side-Panel.js
Normal file
25
client/src/templates/Challenges/project/Side-Panel.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import ChallengeTitle from '../components/Challenge-Title';
|
||||||
|
import Spacer from '../../../components/helpers/Spacer';
|
||||||
|
|
||||||
|
const propTypes = {
|
||||||
|
description: PropTypes.string,
|
||||||
|
introPath: PropTypes.string,
|
||||||
|
isCompleted: PropTypes.bool,
|
||||||
|
isSignedIn: PropTypes.bool,
|
||||||
|
title: PropTypes.string
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function SidePanel({ title, description, isCompleted }) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Spacer />
|
||||||
|
<ChallengeTitle isCompleted={isCompleted}>{title}</ChallengeTitle>
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: description }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SidePanel.displayName = 'ProjectSidePanel';
|
||||||
|
SidePanel.propTypes = propTypes;
|
@ -198,14 +198,7 @@ export class BackEnd extends Component {
|
|||||||
<Row>
|
<Row>
|
||||||
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<ChallengeTitle
|
<ChallengeTitle>{blockNameTitle}</ChallengeTitle>
|
||||||
introPath={introPath}
|
|
||||||
nextChallengePath={nextChallengePath}
|
|
||||||
prevChallengePath={prevChallengePath}
|
|
||||||
showPrevNextBtns={true}
|
|
||||||
>
|
|
||||||
{blockNameTitle}
|
|
||||||
</ChallengeTitle>
|
|
||||||
<ChallengeDescription
|
<ChallengeDescription
|
||||||
description={description}
|
description={description}
|
||||||
instructions={instructions}
|
instructions={instructions}
|
||||||
|
Reference in New Issue
Block a user