]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/rounds/EditForm.js
add known bot
[alttp.git] / resources / js / components / rounds / EditForm.js
index 6472c842a27a28298a13298f2bb5ece02b7bf44a..ac2cd427628217a14f29478570c9d8dd1793c952 100644 (file)
@@ -59,6 +59,24 @@ const EditForm = ({
                                : null}
                        </Form.Group>
                </Row>
+               <Row>
+                       <Form.Group as={Col} controlId="round.spoiler">
+                               <Form.Label>{i18n.t('rounds.spoiler')}</Form.Label>
+                               <Form.Control
+                                       isInvalid={!!(touched.spoiler && errors.spoiler)}
+                                       name="spoiler"
+                                       onBlur={handleBlur}
+                                       onChange={handleChange}
+                                       type="text"
+                                       value={values.spoiler || ''}
+                               />
+                               {touched.spoiler && errors.spoiler ?
+                                       <Form.Control.Feedback type="invalid">
+                                               {i18n.t(errors.spoiler)}
+                                       </Form.Control.Feedback>
+                               : null}
+                       </Form.Group>
+               </Row>
                <Row>
                        <Form.Group as={Col}>
                                <Form.Label>{i18n.t('rounds.code')}</Form.Label>
@@ -114,6 +132,7 @@ EditForm.propTypes = {
                code: PropTypes.arrayOf(PropTypes.string),
                rolled_by: PropTypes.string,
                seed: PropTypes.string,
+               spoiler: PropTypes.string,
                title: PropTypes.string,
        }),
        handleBlur: PropTypes.func,
@@ -124,6 +143,7 @@ EditForm.propTypes = {
                code: PropTypes.arrayOf(PropTypes.bool),
                rolled_by: PropTypes.bool,
                seed: PropTypes.bool,
+               spoiler: PropTypes.bool,
                title: PropTypes.bool,
        }),
        values: PropTypes.shape({
@@ -131,6 +151,7 @@ EditForm.propTypes = {
                game: PropTypes.string,
                rolled_by: PropTypes.string,
                seed: PropTypes.string,
+               spoiler: PropTypes.string,
                title: PropTypes.string,
        }),
 };
@@ -161,12 +182,14 @@ export default withFormik({
                rolled_by: round.rolled_by || null,
                round_id: round.id,
                seed: round.seed || '',
+               spoiler: round.spoiler || '',
                title: round.title || '',
        }),
        validationSchema: yup.object().shape({
                code: yup.array().of(yup.string()),
-               rolled_by: yup.string(),
+               rolled_by: yup.string().nullable(),
                seed: yup.string().url(),
+               spoiler: yup.string().url(),
                title: yup.string(),
        }),
 })(withTranslation()(EditForm));