diff --git a/client/src/templates/Challenges/projects/ProjectForm.js b/client/src/templates/Challenges/projects/SolutionForm.js
similarity index 64%
rename from client/src/templates/Challenges/projects/ProjectForm.js
rename to client/src/templates/Challenges/projects/SolutionForm.js
index d2323d8d5b..6935bf882f 100644
--- a/client/src/templates/Challenges/projects/ProjectForm.js
+++ b/client/src/templates/Challenges/projects/SolutionForm.js
@@ -5,13 +5,14 @@ import { Form } from '../../../components/formHelpers';
const propTypes = {
isFrontEnd: PropTypes.bool,
+ isProject: PropTypes.bool,
isSubmitting: PropTypes.bool,
onSubmit: PropTypes.func.isRequired,
- updateProjectForm: PropTypes.func.isRequired
+ updateSolutionForm: PropTypes.func.isRequired
};
-const frontEndFields = ['solution'];
-const backEndFields = ['solution', 'githubLink'];
+const challengeFields = ['solution'];
+const backEndProjectFields = ['solution', 'githubLink'];
const options = {
types: {
@@ -21,38 +22,39 @@ const options = {
required: ['solution']
};
-export class ProjectForm extends Component {
+export class SolutionForm extends Component {
constructor(props) {
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
}
componentDidMount() {
- this.props.updateProjectForm({});
+ this.props.updateSolutionForm({});
}
handleSubmit(values) {
- this.props.updateProjectForm(values);
+ this.props.updateSolutionForm(values);
this.props.onSubmit();
}
render() {
- const { isSubmitting, isFrontEnd } = this.props;
+ const { isSubmitting, isFrontEnd, isProject } = this.props;
const buttonCopy = isSubmitting
? 'Submit and go to my next challenge'
: "I've completed this challenge";
return (
- {challengeType === backend ? (
-
- ) : (
-
- )}
+
+ isBackEndProject
+ ? updateSolutionFormValues(values)
+ : updateBackendFormValues(values)
+ }
+ />
diff --git a/client/src/templates/Challenges/projects/frontend/Show.js b/client/src/templates/Challenges/projects/frontend/Show.js
index f13bad2d6a..6e4ab9a9c1 100644
--- a/client/src/templates/Challenges/projects/frontend/Show.js
+++ b/client/src/templates/Challenges/projects/frontend/Show.js
@@ -11,7 +11,7 @@ import {
challengeMounted,
updateChallengeMeta,
openModal,
- updateProjectFormValues
+ updateSolutionFormValues
} from '../../redux';
import { frontEndProject } from '../../../../../utils/challengeTypes';
import { getGuideUrl } from '../../utils';
@@ -20,7 +20,7 @@ import LearnLayout from '../../../../components/layouts/Learn';
import ChallengeTitle from '../../components/Challenge-Title';
import ChallengeDescription from '../../components/Challenge-Description';
import Spacer from '../../../../components/helpers/Spacer';
-import ProjectForm from '../ProjectForm';
+import SolutionForm from '../SolutionForm';
import ProjectToolPanel from '../Tool-Panel';
import CompletionModal from '../../components/CompletionModal';
import HelpModal from '../../components/HelpModal';
@@ -32,7 +32,7 @@ const mapDispatchToProps = dispatch =>
{
updateChallengeMeta,
challengeMounted,
- updateProjectFormValues,
+ updateSolutionFormValues,
openCompletionModal: () => openModal('completion')
},
dispatch
@@ -48,7 +48,7 @@ const propTypes = {
challengeMeta: PropTypes.object
}),
updateChallengeMeta: PropTypes.func.isRequired,
- updateProjectFormValues: PropTypes.func.isRequired
+ updateSolutionFormValues: PropTypes.func.isRequired
};
export class Project extends Component {
@@ -105,11 +105,12 @@ export class Project extends Component {
pageContext: {
challengeMeta: { introPath, nextChallengePath, prevChallengePath }
},
- updateProjectFormValues
+ updateSolutionFormValues
} = this.props;
- const isFrontEnd = challengeType === frontEndProject;
+ const isFrontEndProject = challengeType === frontEndProject;
const blockNameTitle = `${blockName} - ${title}`;
+
return (
(this._container = c)}
@@ -125,10 +126,11 @@ export class Project extends Component {
{blockNameTitle}
-
({
+ [types.updateSolutionFormValues]: (state, { payload }) => ({
...state,
projectFormValues: payload
}),