-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract Form logic of "Create Competition" Form to its own folder/com…
…ponent (#9185) * Create separate form provider * In-progress hooking the form provider into existing form * Generalize EditForm reducer * Hook up data bindings * Wire up form inputs * Wire up input dispatch correctly * Replace old Store dispatchers * Split FormContext and actual Form into separate code files * Move FormInputs to their own separate file * Rename package to FormBuilder * Reorganize Header and Footer in Comp Form * Fix section not propagating in standard update action * Use more React-friendly initializers
- Loading branch information
Showing
35 changed files
with
639 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { Message } from 'semantic-ui-react'; | ||
import { useStore } from '../../lib/providers/StoreProvider'; | ||
import { useFormContext } from '../wca/FormBuilder/provider/FormObjectProvider'; | ||
import ConfirmationActions, { CreateOrUpdateButton } from './ConfirmationActions'; | ||
|
||
export default function Footer({ | ||
saveObject, | ||
}) { | ||
const { isPersisted } = useStore(); | ||
const { unsavedChanges } = useFormContext(); | ||
|
||
if (isPersisted && !unsavedChanges) { | ||
return ( | ||
<ConfirmationActions saveObject={saveObject} /> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
{unsavedChanges && ( | ||
<Message info> | ||
You have unsaved changes. Please save the competition before taking any other action. | ||
</Message> | ||
)} | ||
<CreateOrUpdateButton saveObject={saveObject} /> | ||
</> | ||
); | ||
} |
4 changes: 2 additions & 2 deletions
4
app/webpacker/components/CompetitionForm/FormSections/Admin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
app/webpacker/components/CompetitionForm/FormSections/CompetitorLimit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 12 additions & 10 deletions
22
app/webpacker/components/CompetitionForm/FormSections/EventRestrictions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
app/webpacker/components/CompetitionForm/FormSections/NameDetails.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 7 additions & 9 deletions
16
app/webpacker/components/CompetitionForm/FormSections/RegistrationDates.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.