diff --git a/web-src/MIGRATION_VUE3.md b/web-src/MIGRATION_VUE3.md index 315ff936..c02c4e73 100644 --- a/web-src/MIGRATION_VUE3.md +++ b/web-src/MIGRATION_VUE3.md @@ -1,7 +1,5 @@ # Vue 3 + Vite Migration -- Vue Dev Tools required in version 6 (currently only released as beta versions): - - [ ] vite does not support env vars in `vite.config.js` from `.env` files - @@ -9,7 +7,7 @@ - [ ] Documentation update -- [ ] Add linting (ESLint) ? +- [x] Add linting (ESLint) - [x] Update dialog is missing scan options @@ -17,22 +15,22 @@ - [ ] Do not reload data, if using the index-nav - [x] PageAlbums - - [ ] PageArtists + - [x] PageArtists + - [ ] PageGenres - [ ] ... - - [ ] Albums page is slow to load (because of the number of vue components?) - - [ ] Evaluate virtual scroller + - [ ] Albums page is slow to load (because of the number of vue components - ListItem+CoverArtwork) + - [ ] Evaluate removing ListItem and CoverArtwork component - [x] JS error on Podacst page - Problem caused by the Slider component - Replace with plain html -- [ ] vue-router scroll-behavior +- [x] vue-router scroll-behavior - [x] Index list not always hidden - [x] Check transitions - - [ ] Page display is "jumpy" - - Workaround is removing the page transition effect + - [x] Page display is "jumpy" - "fixed" by removing the page transition effect - [x] Index navigation "scroll up/down" button does not scroll down, if index is visible @@ -54,7 +52,7 @@ - [x] vue-router does not support navigation guards in mixins: - - replace mixin with composition api? + - Replace mixin with composition api? - Copied nav guards into each component - [x] vue-router link does not support `tag` and `active-class` properties: diff --git a/web-src/src/components/IndexButtonList.vue b/web-src/src/components/IndexButtonList.vue index 8573787f..8f457865 100644 --- a/web-src/src/components/IndexButtonList.vue +++ b/web-src/src/components/IndexButtonList.vue @@ -20,6 +20,9 @@ export default { computed: { filtered_index() { + if (!this.index) { + return [] + } const specialChars = '!"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~' return this.index.filter((c) => !specialChars.includes(c)) } diff --git a/web-src/src/components/ListAlbums.vue b/web-src/src/components/ListAlbums.vue index 1bf82473..addf9712 100644 --- a/web-src/src/components/ListAlbums.vue +++ b/web-src/src/components/ListAlbums.vue @@ -1,84 +1,53 @@ - + + + diff --git a/web-src/src/components/ListGenres.vue b/web-src/src/components/ListGenres.vue new file mode 100644 index 00000000..2c731c7c --- /dev/null +++ b/web-src/src/components/ListGenres.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/web-src/src/components/ListItemAlbum.vue b/web-src/src/components/ListItemAlbum.vue deleted file mode 100644 index 25eaac95..00000000 --- a/web-src/src/components/ListItemAlbum.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemArtist.vue b/web-src/src/components/ListItemArtist.vue deleted file mode 100644 index e56929c0..00000000 --- a/web-src/src/components/ListItemArtist.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemComposer.vue b/web-src/src/components/ListItemComposer.vue deleted file mode 100644 index 78753817..00000000 --- a/web-src/src/components/ListItemComposer.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemDirectory.vue b/web-src/src/components/ListItemDirectory.vue deleted file mode 100644 index b46549d6..00000000 --- a/web-src/src/components/ListItemDirectory.vue +++ /dev/null @@ -1,29 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemGenre.vue b/web-src/src/components/ListItemGenre.vue deleted file mode 100644 index e6cbeea0..00000000 --- a/web-src/src/components/ListItemGenre.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemPlaylist.vue b/web-src/src/components/ListItemPlaylist.vue deleted file mode 100644 index 65d55195..00000000 --- a/web-src/src/components/ListItemPlaylist.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListItemTrack.vue b/web-src/src/components/ListItemTrack.vue deleted file mode 100644 index 47a43406..00000000 --- a/web-src/src/components/ListItemTrack.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/web-src/src/components/ListPlaylists.vue b/web-src/src/components/ListPlaylists.vue index c8ef15cd..cce0b0df 100644 --- a/web-src/src/components/ListPlaylists.vue +++ b/web-src/src/components/ListPlaylists.vue @@ -1,46 +1,51 @@ diff --git a/web-src/src/pages/PageAudiobooksAlbums.vue b/web-src/src/pages/PageAudiobooksAlbums.vue index 9d14dbb7..ef7a6f97 100644 --- a/web-src/src/pages/PageAudiobooksAlbums.vue +++ b/web-src/src/pages/PageAudiobooksAlbums.vue @@ -4,16 +4,14 @@ @@ -25,7 +23,7 @@ import IndexButtonList from '@/components/IndexButtonList.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ListAlbums from '@/components/ListAlbums.vue' import webapi from '@/webapi' -import Albums from '@/lib/Albums' +import { bySortName, GroupByList } from '@/lib/GroupByList' const dataObject = { load: function (to) { @@ -33,7 +31,8 @@ const dataObject = { }, set: function (vm, response) { - vm.albums = response.data + vm.albums = new GroupByList(response.data) + vm.albums.group(bySortName('name_sort')) } } @@ -51,7 +50,12 @@ export default { next((vm) => dataObject.set(vm, response)) }) }, + beforeRouteUpdate(to, from, next) { + if (!this.albums.isEmpty()) { + next() + return + } const vm = this dataObject.load(to).then((response) => { dataObject.set(vm, response) @@ -61,16 +65,7 @@ export default { data() { return { - albums: { items: [] } - } - }, - - computed: { - albums_list() { - return new Albums(this.albums.items, { - sort: 'Name', - group: true - }) + albums: new GroupByList() } }, diff --git a/web-src/src/pages/PageAudiobooksArtist.vue b/web-src/src/pages/PageAudiobooksArtist.vue index 420115a2..a69ada65 100644 --- a/web-src/src/pages/PageAudiobooksArtist.vue +++ b/web-src/src/pages/PageAudiobooksArtist.vue @@ -25,7 +25,7 @@

{{ artist.album_count }} albums

- + dataObject.set(vm, response)) }) }, + beforeRouteUpdate(to, from, next) { + if (!this.albums.isEmpty()) { + next() + return + } const vm = this dataObject.load(to).then((response) => { dataObject.set(vm, response) @@ -75,7 +81,7 @@ export default { data() { return { artist: {}, - albums: {}, + albums: new GroupByList(), show_artist_details_modal: false } diff --git a/web-src/src/pages/PageAudiobooksArtists.vue b/web-src/src/pages/PageAudiobooksArtists.vue index 5b6c9204..6f4cf031 100644 --- a/web-src/src/pages/PageAudiobooksArtists.vue +++ b/web-src/src/pages/PageAudiobooksArtists.vue @@ -4,17 +4,15 @@ @@ -20,7 +20,7 @@ import TabsMusic from '@/components/TabsMusic.vue' import ListAlbums from '@/components/ListAlbums.vue' import webapi from '@/webapi' import store from '@/store' -import Albums from '@/lib/Albums' +import { byDateSinceToday, GroupByList } from '@/lib/GroupByList' const dataObject = { load: function (to) { @@ -34,7 +34,13 @@ const dataObject = { }, set: function (vm, response) { - vm.recently_added = response.data.albums + vm.recently_added = new GroupByList(response.data.albums) + vm.recently_added.group( + byDateSinceToday('time_added', { + direction: 'desc', + defaultValue: '0000' + }) + ) } } @@ -47,7 +53,12 @@ export default { next((vm) => dataObject.set(vm, response)) }) }, + beforeRouteUpdate(to, from, next) { + if (!this.recently_added.isEmpty()) { + next() + return + } const vm = this dataObject.load(to).then((response) => { dataObject.set(vm, response) @@ -57,18 +68,7 @@ export default { data() { return { - recently_added: { items: [] } - } - }, - - computed: { - albums_list() { - return new Albums(this.recently_added.items, { - hideSingles: false, - hideSpotify: false, - sort: 'Recently added (browse)', - group: true - }) + recently_added: new GroupByList() } } } diff --git a/web-src/src/pages/PageComposer.vue b/web-src/src/pages/PageComposer.vue index 39711b0e..5bf8da5e 100644 --- a/web-src/src/pages/PageComposer.vue +++ b/web-src/src/pages/PageComposer.vue @@ -1,9 +1,6 @@