diff --git a/materialious/src/lib/PlaylistThumbnail.svelte b/materialious/src/lib/PlaylistThumbnail.svelte index 7cd5f887..de81b825 100644 --- a/materialious/src/lib/PlaylistThumbnail.svelte +++ b/materialious/src/lib/PlaylistThumbnail.svelte @@ -5,23 +5,28 @@ import { truncate } from './misc'; export let playlist: Playlist; + export let disabled: boolean = false; let loading = true; - let loaded = false; let failed = false; let img: HTMLImageElement; + const playlistLink = `/playlist/${playlist.playlistId}`; + onMount(() => { img = new Image(); if (playlist.videos.length > 0) { img.src = playlist.videos[0].videoThumbnails[4].url; - } else { + } else if (playlist.playlistThumbnail) { img.src = playlist.playlistThumbnail; + } else { + img.src = ''; + loading = false; + return; } img.onload = () => { - loaded = true; loading = false; }; img.onerror = () => { @@ -32,14 +37,15 @@ {#if playlist.videoCount > 0} {#if loading} - {:else} + {:else if img.src !== ''} Thumbnail for playlist {/if} + {:else} +
No image
{/if}
{playlist.videoCount} @@ -57,7 +65,7 @@
+ + diff --git a/materialious/src/lib/VideoList.svelte b/materialious/src/lib/VideoList.svelte index 6d281196..729b7b01 100644 --- a/materialious/src/lib/VideoList.svelte +++ b/materialious/src/lib/VideoList.svelte @@ -1,6 +1,5 @@ -{#if videos.length > 0} -
-
-
- {#each videos as video} -
-
- -
-
- {/each} -
+
+
+
+ {#each videos as video} +
+
+ +
+
+ {/each}
-{:else} - -{/if} +
diff --git a/materialious/src/routes/history/+page.svelte b/materialious/src/routes/history/+page.svelte index c7c537dc..6e98620d 100644 --- a/materialious/src/routes/history/+page.svelte +++ b/materialious/src/routes/history/+page.svelte @@ -1,6 +1,7 @@