Skip to content

Commit

Permalink
update create challenge form's next button functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Feb 15, 2024
1 parent 97d6a4a commit af0baf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ export class EditChallenge extends Component {
(this.validationPromise || Promise.resolve())
.then(() => {
this.isFinishing ? this.finish() : nextStep();
window.scrollTo(0, 0);
window.scrollTo(0, 0);
return false;
})
.catch((err) => {
console.log(err);
console.log(err);
}); // Stay on current step if validation fails

return false;
};

Expand Down Expand Up @@ -758,6 +758,10 @@ export class EditChallenge extends Component {
this.isFinishing = false;
prevStep(stepName);
}}
nextStep={() => {
this.isFinishing = false;
nextStep();
}}
finish={() => {
this.isFinishing = true;
this.handleSubmit();
Expand Down Expand Up @@ -967,13 +971,16 @@ export class EditChallenge extends Component {
</div>
)}

{/* Note: Next button submits the form, so nextStep isn't used here */}
<StepNavigation
activeStep={activeStep}
prevStep={(stepName) => {
this.isFinishing = false;
prevStep(stepName);
}}
nextStep={() => {
this.isFinishing = false;
nextStep();
}}
finish={() => {
this.isFinishing = true;
this.handleSubmit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default class StepNavigation extends Component {

{_isString(this.props.activeStep.next) &&
<button
type="submit"
className="mr-button mr-button--green-lighter mr-button--with-icon mr-mr-4"
onClick={() => this.props.nextStep()}
>
<FormattedMessage {...messages.next} />
<SvgSymbol
Expand Down

0 comments on commit af0baf6

Please sign in to comment.