]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/episodes/RestreamDialog.js
compact keysanity tracker
[alttp.git] / resources / js / components / episodes / RestreamDialog.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Modal } from 'react-bootstrap';
4 import { useTranslation } from 'react-i18next';
5
6 import RestreamAddForm from './RestreamAddForm';
7 import RestreamEditForm from './RestreamEditForm';
8
9 const RestreamDialog = ({
10         channel,
11         editRestream,
12         episode,
13         manageCrew,
14         onHide,
15         onRemoveRestream,
16         onSubmit,
17         show,
18 }) => {
19         const { t } = useTranslation();
20
21         return <Modal className="restream-dialog" onHide={onHide} show={show}>
22                 <Modal.Header closeButton>
23                         <Modal.Title>
24                                 {t('episodes.restreamDialog.title')}
25                         </Modal.Title>
26                 </Modal.Header>
27                 {channel ?
28                         <RestreamEditForm
29                                 channel={channel}
30                                 editRestream={editRestream}
31                                 episode={episode}
32                                 manageCrew={manageCrew}
33                                 onCancel={onHide}
34                                 onRemoveRestream={onRemoveRestream}
35                         />
36                 :
37                         <RestreamAddForm
38                                 episode={episode}
39                                 onCancel={onHide}
40                                 onSubmit={onSubmit}
41                         />
42                 }
43         </Modal>;
44 };
45
46 RestreamDialog.propTypes = {
47         channel: PropTypes.shape({
48         }),
49         editRestream: PropTypes.func,
50         episode: PropTypes.shape({
51         }),
52         manageCrew: PropTypes.func,
53         onHide: PropTypes.func,
54         onRemoveRestream: PropTypes.func,
55         onSubmit: PropTypes.func,
56         show: PropTypes.bool,
57 };
58
59 export default RestreamDialog;