]> git.localhorst.tv Git - alttp.git/blob - resources/js/pages/TwitchBot.js
improved user context
[alttp.git] / resources / js / pages / TwitchBot.js
1 import React from 'react';
2 import { Alert, Container } from 'react-bootstrap';
3 import { Helmet } from 'react-helmet';
4 import { useTranslation } from 'react-i18next';
5
6 import Controls from '../components/twitch-bot/Controls';
7 import { mayManageTwitchBot } from '../helpers/permissions';
8 import { useUser } from '../hooks/user';
9
10 const TwitchBot = () => {
11         const { t } = useTranslation();
12         const { user } = useUser();
13
14         return <Container>
15                 <h1>{t('twitchBot.heading')}</h1>
16                 <Helmet>
17                         <title>{t('twitchBot.heading')}</title>
18                 </Helmet>
19                 {mayManageTwitchBot(user) ? <>
20                         <h2>{t('twitchBot.controls')}</h2>
21                         <Controls />
22                 </> :
23                         <Alert variant="info">
24                                 {t('twitchBot.noManagePermission')}
25                         </Alert>
26                 }
27         </Container>;
28 };
29
30 export default TwitchBot;