From 8006f3a19905089065626df2621dfcddf5f85e89 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 1 Nov 2022 11:32:53 +0100 Subject: [PATCH 1/5] move the search results into a `ContentItem` component --- src/components/ContentItem.vue | 52 ++++++++++++++++++++++++++++++++ src/components/SearchResults.vue | 35 ++------------------- 2 files changed, 55 insertions(+), 32 deletions(-) create mode 100644 src/components/ContentItem.vue diff --git a/src/components/ContentItem.vue b/src/components/ContentItem.vue new file mode 100644 index 00000000..ec3d1608 --- /dev/null +++ b/src/components/ContentItem.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue index 8d3098b8..2325965d 100644 --- a/src/components/SearchResults.vue +++ b/src/components/SearchResults.vue @@ -20,43 +20,17 @@
diff --git a/src/locales/en.json b/src/locales/en.json index feb042c3..5370ac44 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -10,7 +10,9 @@ "playlists": "Playlists", "account": "Account", "instance": "Instance", - "player": "Player" + "player": "Player", + "livestreams": "Livestreams", + "channels": "Channels" }, "player": { "watch_on": "Watch on {0}" @@ -165,4 +167,4 @@ "copied": "Copied!", "cannot_copy": "Can't copy!" } -} +} \ No newline at end of file From 94def0723df37f4e66553789c9caf8694e755e03 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 1 Nov 2022 12:39:01 +0100 Subject: [PATCH 3/5] proper nextpage implementation --- src/components/ChannelPage.vue | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/components/ChannelPage.vue b/src/components/ChannelPage.vue index e5f07815..8b13ada4 100644 --- a/src/components/ChannelPage.vue +++ b/src/components/ChannelPage.vue @@ -139,16 +139,33 @@ export default { if (this.loading || !this.channel || !this.channel.nextpage) return; if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) { this.loading = true; - this.fetchJson(this.apiUrl() + "/nextpage/channel/" + this.channel.id, { - nextpage: this.channel.nextpage, - }).then(json => { - this.channel.nextpage = json.nextpage; - this.loading = false; - this.updateWatched(json.relatedStreams); - json.relatedStreams.map(stream => this.contentItems.push(stream)); - }); + if (this.selectedTab == 0) { + this.fetchChannelNextPage(); + } else { + this.fetchChannelTabNextPage(); + } } }, + fetchChannelNextPage() { + this.fetchJson(this.apiUrl() + "/nextpage/channel/" + this.channel.id, { + nextpage: this.channel.nextpage, + }).then(json => { + this.channel.nextpage = json.nextpage; + this.loading = false; + this.updateWatched(json.relatedStreams); + json.relatedStreams.map(stream => this.contentItems.push(stream)); + }); + }, + fetchChannelTabNextPage() { + this.fetchJson(this.apiUrl() + "/channels/tabs", { + data: this.tabs[this.selectedTab].data, + nextpage: this.tabNextPage, + }).then(json => { + this.tabNextPage = json.nextpage; + this.loading = false; + json.content.map(item => this.contentItems.push(item)); + }); + }, subscribeHandler() { if (this.authenticated) { this.fetchJson(this.authApiUrl() + (this.subscribed ? "/unsubscribe" : "/subscribe"), null, { @@ -185,6 +202,7 @@ export default { return translatedTabName; }, loadTab(index) { + this.selectedTab = index; if (index == 0) { this.contentItems = this.channel.relatedStreams; return; From 349b04834e52bb932c4bb21aa69cc6c6a6708730 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 1 Nov 2022 13:07:31 +0100 Subject: [PATCH 4/5] hightlight the current tab --- src/components/ChannelPage.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/ChannelPage.vue b/src/components/ChannelPage.vue index 8b13ada4..663a25b8 100644 --- a/src/components/ChannelPage.vue +++ b/src/components/ChannelPage.vue @@ -36,7 +36,13 @@
-
@@ -217,3 +223,9 @@ export default { }, }; + + From 16dcca8822f1178b7df2346534e52af1068b4bc4 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 1 Nov 2022 13:22:23 +0100 Subject: [PATCH 5/5] log untranslated tabs --- src/components/ChannelPage.vue | 3 +++ src/locales/en.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ChannelPage.vue b/src/components/ChannelPage.vue index 663a25b8..b99e844a 100644 --- a/src/components/ChannelPage.vue +++ b/src/components/ChannelPage.vue @@ -204,6 +204,9 @@ export default { case "Shorts": translatedTabName = this.$t("video.shorts"); break; + default: + console.error(`Tab name "${tabName}" is not translated yet!`); + break; } return translatedTabName; }, diff --git a/src/locales/en.json b/src/locales/en.json index 5370ac44..9cef968d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -167,4 +167,4 @@ "copied": "Copied!", "cannot_copy": "Can't copy!" } -} \ No newline at end of file +}