From 9c0d144927d3e776d2cba96b25fe237db6b95cda Mon Sep 17 00:00:00 2001 From: CKY- Date: Fri, 20 Dec 2024 22:39:27 -0700 Subject: [PATCH 1/4] feat: allow stream categories to be set to empty --- .../effects/builtin/twitch/stream-game.ts | 11 ++++- .../modals/misc/edit-stream-info-modal.js | 45 ++++++++++++------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/src/backend/effects/builtin/twitch/stream-game.ts b/src/backend/effects/builtin/twitch/stream-game.ts index 4d3027056..78e5436bb 100644 --- a/src/backend/effects/builtin/twitch/stream-game.ts +++ b/src/backend/effects/builtin/twitch/stream-game.ts @@ -98,10 +98,17 @@ const model: EffectType<{ gameId: event.effect.gameId }); } else { - const categories = await twitchApi.categories.searchCategories(event.effect.gameName.trim()); + if (!event.effect.gameName) { + //user left the gamename blank + await twitchApi.channels.updateChannelInformation({ + gameId: '' + }); + return true; + } + const categories = await twitchApi.categories.searchCategories(event.effect.gameName?.trim()); if (categories?.length) { const category = - categories.find((c) => c.name.toLowerCase() === event.effect.gameName.toLowerCase()) ?? + categories.find(c => c.name.toLowerCase() === event.effect.gameName.toLowerCase()) ?? categories[0]; if (!category) { diff --git a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js index 7ea813adc..3ad4cda51 100644 --- a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js +++ b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js @@ -34,20 +34,25 @@
- - -
- -
{{$select.selected.name}}
-
-
- -
- -
{{game.name}}
-
-
-
+
+ + +
+ +
{{$select.selected.name}}
+
+
+ +
+ +
{{game.name}}
+
+
+
+
+ +
+
@@ -64,7 +69,7 @@ tooltip-append-to-body="true" ng-click="$ctrl.removeStreamTag(tag)" > - +
{ - return new Promise(resolve => { + return new Promise((resolve) => { // Must be alphanumeric no more than 25 characters const tagRegExp = /^[a-z0-9]{1,25}$/ig; @@ -170,7 +175,7 @@ $ctrl.searchGames = function(gameQuery) { backendCommunicator.fireEventAsync("search-twitch-games", gameQuery) - .then(games => { + .then((games) => { if (games != null) { $ctrl.games = games; } @@ -184,6 +189,12 @@ } }; + $ctrl.removeCategory = function() { + $ctrl.selectedGame = null; + $ctrl.streamInfo.gameId = ''; + $ctrl.streamInfo.gameName = null; + }; + $ctrl.removeStreamTag = function(tag) { $ctrl.streamInfo.tags = $ctrl.streamInfo.tags.filter(element => tag.toLowerCase() !== element.toLowerCase()); }; From 37fb579d01879c9d50a5ec0232ada3858d5b653e Mon Sep 17 00:00:00 2001 From: CKY- Date: Wed, 25 Dec 2024 04:58:04 -0700 Subject: [PATCH 2/4] change effect to a radio to clear category AND allow empty string for custom --- .../effects/builtin/twitch/stream-game.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/backend/effects/builtin/twitch/stream-game.ts b/src/backend/effects/builtin/twitch/stream-game.ts index 78e5436bb..ff96a57c3 100644 --- a/src/backend/effects/builtin/twitch/stream-game.ts +++ b/src/backend/effects/builtin/twitch/stream-game.ts @@ -5,7 +5,7 @@ import twitchApi from "../../../twitch-api/api"; import eventsManager from "../../../events/EventManager"; const model: EffectType<{ - mode: "specific" | "custom"; + mode: "specific" | "custom" | "clear"; gameId: string; gameName: string; }> = { @@ -30,6 +30,10 @@ const model: EffectType<{
+
@@ -97,14 +101,12 @@ const model: EffectType<{ await twitchApi.channels.updateChannelInformation({ gameId: event.effect.gameId }); - } else { - if (!event.effect.gameName) { - //user left the gamename blank - await twitchApi.channels.updateChannelInformation({ - gameId: '' - }); - return true; - } + } else if (event.effect.mode === "clear" || event.effect.mode === "custom" && !event.effect.gameName) { + //user left the gamename blank + await twitchApi.channels.updateChannelInformation({ + gameId: '' + }); + } else if (event.effect.mode === "custom") { const categories = await twitchApi.categories.searchCategories(event.effect.gameName?.trim()); if (categories?.length) { const category = From 9af860d007fbe99d4a4a712e83f4129d1d889b53 Mon Sep 17 00:00:00 2001 From: CKY- Date: Wed, 1 Jan 2025 06:13:36 -0700 Subject: [PATCH 3/4] revert trashcan icon --- src/gui/app/directives/modals/misc/edit-stream-info-modal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js index 3ad4cda51..3a71a1606 100644 --- a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js +++ b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js @@ -69,7 +69,7 @@ tooltip-append-to-body="true" ng-click="$ctrl.removeStreamTag(tag)" > - +
Date: Wed, 1 Jan 2025 07:57:17 -0700 Subject: [PATCH 4/4] change trashcan to times and add aria --- .../directives/modals/misc/edit-stream-info-modal.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js index 3a71a1606..885072288 100644 --- a/src/gui/app/directives/modals/misc/edit-stream-info-modal.js +++ b/src/gui/app/directives/modals/misc/edit-stream-info-modal.js @@ -49,8 +49,14 @@
-
- +
+