import Technique from '../pages/Technique';
import Techniques from '../pages/Techniques';
import Tournament from '../pages/Tournament';
+import TwitchBot from '../pages/TwitchBot';
import User from '../pages/User';
const AppRoutes = ({ doLogout }) => <Routes>
element={<Technique basepath="tech" type="tech" />}
/>
<Route path="tournaments/:id" element={<Tournament />} />
+ <Route
+ path="twitch-bot"
+ element={<TwitchBot />}
+ />
<Route path="users/:id" element={<User />} />
<Route path="/" element={<Front />} />
<Route path="*" element={<Navigate to="/" />} />
--- /dev/null
+import React from 'react';
+
+const Controls = () => {
+ return <div />;
+};
+
+export default Controls;
isTournamentMonitor(user, tournament) ||
Round.isComplete(tournament, round);
+// Twitch
+
+export const mayManageTwitchBot = user => isAdmin(user) || hasGlobalRole(user, 'twitch');
+
// Users
export const mayEditNickname = (user, subject) =>
unlockError: 'Fehler beim Entsperren',
unlockSuccess: 'Turnier entsperrt',
},
+ twitchBot: {
+ controls: 'Controls',
+ heading: 'Twitch Bot',
+ noManagePermission: 'Du verfügst nicht über die notwendigen Berechtigungen, um den Twitch Bot zu administrieren.',
+ },
users: {
discordTag: 'Discord Tag',
editNickname: 'Name bearbeiten',
unlockError: 'Error unlocking tournaments',
unlockSuccess: 'Tournament unlocked',
},
+ twitchBot: {
+ controls: 'Controls',
+ heading: 'Twitch Bot',
+ noManagePermission: 'You lack the required privileges to manage the twitch bot.',
+ },
users: {
discordTag: 'Discord tag',
editNickname: 'Edit name',
import React from 'react';
import { Button, Container } from 'react-bootstrap';
+import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import Icon from '../components/common/Icon';
return <Container>
<h1>{t('discordBot.heading')}</h1>
+ <Helmet>
+ <title>{t('discordBot.heading')}</title>
+ </Helmet>
<p>
<span className="button-bar">
<Button
--- /dev/null
+import React from 'react';
+import { Alert, Container } from 'react-bootstrap';
+import { Helmet } from 'react-helmet';
+import { useTranslation } from 'react-i18next';
+
+import Controls from '../components/twitch-bot/Controls';
+import { mayManageTwitchBot } from '../helpers/permissions';
+import { useUser } from '../helpers/UserContext';
+
+const TwitchBot = () => {
+ const { t } = useTranslation();
+ const user = useUser();
+
+ return <Container>
+ <h1>{t('twitchBot.heading')}</h1>
+ <Helmet>
+ <title>{t('twitchBot.heading')}</title>
+ </Helmet>
+ {mayManageTwitchBot(user) ? <>
+ <h2>{t('twitchBot.controls')}</h2>
+ <Controls />
+ </> :
+ <Alert variant="info">
+ {t('twitchBot.noManagePermission')}
+ </Alert>
+ }
+ </Container>;
+};
+
+export default TwitchBot;