]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/discord-bot/Controls.js
remove some useless svg groups
[alttp.git] / resources / js / components / discord-bot / Controls.js
1 import React from 'react';
2 import { Col, Form, Row } from 'react-bootstrap';
3 import { useTranslation } from 'react-i18next';
4
5 import DiscordChannelSelect from '../common/DiscordChannelSelect';
6 import DiscordSelect from '../common/DiscordSelect';
7
8 const Controls = () => {
9         const [channel, setChannel] = React.useState('');
10         const [guild, setGuild] = React.useState(null);
11
12         const { t } = useTranslation();
13
14         return <>
15                 <Row>
16                         <Form.Group as={Col} md={6}>
17                                 <Form.Label>{t('discordBot.guild')}</Form.Label>
18                                 <Form.Control
19                                         as={DiscordSelect}
20                                         onChange={({ guild }) => { setGuild(guild); setChannel(''); }}
21                                         value={guild ? guild.guild_id : ''}
22                                 />
23                         </Form.Group>
24                         <Form.Group as={Col} md={6}>
25                                 <Form.Label>{t('discordBot.channel')}</Form.Label>
26                                 {guild ?
27                                         <Form.Control
28                                                 as={DiscordChannelSelect}
29                                                 guild={guild.guild_id}
30                                                 onChange={({ target: { value } }) => setChannel(value)}
31                                                 types={[]}
32                                                 value={channel}
33                                         />
34                                 :
35                                         <Form.Control plaintext readOnly defaultValue={t('discordBot.selectGuild')} />
36                                 }
37                         </Form.Group>
38                 </Row>
39         </>;
40 };
41
42 export default Controls;