X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fepisodes%2FRestreamAddForm.js;h=97fb1226ae4decddce32995b51f6d43dc8ff3979;hb=1e725fef6dc440aaeea8c30e1e0598dc5d24ad86;hp=747b47e656b7107e2920dfb4c779ac3b0ffd884c;hpb=638802eaf20d636c16d7ce337ace508708705f2c;p=alttp.git diff --git a/resources/js/components/episodes/RestreamAddForm.js b/resources/js/components/episodes/RestreamAddForm.js index 747b47e..97fb122 100644 --- a/resources/js/components/episodes/RestreamAddForm.js +++ b/resources/js/components/episodes/RestreamAddForm.js @@ -1,13 +1,16 @@ import { withFormik } from 'formik'; import PropTypes from 'prop-types'; import React from 'react'; -import { Button, Form, Modal } from 'react-bootstrap'; +import { Button, Col, Form, Modal, Row } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import { getName } from '../../helpers/Crew'; +import DialogEpisode from './DialogEpisode'; +import ToggleSwitch from '../common/ToggleSwitch'; import laravelErrorsToFormik from '../../helpers/laravelErrorsToFormik'; import { withUser } from '../../helpers/UserContext'; +const channelCompare = (a, b) => a.channel.title.localeCompare(b.channel.title); + const RestreamAddForm = ({ episode, errors, @@ -23,17 +26,7 @@ const RestreamAddForm = ({ return
- {episode ? <> -
- {episode.event.title} -
-
- {t('episodes.startTime', { date: new Date(episode.start) })} -
-
- {episode.players.map(p => getName(p)).join(', ')} -
- : null} + {t('episodes.channel')} - {((user && user.channel_crews) || []).map(c => + {((user && user.channel_crews) || []).sort(channelCompare).map(c => @@ -56,6 +49,44 @@ const RestreamAddForm = ({ : null} + + + + {t('episodes.restreamDialog.acceptComms')} + + + {touched.accept_comms && errors.accept_comms ? + + {t(errors.accept_comms)} + + : null} + + + + {t('episodes.restreamDialog.acceptTracker')} + + + {touched.accept_tracker && errors.accept_tracker ? + + {t(errors.accept_tracker)} + + : null} + +
{onCancel ? @@ -80,6 +111,8 @@ RestreamAddForm.propTypes = { start: PropTypes.string, }), errors: PropTypes.shape({ + accept_comms: PropTypes.string, + accept_tracker: PropTypes.string, channel_id: PropTypes.string, }), handleBlur: PropTypes.func, @@ -87,6 +120,8 @@ RestreamAddForm.propTypes = { handleSubmit: PropTypes.func, onCancel: PropTypes.func, touched: PropTypes.shape({ + accept_comms: PropTypes.bool, + accept_tracker: PropTypes.bool, channel_id: PropTypes.bool, }), user: PropTypes.shape({ @@ -94,6 +129,8 @@ RestreamAddForm.propTypes = { })), }), values: PropTypes.shape({ + accept_comms: PropTypes.bool, + accept_tracker: PropTypes.bool, channel_id: PropTypes.number, }), }; @@ -113,6 +150,8 @@ export default withUser(withFormik({ } }, mapPropsToValues: ({ episode, user }) => ({ + accept_comms: false, + accept_tracker: false, channel_id: user && user.channel_crews && user.channel_crews.length ? user.channel_crews[0].channel_id : 0, episode_id: episode ? episode.id : 0,