Fix channels sub count in web app

This commit is contained in:
Brahim Hadriche committed 2024-12-24 16:57:53 -05:00
1 parent 889a502731
commit ce7f51c403
2 files changed
+18 -1

No files matched your search

+4
View File
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for auto-generated channels in Playlet backend - Support for auto-generated channels in Playlet backend
### Fixed
- Channels sub count in web app
### Removed ### Removed
- [YouTube.js](https://github.com/LuanRT/YouTube.js) from web app. It is no longer needed, so this reduces app size. - [YouTube.js](https://github.com/LuanRT/YouTube.js) from web app. It is no longer needed, so this reduces app size.
@@ -8,6 +8,9 @@
export let authorThumbnails: any[] | undefined = undefined; export let authorThumbnails: any[] | undefined = undefined;
export let channelHandle: string | undefined = undefined; export let channelHandle: string | undefined = undefined;
export let subCount: number | undefined = undefined; export let subCount: number | undefined = undefined;
export let subCountText: string | undefined = undefined;
export let videoCountText: string | undefined = undefined;
export let authorSubTitle: string | undefined = undefined;
// svelte-ignore unused-export-let // svelte-ignore unused-export-let
export let type: string = undefined; export let type: string = undefined;
@@ -15,7 +18,17 @@
let modal; let modal;
function getSubCountText() { function getSubCountText() {
if (authorSubTitle) {
return authorSubTitle;
}
if (isNaN(subCount) || subCount < 0) { if (isNaN(subCount) || subCount < 0) {
if (videoCountText) {
return videoCountText;
}
if (subCountText) {
return subCountText;
}
return ""; return "";
} }
@@ -32,7 +45,7 @@
<div class="card card-compact bg-base-100 shadow-xl border border-neutral"> <div class="card card-compact bg-base-100 shadow-xl border border-neutral">
<ChannelThumbnail bind:author bind:authorThumbnails /> <ChannelThumbnail bind:author bind:authorThumbnails />
<div class="card-body"> <div class="card-body">
<h3 class="card-title text-base line-clamp-1 min-h-8">{author}</h3> <h3 class="card-title text-base line-clamp-2 min-h-8">{author}</h3>
<div>{getSubCountText()}</div> <div>{getSubCountText()}</div>
<div>{channelHandle || ""}</div> <div>{channelHandle || ""}</div>
</div> </div>