[YouTube UI] Support playlist navigation in the media nav.

This commit is contained in:
Fabio Manganiello 2023-11-14 22:32:25 +01:00
parent 4853f51c8b
commit ae017516c4
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 35 additions and 5 deletions

View file

@ -8,7 +8,10 @@
<div class="body" v-else> <div class="body" v-else>
<Feed @play="$emit('play', $event)" v-if="selectedView === 'feed'" /> <Feed @play="$emit('play', $event)" v-if="selectedView === 'feed'" />
<Playlists @play="$emit('play', $event)" v-if="selectedView === 'playlists'" /> <Playlists :selected-playlist="selectedPlaylist"
@play="$emit('play', $event)"
@select="onPlaylistSelected"
v-else-if="selectedView === 'playlists'" />
<Index @select="selectView" v-else /> <Index @select="selectView" v-else />
</div> </div>
</div> </div>
@ -40,6 +43,7 @@ export default {
return { return {
youtubeConfig: null, youtubeConfig: null,
selectedView: null, selectedView: null,
selectedPlaylist: null,
path: [], path: [],
} }
}, },
@ -75,16 +79,27 @@ export default {
selectView(view) { selectView(view) {
this.selectedView = view this.selectedView = view
if (view === 'playlists')
this.selectedPlaylist = null
if (view?.length) { if (view?.length) {
this.path = [ this.path = [
{ {
title: view.slice(0, 1).toUpperCase() + view.slice(1), title: view.slice(0, 1).toUpperCase() + view.slice(1),
click: () => this.selectView(view),
}, },
] ]
} else { } else {
this.path = [] this.path = []
} }
}, },
onPlaylistSelected(playlist) {
this.selectedPlaylist = playlist.id
this.path.push({
title: playlist.name,
})
},
}, },
mounted() { mounted() {

View file

@ -10,7 +10,7 @@
<div class="playlist item" <div class="playlist item"
v-for="(playlist, id) in playlistsById" v-for="(playlist, id) in playlistsById"
:key="id" :key="id"
@click="selectedPlaylist = id"> @click="$emit('select', playlist)">
<MediaImage :item="playlist" :has-play="false" /> <MediaImage :item="playlist" :has-play="false" />
<div class="title">{{ playlist.name }}</div> <div class="title">{{ playlist.name }}</div>
</div> </div>
@ -31,7 +31,7 @@ import Playlist from "./Playlist";
import Utils from "@/Utils"; import Utils from "@/Utils";
export default { export default {
emits: ['play'], emits: ['play', 'select'],
mixins: [Utils], mixins: [Utils],
components: { components: {
Loading, Loading,
@ -40,11 +40,17 @@ export default {
Playlist, Playlist,
}, },
props: {
selectedPlaylist: {
type: String,
default: null,
},
},
data() { data() {
return { return {
playlists: [], playlists: [],
loading: false, loading: false,
selectedPlaylist: null,
} }
}, },
@ -79,11 +85,20 @@ export default {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
.item { :deep(.playlist.item) {
cursor: pointer; cursor: pointer;
.title {
font-size: 1.1em;
margin-top: 0.5em;
}
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
img {
filter: contrast(70%);
}
} }
} }
} }