[web] Use named route for genres

Switching to named routes in order to reduce future maintenance.
This commit is contained in:
Alain Nussbaumer 2023-07-10 20:54:52 +02:00
parent d0fbd68523
commit 59aa462b05
9 changed files with 36 additions and 24 deletions

View File

@ -57,7 +57,7 @@ export default {
methods: { methods: {
open_genre(genre) { open_genre(genre) {
this.$router.push({ name: 'Genre', params: { genre: genre.name } }) this.$router.push({ name: 'music-genre', params: { genre: genre.name } })
}, },
open_dialog(genre) { open_dialog(genre) {

View File

@ -90,7 +90,10 @@ export default {
open_genre() { open_genre() {
this.$emit('close') this.$emit('close')
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } }) this.$router.push({
name: 'music-genre',
params: { genre: this.genre.name }
})
} }
} }
} }

View File

@ -234,7 +234,10 @@ export default {
}, },
open_genre() { open_genre() {
this.$router.push({ name: 'Genre', params: { genre: this.item.genre } }) this.$router.push({
name: 'music-genre',
params: { genre: this.item.genre }
})
}, },
open_spotify_artist() { open_spotify_artist() {

View File

@ -269,7 +269,10 @@ export default {
}, },
open_genre() { open_genre() {
this.$router.push({ name: 'Genre', params: { genre: this.track.genre } }) this.$router.push({
name: 'music-genre',
params: { genre: this.track.genre }
})
}, },
open_spotify_artist() { open_spotify_artist() {

View File

@ -71,7 +71,7 @@
<navbar-item-link :to="{ name: 'music-albums' }"> <navbar-item-link :to="{ name: 'music-albums' }">
<span class="pl-5" v-text="$t('navigation.albums')" /> <span class="pl-5" v-text="$t('navigation.albums')" />
</navbar-item-link> </navbar-item-link>
<navbar-item-link :to="{ path: '/music/genres' }"> <navbar-item-link :to="{ name: 'music-genres' }">
<span class="pl-5" v-text="$t('navigation.genres')" /> <span class="pl-5" v-text="$t('navigation.genres')" />
</navbar-item-link> </navbar-item-link>
<navbar-item-link <navbar-item-link

View File

@ -19,7 +19,7 @@
</router-link> </router-link>
<router-link <router-link
v-slot="{ navigate, isActive }" v-slot="{ navigate, isActive }"
to="/music/artists" :to="{ name: 'music-artists' }"
custom custom
> >
<li :class="{ 'is-active': isActive }"> <li :class="{ 'is-active': isActive }">
@ -35,7 +35,7 @@
</router-link> </router-link>
<router-link <router-link
v-slot="{ navigate, isActive }" v-slot="{ navigate, isActive }"
to="/music/albums" :to="{ name: 'music-albums' }"
custom custom
> >
<li :class="{ 'is-active': isActive }"> <li :class="{ 'is-active': isActive }">
@ -47,7 +47,7 @@
</router-link> </router-link>
<router-link <router-link
v-slot="{ navigate, isActive }" v-slot="{ navigate, isActive }"
to="/music/genres" :to="{ name: 'music-genres' }"
custom custom
> >
<li :class="{ 'is-active': isActive }"> <li :class="{ 'is-active': isActive }">

View File

@ -106,7 +106,7 @@ export default {
open_tracks() { open_tracks() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ this.$router.push({
name: 'GenreTracks', name: 'music-genre-tracks',
params: { genre: this.genre.name } params: { genre: this.genre.name }
}) })
}, },

View File

@ -55,9 +55,9 @@
<script> <script>
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ControlDropdown from '@/components/ControlDropdown.vue' import ControlDropdown from '@/components/ControlDropdown.vue'
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListTracks from '@/components/ListTracks.vue' import ListTracks from '@/components/ListTracks.vue'
import ModalDialogGenre from '@/components/ModalDialogGenre.vue' import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
@ -146,7 +146,10 @@ export default {
methods: { methods: {
open_genre() { open_genre() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } }) this.$router.push({
name: 'music-genre',
params: { genre: this.genre.name }
})
}, },
play() { play() {

View File

@ -11,6 +11,9 @@ import PageAudiobooksAlbums from '@/pages/PageAudiobooksAlbums.vue'
import PageAudiobooksArtist from '@/pages/PageAudiobooksArtist.vue' import PageAudiobooksArtist from '@/pages/PageAudiobooksArtist.vue'
import PageAudiobooksArtists from '@/pages/PageAudiobooksArtists.vue' import PageAudiobooksArtists from '@/pages/PageAudiobooksArtists.vue'
import PageFiles from '@/pages/PageFiles.vue' import PageFiles from '@/pages/PageFiles.vue'
import PageGenre from '@/pages/PageGenre.vue'
import PageGenreTracks from '@/pages/PageGenreTracks.vue'
import PageGenres from '@/pages/PageGenres.vue'
import PagePlaylist from '@/pages/PagePlaylist.vue' import PagePlaylist from '@/pages/PagePlaylist.vue'
import PagePlaylistSpotify from '@/pages/PagePlaylistSpotify.vue' import PagePlaylistSpotify from '@/pages/PagePlaylistSpotify.vue'
import PagePlaylistTracks from '@/pages/PagePlaylistTracks.vue' import PagePlaylistTracks from '@/pages/PagePlaylistTracks.vue'
@ -21,9 +24,6 @@ import PageQueue from '@/pages/PageQueue.vue'
import PageBrowse from '@/pages/PageBrowse.vue' import PageBrowse from '@/pages/PageBrowse.vue'
import PageBrowseRecentlyAdded from '@/pages/PageBrowseRecentlyAdded.vue' import PageBrowseRecentlyAdded from '@/pages/PageBrowseRecentlyAdded.vue'
import PageBrowseRecentlyPlayed from '@/pages/PageBrowseRecentlyPlayed.vue' import PageBrowseRecentlyPlayed from '@/pages/PageBrowseRecentlyPlayed.vue'
import PageGenres from '@/pages/PageGenres.vue'
import PageGenre from '@/pages/PageGenre.vue'
import PageGenreTracks from '@/pages/PageGenreTracks.vue'
import PageComposers from '@/pages/PageComposers.vue' import PageComposers from '@/pages/PageComposers.vue'
import PageComposer from '@/pages/PageComposer.vue' import PageComposer from '@/pages/PageComposer.vue'
import PageComposerTracks from '@/pages/PageComposerTracks.vue' import PageComposerTracks from '@/pages/PageComposerTracks.vue'
@ -137,23 +137,23 @@ export const router = createRouter({
path: '/files' path: '/files'
}, },
{ {
path: '/music/genres',
name: 'Genres',
component: PageGenres,
meta: { show_progress: true, has_tabs: true, has_index: true }
},
{
path: '/music/genres/:genre',
name: 'Genre',
component: PageGenre, component: PageGenre,
meta: { show_progress: true, has_index: true } meta: { has_index: true, show_progress: true },
path: '/music/genres/:genre',
name: 'music-genre'
}, },
{ {
path: '/music/genres/:genre/tracks', path: '/music/genres/:genre/tracks',
name: 'GenreTracks', name: 'music-genre-tracks',
component: PageGenreTracks, component: PageGenreTracks,
meta: { show_progress: true, has_index: true } meta: { show_progress: true, has_index: true }
}, },
{
component: PageGenres,
meta: { has_index: true, has_tabs: true, show_progress: true },
path: '/music/genres',
name: 'music-genres'
},
{ {
path: '/music/composers', path: '/music/composers',
name: 'Composers', name: 'Composers',