Append playlist id to watch page if coming from playlist

This commit is contained in:
WardPearce
2024-03-31 13:20:00 +13:00
parent d8d179a4ce
commit db49b27135
4 changed files with 9 additions and 8 deletions
+1
View File
@@ -27,6 +27,7 @@
## Todo
- Playlist support.
- Localization.
## Previews
![Preview of player](./previews/player-preview.png)
+5 -6
View File
@@ -6,6 +6,9 @@
import { cleanNumber, truncate, videoLength } from './misc';
export let video: VideoBase | Video | Notification | PlaylistPageVideo;
export let playlistId: string = '';
let watchUrl = `/watch/${video.videoId}` + (playlistId ? `?playlist=${playlistId}` : '');
let loading = true;
let loaded = false;
@@ -35,11 +38,7 @@
});
</script>
<a
class="wave"
style="width: 100%; overflow: hidden;min-height:100px;"
href={`/watch/${video.videoId}`}
>
<a class="wave" style="width: 100%; overflow: hidden;min-height:100px;" href={watchUrl}>
{#if loading}
<progress class="circle"></progress>
{:else if loaded}
@@ -73,7 +72,7 @@
<div class="small-padding">
<nav class="no-margin">
<div class="max">
<a href={`/watch/${video.videoId}`}><div class="bold">{truncate(video.title)}</div></a>
<a href={watchUrl}><div class="bold">{truncate(video.title)}</div></a>
<div>
<a href={`/channel/${video.authorId}`}>{video.author}</a
>{#if !('publishedText' in video) && 'viewCountText' in video}
+2 -1
View File
@@ -5,6 +5,7 @@
export let videos: VideoBase[] | Video[] | Notification[] | PlaylistPageVideo[] = [];
export let oneItemPerRow: boolean = false;
export let playlistId: string = '';
</script>
{#if videos.length > 0}
@@ -14,7 +15,7 @@
{#each videos as video}
<div class={`s12 m${oneItemPerRow ? '12' : '6'} l${oneItemPerRow ? '12' : '2'}`}>
<article class="no-padding" style="height: 100%;">
<Thumbnail {video} />
<Thumbnail {video} {playlistId} />
</article>
</div>
{/each}
@@ -36,4 +36,4 @@
<p style="white-space: pre-line;word-wrap: break-word;">{data.playlist.description}</p>
</article>
<VideoList {videos} />
<VideoList {videos} playlistId={data.playlist.playlistId} />