From 726228ca80b3f85e7f130bcc5cf7bab1188d19a6 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 17:54:04 +0800 Subject: [PATCH 1/7] views: HomeFave: replace maps containing "list" with "collabs --- src/views/HomeFave.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/views/HomeFave.vue b/src/views/HomeFave.vue index fc51f5cf7..2b8b44f0c 100644 --- a/src/views/HomeFave.vue +++ b/src/views/HomeFave.vue @@ -43,6 +43,9 @@ {{ $t("views.home.recentVideoToggles.subber") }} + + {{ $t("views.home.recentVideoToggles.collabs") }} + @@ -105,7 +108,7 @@ export default { LIVE_UPCOMING: 0, ARCHIVE: 1, CLIPS: 2, - LIST: 3, + COLLABS: 3, }), refreshTimer: null, }; @@ -209,7 +212,7 @@ export default { 0: "", 1: "archive", 2: "clips", - 3: "list", + 3: "collabs", }; this.$router .replace({ @@ -232,6 +235,9 @@ export default { case "#clips": this.tab = this.Tabs.CLIPS; break; + case "#collabs": + this.tab = this.Tabs.COLLABS; + break; case "#list": this.tab = this.Tabs.LIST; break; From 48ba0c7cec5202bd5214046d3f4cfb2547fff341 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 17:55:36 +0800 Subject: [PATCH 2/7] views: HomeFave: add back "list" to maps as 4th item --- src/views/HomeFave.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/views/HomeFave.vue b/src/views/HomeFave.vue index 2b8b44f0c..f313742f7 100644 --- a/src/views/HomeFave.vue +++ b/src/views/HomeFave.vue @@ -109,6 +109,7 @@ export default { ARCHIVE: 1, CLIPS: 2, COLLABS: 3, + LIST: 4, }), refreshTimer: null, }; @@ -213,6 +214,7 @@ export default { 1: "archive", 2: "clips", 3: "collabs", + 4: "list", }; this.$router .replace({ From 030abf905ef2b08c47b322d296f545fe9921d048 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 18:12:03 +0800 Subject: [PATCH 3/7] locales: add key for Collabs: home.recentVideoToggles.collabs --- src/locales/de-DE/ui.yml | 1 + src/locales/en/ui.yml | 1 + src/locales/es-ES/ui.yml | 1 + src/locales/es-MX/ui.yml | 1 + src/locales/fr-FR/ui.yml | 1 + src/locales/hu-HU/ui.yml | 1 + src/locales/id-ID/ui.yml | 1 + src/locales/it-IT/ui.yml | 1 + src/locales/ja-JP/ui.yml | 1 + src/locales/ko-KR/ui.yml | 1 + src/locales/lol-PEKO/ui.yml | 1 + src/locales/lol-UWU/ui.yml | 1 + src/locales/ms-MY/ui.yml | 1 + src/locales/pt-BR/ui.yml | 1 + src/locales/ru-RU/ui.yml | 1 + src/locales/th-TH/ui.yml | 1 + src/locales/tr-TR/ui.yml | 1 + src/locales/vi-VN/ui.yml | 1 + src/locales/zh-CN/ui.yml | 1 + src/locales/zh-TW/ui.yml | 1 + 20 files changed, 20 insertions(+) diff --git a/src/locales/de-DE/ui.yml b/src/locales/de-DE/ui.yml index 5190f6302..e4403632b 100644 --- a/src/locales/de-DE/ui.yml +++ b/src/locales/de-DE/ui.yml @@ -191,6 +191,7 @@ views: all: Alle official: Archiv subber: Clips + collabs: Collabs library: savedVideosTitle: Gespeicherte Videos createYtPlaylistButton: YT-Playlist erstellen ({0}) diff --git a/src/locales/en/ui.yml b/src/locales/en/ui.yml index c7e484a8d..25aa68572 100644 --- a/src/locales/en/ui.yml +++ b/src/locales/en/ui.yml @@ -199,6 +199,7 @@ views: all: All official: Archive subber: Clips + collabs: Collabs library: savedVideosTitle: Saved Videos createYtPlaylistButton: Create YT Playlist ({0}) diff --git a/src/locales/es-ES/ui.yml b/src/locales/es-ES/ui.yml index 2b4a18009..52b61612b 100644 --- a/src/locales/es-ES/ui.yml +++ b/src/locales/es-ES/ui.yml @@ -163,6 +163,7 @@ views: all: Todos official: Archivo subber: Clips + collabs: Colaboraciones library: savedVideosTitle: Vídeos guardados createYtPlaylistButton: Crear lista de reproducción de YT ({0}) diff --git a/src/locales/es-MX/ui.yml b/src/locales/es-MX/ui.yml index c0a862958..d0d8738d2 100644 --- a/src/locales/es-MX/ui.yml +++ b/src/locales/es-MX/ui.yml @@ -184,6 +184,7 @@ views: all: Todos official: Archivo subber: Clips + collabs: Colaboraciones library: savedVideosTitle: Videos Guardados createYtPlaylistButton: Crear lista de reproducción de YT ({0}) diff --git a/src/locales/fr-FR/ui.yml b/src/locales/fr-FR/ui.yml index 82d08dac8..ff43a5386 100644 --- a/src/locales/fr-FR/ui.yml +++ b/src/locales/fr-FR/ui.yml @@ -163,6 +163,7 @@ views: all: Tout official: Archives subber: Clips + collabs: Collaborations library: savedVideosTitle: Vidéos Sauvegardées createYtPlaylistButton: Créer une playlist YT ({0}) diff --git a/src/locales/hu-HU/ui.yml b/src/locales/hu-HU/ui.yml index 215203928..21bd90f95 100644 --- a/src/locales/hu-HU/ui.yml +++ b/src/locales/hu-HU/ui.yml @@ -191,6 +191,7 @@ views: all: Összes official: Előző streamek subber: Klipek + collabs: Vendégként library: savedVideosTitle: Mentett videók createYtPlaylistButton: YT lejátszási lista létrehozása ({0}) diff --git a/src/locales/id-ID/ui.yml b/src/locales/id-ID/ui.yml index 021b31fc1..6385e8633 100644 --- a/src/locales/id-ID/ui.yml +++ b/src/locales/id-ID/ui.yml @@ -191,6 +191,7 @@ views: all: Semua official: Arsip subber: Klip + collabs: Kolaborasi library: savedVideosTitle: Video Tersimpan createYtPlaylistButton: Buat YT Playlist ({0}) diff --git a/src/locales/it-IT/ui.yml b/src/locales/it-IT/ui.yml index 2662e29b2..8541274b2 100644 --- a/src/locales/it-IT/ui.yml +++ b/src/locales/it-IT/ui.yml @@ -168,6 +168,7 @@ views: all: Tutti official: Archivo subber: Clip + collabs: Collaborazioni library: savedVideosTitle: Video salvati createYtPlaylistButton: Crea una Playlist di YouTube ({0}) diff --git a/src/locales/ja-JP/ui.yml b/src/locales/ja-JP/ui.yml index e8b49a2ab..d406f4c28 100644 --- a/src/locales/ja-JP/ui.yml +++ b/src/locales/ja-JP/ui.yml @@ -188,6 +188,7 @@ views: all: すべて official: アーカイブ subber: 切り抜き + collabs: コラボ library: savedVideosTitle: 保存した動画 createYtPlaylistButton: Youtubeの再生リストを作成({0}) diff --git a/src/locales/ko-KR/ui.yml b/src/locales/ko-KR/ui.yml index 2cf57ab8f..e2201c57a 100644 --- a/src/locales/ko-KR/ui.yml +++ b/src/locales/ko-KR/ui.yml @@ -191,6 +191,7 @@ views: all: 모두 official: 아카이브 subber: 클립 + collabs: 콜라보 library: savedVideosTitle: 저장된 동영상 createYtPlaylistButton: YouTube 재생목록 생성 ({0}) diff --git a/src/locales/lol-PEKO/ui.yml b/src/locales/lol-PEKO/ui.yml index 11f2f9761..26120e3f8 100644 --- a/src/locales/lol-PEKO/ui.yml +++ b/src/locales/lol-PEKO/ui.yml @@ -136,6 +136,7 @@ views: all: all official: Arcaib subber: kirinuki + collabs: Corabo library: deleteConfirmation: Delete {0} video is ok? deleteConfirmationOK: Yes delete diff --git a/src/locales/lol-UWU/ui.yml b/src/locales/lol-UWU/ui.yml index 476bf7d1c..b122b50c3 100644 --- a/src/locales/lol-UWU/ui.yml +++ b/src/locales/lol-UWU/ui.yml @@ -191,6 +191,7 @@ views: all: Aww official: Awchive subber: Cwips + collabs: Cowwabs library: savedVideosTitle: Saved bideos createYtPlaylistButton: Cweate yt pwaywist ({0}) diff --git a/src/locales/ms-MY/ui.yml b/src/locales/ms-MY/ui.yml index 81f58ccc1..996fc36dc 100644 --- a/src/locales/ms-MY/ui.yml +++ b/src/locales/ms-MY/ui.yml @@ -188,6 +188,7 @@ views: all: Semua official: Arkib subber: Sedutan + collabs: Siarsama library: savedVideosTitle: Video yang Disimpan createYtPlaylistButton: Buat Senarai Main YouTube ({0}) diff --git a/src/locales/pt-BR/ui.yml b/src/locales/pt-BR/ui.yml index 34200d937..1c4230d54 100644 --- a/src/locales/pt-BR/ui.yml +++ b/src/locales/pt-BR/ui.yml @@ -166,6 +166,7 @@ views: all: Todos official: VODs subber: Clipes + collabs: Collabs library: savedVideosTitle: Vídeos Salvos createYtPlaylistButton: Criar uma Playlist no Youtube ({0}) diff --git a/src/locales/ru-RU/ui.yml b/src/locales/ru-RU/ui.yml index caf1670f6..bffa0e749 100644 --- a/src/locales/ru-RU/ui.yml +++ b/src/locales/ru-RU/ui.yml @@ -180,6 +180,7 @@ views: all: Все official: Архивы subber: Клипы + collabs: Коллабы library: savedVideosTitle: Сохраненные видео createYtPlaylistButton: Создать YouTube плейлист ({0}) diff --git a/src/locales/th-TH/ui.yml b/src/locales/th-TH/ui.yml index 3e590fb61..ab0100ee8 100644 --- a/src/locales/th-TH/ui.yml +++ b/src/locales/th-TH/ui.yml @@ -191,6 +191,7 @@ views: all: ทั้งหมด official: การถ่ายทอดสดในอดีต subber: คลิป + collabs: โคแลป library: savedVideosTitle: วิดีโอที่บันทึกไว้ createYtPlaylistButton: สร้างเพลย์ลิสต์ YouTube ({0}) diff --git a/src/locales/tr-TR/ui.yml b/src/locales/tr-TR/ui.yml index 3d6093791..7aeaed2a8 100644 --- a/src/locales/tr-TR/ui.yml +++ b/src/locales/tr-TR/ui.yml @@ -189,6 +189,7 @@ views: all: Tümü official: Arşiv subber: Klipler + collabs: Collablar library: savedVideosTitle: Kaydedilen Videolar createYtPlaylistButton: YT Oynatma Listesi Oluştur ({0}) diff --git a/src/locales/vi-VN/ui.yml b/src/locales/vi-VN/ui.yml index 3b3addb55..1f519a8a0 100644 --- a/src/locales/vi-VN/ui.yml +++ b/src/locales/vi-VN/ui.yml @@ -181,6 +181,7 @@ views: all: Tất cả official: Lưu trữ subber: Clip + collabs: Collab library: savedVideosTitle: Video đã lưu createYtPlaylistButton: Tạo Youtube Playlist ({0}) diff --git a/src/locales/zh-CN/ui.yml b/src/locales/zh-CN/ui.yml index 5f9de8f8b..9bcfb0fe0 100644 --- a/src/locales/zh-CN/ui.yml +++ b/src/locales/zh-CN/ui.yml @@ -191,6 +191,7 @@ views: all: 全部 official: 存档 subber: 剪辑 + collabs: 联动 library: savedVideosTitle: 保存的视频 createYtPlaylistButton: 创建YouTube播放列表({0}) diff --git a/src/locales/zh-TW/ui.yml b/src/locales/zh-TW/ui.yml index 2a7c378ec..031a3cf3b 100644 --- a/src/locales/zh-TW/ui.yml +++ b/src/locales/zh-TW/ui.yml @@ -191,6 +191,7 @@ views: all: 全部 official: 存檔 subber: 剪輯 + collabs: 連動 library: savedVideosTitle: 儲存的影片 createYtPlaylistButton: 建立YouTube播放清單 ({0}) From deb02a5d38eda734f8883c06ec00b63c69a3f0db Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 19:12:06 +0800 Subject: [PATCH 4/7] component: ConnectedVideoList: refactor query map - extract out status, type, and include to a constant map - remove home live/upcoming tab from map since it is handled by another module --- src/components/video/ConnectedVideoList.vue | 27 ++++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/video/ConnectedVideoList.vue b/src/components/video/ConnectedVideoList.vue index 8c120b668..80919306a 100644 --- a/src/components/video/ConnectedVideoList.vue +++ b/src/components/video/ConnectedVideoList.vue @@ -365,6 +365,23 @@ export default { created() { console.log("Created, so adding refresh timer to HomeFav"); this.init(true); // try updating favorites if it's actually favorites page. + this.tabToQueryMap = Object.freeze({ + [this.Tabs.ARCHIVE]: Object.freeze({ + status: "past,missing", + type: "stream", + include: "mentions,clips", + }), + [this.Tabs.CLIPS]: Object.freeze({ + status: "past", + type: "clip", + include: "mentions", + }), + [this.Tabs.COLLABS]: Object.freeze({ + // status: "new,upcoming,live,past,missing", // Include all status + type: "stream", + include: "mentions", + }), + }); }, methods: { toggleDisplayMode() { @@ -399,16 +416,8 @@ export default { this.init(); }, getLoadFn() { - const inclusion = { - [this.Tabs.ARCHIVE]: "mentions,clips", - [this.Tabs.LIVE_UPCOMING]: "mentions", - [this.Tabs.CLIPS]: "mentions", - }[this.tab] ?? ""; - const query = { - status: this.tab === this.Tabs.ARCHIVE ? "past,missing" : "past", - ...{ type: this.tab === this.Tabs.ARCHIVE ? "stream" : "clip" }, - include: inclusion, + ...(this.tabToQueryMap[this.tab] ?? {}), lang: this.$store.state.settings.clipLangs.join(","), paginated: !this.scrollMode, ...(this.toDate && { From c6cb373fab5dc2654361de7a8aa37b9373322cf4 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 19:12:36 +0800 Subject: [PATCH 5/7] component: ConnectedVideoList: add COLLABS to Tabs map --- src/components/video/ConnectedVideoList.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/video/ConnectedVideoList.vue b/src/components/video/ConnectedVideoList.vue index 80919306a..bda15dbdb 100644 --- a/src/components/video/ConnectedVideoList.vue +++ b/src/components/video/ConnectedVideoList.vue @@ -222,7 +222,8 @@ export default { LIVE_UPCOMING: 0, ARCHIVE: 1, CLIPS: 2, - // LIST: 3, + COLLABS: 3, + // LIST: 4, }), datePicker: false, toDate: null, From 0d747a20d994ccc359d0367c4be86faf844b9b22 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 19:15:23 +0800 Subject: [PATCH 6/7] component: ConnectedVideoList: refactor getLoadFn - enclose shared query inside async return - move shared variable "res" outside if/else scope to allow change in next commit --- src/components/video/ConnectedVideoList.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/video/ConnectedVideoList.vue b/src/components/video/ConnectedVideoList.vue index bda15dbdb..0376350de 100644 --- a/src/components/video/ConnectedVideoList.vue +++ b/src/components/video/ConnectedVideoList.vue @@ -426,9 +426,12 @@ export default { }), max_upcoming_hours: 1, }; + return async (offset: any, limit: any) => { + let res = null; + // Handle backend query depending on page if (this.isFavPage) { - return async (offset, limit) => { - const res = await backendApi + // Favourites Page + res = await backendApi .favoritesVideos(this.$store.state.userdata.jwt, { ...query, limit, @@ -439,18 +442,18 @@ export default { this.$store.dispatch("loginVerify", { bounceToLogin: true }); // check if the user is actually logged in. throw err; }); - return res.data; - }; - } - // home page function - return async (offset, limit) => { - const res = await backendApi.videos({ + } else { + // Home Page + res = await backendApi + .videos({ ...query, org: this.$store.state.currentOrg.name, limit, offset, }); - return res.data; + } + + return res?.data; }; }, }, From db45490429937f68f31b979f4f405e443dc05952 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 17 Sep 2023 19:18:11 +0800 Subject: [PATCH 7/7] component: ConnectedVideoList: getLoadFn: handle collabs --- src/components/video/ConnectedVideoList.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/video/ConnectedVideoList.vue b/src/components/video/ConnectedVideoList.vue index 0376350de..3b5bd0708 100644 --- a/src/components/video/ConnectedVideoList.vue +++ b/src/components/video/ConnectedVideoList.vue @@ -429,7 +429,7 @@ export default { return async (offset: any, limit: any) => { let res = null; // Handle backend query depending on page - if (this.isFavPage) { + if (this.isFavPage) { // Favourites Page res = await backendApi .favoritesVideos(this.$store.state.userdata.jwt, { @@ -446,13 +446,19 @@ export default { // Home Page res = await backendApi .videos({ - ...query, - org: this.$store.state.currentOrg.name, - limit, - offset, - }); + ...query, + org: this.$store.state.currentOrg.name, + limit, + offset, + }); + } + // Handle collab tab + if (this.tab === this.Tabs.COLLABS) { + res.data.items = res.data.items.filter( + // Filter only for videos with mentions (collabs) + (obj) => (Array.isArray(obj.mentions) && obj.mentions.length > 0), + ); } - return res?.data; }; },