Fix for feed when no videos are loaded

This commit is contained in:
Brahim Hadriche committed 2023-10-25 21:22:22 -04:00
1 parent 586925c2da
commit 4827537f57
1 file changed
+36 -23
@@ -124,7 +124,12 @@
try { try {
const result = await invidiousApi.makeRequest(feedSource); const result = await invidiousApi.makeRequest(feedSource);
if (!result) { if (!result) {
return; feedSource.state.loadState = FeedLoadState.Error;
feedSourcesIndex++;
if (feedSourcesIndex >= feedSources.length) {
feedLoadState = FeedLoadState.Loaded;
}
continue;
} }
const hasContinuation = !!result.continuation; const hasContinuation = !!result.continuation;
@@ -225,26 +230,34 @@
} }
</script> </script>
<div class="text-lg font-semibold m-4"> <!-- Hide rows that are loaded but have no videos. Typically a
{feed.title} disabled feed (like popular) or unauthenticated.
</div> TODO:P0 show action nodes (action to login)
<div -->
class="carousel carousel-center rounded-box w-full space-x-4" {#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0}
style="min-height: 16rem;" <div class="text-lg font-semibold m-4">
bind:this={carouselElement} {feed.title}
on:scroll={recalculateVisibileCells} </div>
> <div
{#each videos as video, i} class="carousel carousel-center rounded-box w-full space-x-4"
<div class="carousel-item {video.type === 'channel' ? 'w-60' : 'w-80'} p-2"> style="min-height: 16rem;"
{#if i >= scrollStart && i <= scrollEnd} bind:this={carouselElement}
{#if video.type === "video"} on:scroll={recalculateVisibileCells}
<VideoCell {...video} /> >
{:else if video.type === "playlist"} {#each videos as video, i}
<PlaylistCell {...video} /> <div
{:else if video.type === "channel"} class="carousel-item {video.type === 'channel' ? 'w-60' : 'w-80'} p-2"
<ChannelCell {...video} /> >
{#if i >= scrollStart && i <= scrollEnd}
{#if video.type === "video"}
<VideoCell {...video} />
{:else if video.type === "playlist"}
<PlaylistCell {...video} />
{:else if video.type === "channel"}
<ChannelCell {...video} />
{/if}
{/if} {/if}
{/if} </div>
</div> {/each}
{/each} </div>
</div> {/if}