[Media UI] Added more permalinks.

- `channel`
- `playlist`
This commit is contained in:
Fabio Manganiello 2024-07-16 01:19:29 +02:00
parent c5ac02d133
commit c95381cead
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
5 changed files with 68 additions and 7 deletions

View file

@ -165,6 +165,16 @@ export default {
title: channel.name, title: channel.name,
}) })
}, },
initView() {
const args = this.getUrlArgs()
if (args.section)
this.selectedView = args.section
if (this.selectedView)
this.selectView(this.selectedView)
},
}, },
watch: { watch: {
@ -172,16 +182,35 @@ export default {
this.onPlaylistSelected(this.selectedPlaylist) this.onPlaylistSelected(this.selectedPlaylist)
}, },
selectedPlaylist_(value) {
if (value == null)
this.setUrlArgs({playlist: null})
},
selectedChannel() { selectedChannel() {
this.onChannelSelected(this.selectedChannel) this.onChannelSelected(this.selectedChannel)
}, },
selectedChannel_(value) {
if (value == null)
this.setUrlArgs({channel: null})
},
selectedView() {
this.setUrlArgs({section: this.selectedView})
},
}, },
mounted() { mounted() {
this.loadYoutubeConfig() this.loadYoutubeConfig()
this.initView()
this.onPlaylistSelected(this.selectedPlaylist) this.onPlaylistSelected(this.selectedPlaylist)
this.onChannelSelected(this.selectedChannel) this.onChannelSelected(this.selectedChannel)
}, },
unmounted() {
this.setUrlArgs({section: null})
},
} }
</script> </script>

View file

@ -162,8 +162,13 @@ export default {
}, },
}, },
mounted() { async mounted() {
this.loadChannel() this.setUrlArgs({channel: this.id})
await this.loadChannel()
},
unmounted() {
this.setUrlArgs({channel: null})
}, },
} }
</script> </script>
@ -187,7 +192,7 @@ export default {
.actions { .actions {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: flex-end;
button { button {
background: $default-bg-7; background: $default-bg-7;

View file

@ -132,8 +132,13 @@ export default {
}, },
mounted() { mounted() {
this.setUrlArgs({playlist: this.id})
this.loadItems() this.loadItems()
}, },
unmounted() {
this.setUrlArgs({playlist: null})
},
} }
</script> </script>

View file

@ -234,8 +234,22 @@ export default {
}, },
}, },
mounted() { async mounted() {
this.loadPlaylists() await this.loadPlaylists()
const args = this.getUrlArgs()
if (args.playlist) {
const playlist = this.playlistsById[args.playlist]
if (playlist) {
this.$emit('select', playlist)
} else {
this.$emit('select', {id: args.playlist})
}
}
},
unmouted() {
this.setUrlArgs({section: null})
}, },
} }
</script> </script>

View file

@ -91,10 +91,18 @@ export default {
this.loading = false this.loading = false
} }
}, },
initView() {
const args = this.getUrlArgs()
if (args.channel) {
this.$emit('select', {id: args.channel})
}
},
}, },
mounted() { async mounted() {
this.loadSubscriptions() await this.loadSubscriptions()
this.initView()
}, },
} }
</script> </script>