From 3b545fa995c34c0ab8270ae495fedc24ddc2fe4d Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sun, 1 Oct 2023 13:52:46 +0200 Subject: [PATCH] all the...small things --- resources/js/app/Routes.js | 5 ++++ .../js/components/twitch-bot/Controls.js | 7 +++++ resources/js/helpers/permissions.js | 4 +++ resources/js/i18n/de.js | 5 ++++ resources/js/i18n/en.js | 5 ++++ resources/js/pages/DiscordBot.js | 4 +++ resources/js/pages/TwitchBot.js | 30 +++++++++++++++++++ 7 files changed, 60 insertions(+) create mode 100644 resources/js/components/twitch-bot/Controls.js create mode 100644 resources/js/pages/TwitchBot.js diff --git a/resources/js/app/Routes.js b/resources/js/app/Routes.js index ca543ee..d9f2767 100644 --- a/resources/js/app/Routes.js +++ b/resources/js/app/Routes.js @@ -13,6 +13,7 @@ import Schedule from '../pages/Schedule'; 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 }) => @@ -72,6 +73,10 @@ const AppRoutes = ({ doLogout }) => element={} /> } /> + } + /> } /> } /> } /> diff --git a/resources/js/components/twitch-bot/Controls.js b/resources/js/components/twitch-bot/Controls.js new file mode 100644 index 0000000..158fb7c --- /dev/null +++ b/resources/js/components/twitch-bot/Controls.js @@ -0,0 +1,7 @@ +import React from 'react'; + +const Controls = () => { + return
; +}; + +export default Controls; diff --git a/resources/js/helpers/permissions.js b/resources/js/helpers/permissions.js index 1bdb262..706e676 100644 --- a/resources/js/helpers/permissions.js +++ b/resources/js/helpers/permissions.js @@ -155,6 +155,10 @@ export const maySeeResults = (user, tournament, round) => isTournamentMonitor(user, tournament) || Round.isComplete(tournament, round); +// Twitch + +export const mayManageTwitchBot = user => isAdmin(user) || hasGlobalRole(user, 'twitch'); + // Users export const mayEditNickname = (user, subject) => diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index 3532813..9b6891b 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -474,6 +474,11 @@ export default { 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', diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index 3de3e0d..58d406c 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -474,6 +474,11 @@ export default { 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', diff --git a/resources/js/pages/DiscordBot.js b/resources/js/pages/DiscordBot.js index 6796a94..1bea822 100644 --- a/resources/js/pages/DiscordBot.js +++ b/resources/js/pages/DiscordBot.js @@ -1,5 +1,6 @@ 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'; @@ -13,6 +14,9 @@ const DiscordBot = () => { return

{t('discordBot.heading')}

+ + {t('discordBot.heading')} +