Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Collabs tab on Home and Favorites page #727

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 44 additions & 25 deletions src/components/video/ConnectedVideoList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ export default {
LIVE_UPCOMING: 0,
ARCHIVE: 1,
CLIPS: 2,
// LIST: 3,
COLLABS: 3,
// LIST: 4,
}),
datePicker: false,
toDate: null,
Expand Down Expand Up @@ -365,6 +366,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() {
Expand Down Expand Up @@ -399,26 +417,21 @@ 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 && {
to: nearestUTCDate(dayjs(this.toDate ?? undefined)),
}),
max_upcoming_hours: 1,
};
if (this.isFavPage) {
return async (offset, limit) => {
const res = await backendApi
return async (offset: any, limit: any) => {
let res = null;
// Handle backend query depending on page
if (this.isFavPage) {
// Favourites Page
res = await backendApi
.favoritesVideos(this.$store.state.userdata.jwt, {
...query,
limit,
Expand All @@ -429,18 +442,24 @@ 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({
...query,
org: this.$store.state.currentOrg.name,
limit,
offset,
});
return res.data;
} else {
// Home Page
res = await backendApi
.videos({
...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;
};
},
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/de-DE/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: Alle
official: Archiv
subber: Clips
collabs: Collabs
library:
savedVideosTitle: Gespeicherte Videos
createYtPlaylistButton: YT-Playlist erstellen ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ views:
all: All
official: Archive
subber: Clips
collabs: Collabs
library:
savedVideosTitle: Saved Videos
createYtPlaylistButton: Create YT Playlist ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/es-ES/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/es-MX/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/fr-FR/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/hu-HU/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/id-ID/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: Semua
official: Arsip
subber: Klip
collabs: Kolaborasi
library:
savedVideosTitle: Video Tersimpan
createYtPlaylistButton: Buat YT Playlist ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/it-IT/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ views:
all: Tutti
official: Archivo
subber: Clip
collabs: Collaborazioni
library:
savedVideosTitle: Video salvati
createYtPlaylistButton: Crea una Playlist di YouTube ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/ja-JP/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ views:
all: すべて
official: アーカイブ
subber: 切り抜き
collabs: コラボ
library:
savedVideosTitle: 保存した動画
createYtPlaylistButton: Youtubeの再生リストを作成({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/ko-KR/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: 모두
official: 아카이브
subber: 클립
collabs: 콜라보
library:
savedVideosTitle: 저장된 동영상
createYtPlaylistButton: YouTube 재생목록 생성 ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/lol-PEKO/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ views:
all: all
official: Arcaib
subber: kirinuki
collabs: Corabo
library:
deleteConfirmation: Delete {0} video is ok?
deleteConfirmationOK: Yes delete
Expand Down
1 change: 1 addition & 0 deletions src/locales/lol-UWU/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: Aww
official: Awchive
subber: Cwips
collabs: Cowwabs
library:
savedVideosTitle: Saved bideos
createYtPlaylistButton: Cweate yt pwaywist ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/ms-MY/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ views:
all: Semua
official: Arkib
subber: Sedutan
collabs: Siarsama
library:
savedVideosTitle: Video yang Disimpan
createYtPlaylistButton: Buat Senarai Main YouTube ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/pt-BR/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/ru-RU/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ views:
all: Все
official: Архивы
subber: Клипы
collabs: Коллабы
library:
savedVideosTitle: Сохраненные видео
createYtPlaylistButton: Создать YouTube плейлист ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/th-TH/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: ทั้งหมด
official: การถ่ายทอดสดในอดีต
subber: คลิป
collabs: โคแลป
library:
savedVideosTitle: วิดีโอที่บันทึกไว้
createYtPlaylistButton: สร้างเพลย์ลิสต์ YouTube ({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/tr-TR/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/vi-VN/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: 全部
official: 存档
subber: 剪辑
collabs: 联动
library:
savedVideosTitle: 保存的视频
createYtPlaylistButton: 创建YouTube播放列表({0})
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-TW/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ views:
all: 全部
official: 存檔
subber: 剪輯
collabs: 連動
library:
savedVideosTitle: 儲存的影片
createYtPlaylistButton: 建立YouTube播放清單 ({0})
Expand Down
12 changes: 10 additions & 2 deletions src/views/HomeFave.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<v-tab class="pa-2">
{{ $t("views.home.recentVideoToggles.subber") }}
</v-tab>
<v-tab class="pa-2">
{{ $t("views.home.recentVideoToggles.collabs") }}
</v-tab>
<portal-target v-if="!$vuetify.breakpoint.xs" :name="`date-selector${isFavPage}`" class=" v-tab ml-auto" />
</v-tabs>
</portal>
Expand Down Expand Up @@ -105,7 +108,8 @@ export default {
LIVE_UPCOMING: 0,
ARCHIVE: 1,
CLIPS: 2,
LIST: 3,
COLLABS: 3,
LIST: 4,
}),
refreshTimer: null,
};
Expand Down Expand Up @@ -209,7 +213,8 @@ export default {
0: "",
1: "archive",
2: "clips",
3: "list",
3: "collabs",
4: "list",
};
this.$router
.replace({
Expand All @@ -232,6 +237,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;
Expand Down