diff --git a/components/tournament/TournamentNotifications.vue b/components/tournament/TournamentNotifications.vue index 1ef3cec7..89732b1e 100644 --- a/components/tournament/TournamentNotifications.vue +++ b/components/tournament/TournamentNotifications.vue @@ -66,6 +66,64 @@ + +
+
+

+ {{ $t("tournament.voice.title") }} +

+

+ {{ $t("tournament.voice.description") }} +

+
+ +
+
+ +
+
+ +
+ {{ + $t("tournament.voice.enable_voice") + }} + +
+
+
+
@@ -287,6 +345,8 @@ const DISCORD_FIELDS = [ "discord_notifications_enabled", "discord_webhook", "discord_role_id", + "discord_guild_id", + "discord_voice_enabled", "discord_notify_PickingPlayers", "discord_notify_Scheduled", "discord_notify_WaitingForCheckIn", @@ -367,7 +427,11 @@ export default { buildForm(tournament: Record) { const form: Record = {}; for (const field of DISCORD_FIELDS) { - form[field] = tournament[field] ?? null; + if (field === "discord_voice_enabled") { + form[field] = tournament[field] ?? false; + } else { + form[field] = tournament[field] ?? null; + } } return form; }, @@ -425,14 +489,20 @@ export default { for (const field of DISCORD_FIELDS) { let value = this.form[field]; if ( - (field === "discord_webhook" || field === "discord_role_id") && + (field === "discord_webhook" || + field === "discord_role_id" || + field === "discord_guild_id") && value === "" ) { value = null; } variables[field] = value; - if (field === "discord_webhook" || field === "discord_role_id") { + if ( + field === "discord_webhook" || + field === "discord_role_id" || + field === "discord_guild_id" + ) { _set[field] = $(field, "String"); } else { _set[field] = $(field, "Boolean"); diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 2310e1ac..e88df525 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -1136,7 +1136,7 @@ } }, "notifications": { - "title": "Notifications", + "title": "Discord", "description": "Override global Discord notification settings for this tournament. Leave empty to use global defaults.", "webhook": "Webhook URL", "webhook_placeholder": "Leave empty to use global default", @@ -1167,6 +1167,12 @@ "Surrendered": "Surrendered" } }, + "voice": { + "title": "Voice Channels", + "description": "Automatically create Discord voice channels for tournament matches. Players are moved to team channels when matches begin.", + "guild_id_placeholder": "Discord Server ID", + "enable_voice": "Enable Voice Channels" + }, "table": { "tournament": "Tournament", "status": "Status", diff --git a/pages/tournaments/[tournamentId]/index.vue b/pages/tournaments/[tournamentId]/index.vue index 1f94829a..53b0046e 100644 --- a/pages/tournaments/[tournamentId]/index.vue +++ b/pages/tournaments/[tournamentId]/index.vue @@ -661,7 +661,9 @@ export default { description: true, }, description: true, + discord_guild_id: true, discord_notifications_enabled: true, + discord_voice_enabled: true, discord_webhook: true, discord_role_id: true, discord_notify_PickingPlayers: true,