X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Frounds%2FEditForm.js;h=3d0d0b368ad0749008b4153327a5f85c37cc37ed;hb=72d6c25d3b1a6d79843d5673ba78804dd442ae39;hp=57ee95a5a6e1298c97d9891617beab9e121ac376;hpb=45f1e92a30b00dfcf4304dc70126e813df9f4a10;p=alttp.git diff --git a/resources/js/components/rounds/EditForm.js b/resources/js/components/rounds/EditForm.js index 57ee95a..3d0d0b3 100644 --- a/resources/js/components/rounds/EditForm.js +++ b/resources/js/components/rounds/EditForm.js @@ -6,6 +6,7 @@ import { Button, Col, Form, Modal, Row } from 'react-bootstrap'; import { withTranslation } from 'react-i18next'; import toastr from 'toastr'; +import SeedCodeInput from './SeedCodeInput'; import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik'; import i18n from '../../i18n'; import yup from '../../schema/yup'; @@ -57,6 +58,25 @@ const EditForm = ({ : null} + + + {i18n.t('rounds.code')} + + {touched.code && errors.code ? + + {i18n.t(errors.code)} + + : null} + + {onCancel ? @@ -72,6 +92,7 @@ const EditForm = ({ EditForm.propTypes = { errors: PropTypes.shape({ + code: PropTypes.arrayOf(PropTypes.string), seed: PropTypes.string, title: PropTypes.string, }), @@ -80,10 +101,13 @@ EditForm.propTypes = { handleSubmit: PropTypes.func, onCancel: PropTypes.func, touched: PropTypes.shape({ + code: PropTypes.arrayOf(PropTypes.bool), seed: PropTypes.bool, title: PropTypes.bool, }), values: PropTypes.shape({ + code: PropTypes.arrayOf(PropTypes.string), + game: PropTypes.string, seed: PropTypes.string, title: PropTypes.string, }), @@ -110,11 +134,14 @@ export default withFormik({ } }, mapPropsToValues: ({ round }) => ({ + code: round.code || [], + game: round.game || 'mixed', round_id: round.id, seed: round.seed || '', title: round.title || '', }), validationSchema: yup.object().shape({ + code: yup.array().of(yup.string()), seed: yup.string().url(), title: yup.string(), }),