From e874276bdb25910cf0b3699a7a17ec945d3f88b3 Mon Sep 17 00:00:00 2001 From: chme Date: Mon, 17 Dec 2018 11:52:09 +0100 Subject: [PATCH] [web-src] Refactor spotify modal dialogs into a separate components --- .../src/components/SpotifyListItemAlbum.vue | 85 +-------------- .../src/components/SpotifyListItemArtist.vue | 77 +------------- .../components/SpotifyListItemPlaylist.vue | 81 +------------- .../src/components/SpotifyListItemTrack.vue | 98 +---------------- .../components/SpotifyModalDialogAlbum.vue | 85 +++++++++++++++ .../components/SpotifyModalDialogArtist.vue | 77 ++++++++++++++ .../components/SpotifyModalDialogPlaylist.vue | 81 ++++++++++++++ .../components/SpotifyModalDialogTrack.vue | 100 ++++++++++++++++++ web-src/src/pages/SpotifyPageAlbum.vue | 22 +++- web-src/src/pages/SpotifyPageArtist.vue | 22 +++- web-src/src/pages/SpotifyPageBrowse.vue | 44 +++++++- .../SpotifyPageBrowseFeaturedPlaylists.vue | 26 ++++- .../pages/SpotifyPageBrowseNewReleases.vue | 26 ++++- web-src/src/pages/SpotifyPagePlaylist.vue | 24 ++++- web-src/src/pages/SpotifyPageSearch.vue | 76 +++++++++++-- 15 files changed, 564 insertions(+), 360 deletions(-) create mode 100644 web-src/src/components/SpotifyModalDialogAlbum.vue create mode 100644 web-src/src/components/SpotifyModalDialogArtist.vue create mode 100644 web-src/src/components/SpotifyModalDialogPlaylist.vue create mode 100644 web-src/src/components/SpotifyModalDialogTrack.vue diff --git a/web-src/src/components/SpotifyListItemAlbum.vue b/web-src/src/components/SpotifyListItemAlbum.vue index 09fb82ed..4effbe53 100644 --- a/web-src/src/components/SpotifyListItemAlbum.vue +++ b/web-src/src/components/SpotifyListItemAlbum.vue @@ -5,103 +5,20 @@

{{ album.artists[0].name }}

- - - - - - +
+ + diff --git a/web-src/src/components/SpotifyModalDialogArtist.vue b/web-src/src/components/SpotifyModalDialogArtist.vue new file mode 100644 index 00000000..919105ea --- /dev/null +++ b/web-src/src/components/SpotifyModalDialogArtist.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/web-src/src/components/SpotifyModalDialogPlaylist.vue b/web-src/src/components/SpotifyModalDialogPlaylist.vue new file mode 100644 index 00000000..f7b8961d --- /dev/null +++ b/web-src/src/components/SpotifyModalDialogPlaylist.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/web-src/src/components/SpotifyModalDialogTrack.vue b/web-src/src/components/SpotifyModalDialogTrack.vue new file mode 100644 index 00000000..59b09c34 --- /dev/null +++ b/web-src/src/components/SpotifyModalDialogTrack.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/web-src/src/pages/SpotifyPageAlbum.vue b/web-src/src/pages/SpotifyPageAlbum.vue index 307cd98b..9bcb43df 100644 --- a/web-src/src/pages/SpotifyPageAlbum.vue +++ b/web-src/src/pages/SpotifyPageAlbum.vue @@ -11,7 +11,14 @@ @@ -20,6 +27,7 @@ import { LoadDataBeforeEnterMixin } from './mixin' import ContentWithHeading from '@/templates/ContentWithHeading' import SpotifyListItemTrack from '@/components/SpotifyListItemTrack' +import SpotifyModalDialogTrack from '@/components/SpotifyModalDialogTrack' import store from '@/store' import webapi from '@/webapi' import SpotifyWebApi from 'spotify-web-api-js' @@ -39,11 +47,14 @@ const albumData = { export default { name: 'PageAlbum', mixins: [ LoadDataBeforeEnterMixin(albumData) ], - components: { ContentWithHeading, SpotifyListItemTrack }, + components: { ContentWithHeading, SpotifyListItemTrack, SpotifyModalDialogTrack }, data () { return { - album: {} + album: { artists: [{}], tracks: {} }, + + show_track_details_modal: false, + selected_track: {} } }, @@ -55,6 +66,11 @@ export default { play: function () { this.show_details_modal = false webapi.player_play_uri(this.album.uri, true) + }, + + open_track_dialog: function (track) { + this.selected_track = track + this.show_track_details_modal = true } } } diff --git a/web-src/src/pages/SpotifyPageArtist.vue b/web-src/src/pages/SpotifyPageArtist.vue index 7da70b89..9a970e66 100644 --- a/web-src/src/pages/SpotifyPageArtist.vue +++ b/web-src/src/pages/SpotifyPageArtist.vue @@ -5,8 +5,15 @@ @@ -15,6 +22,7 @@ import { LoadDataBeforeEnterMixin } from './mixin' import ContentWithHeading from '@/templates/ContentWithHeading' import SpotifyListItemAlbum from '@/components/SpotifyListItemAlbum' +import SpotifyModalDialogAlbum from '@/components/SpotifyModalDialogAlbum' import store from '@/store' import SpotifyWebApi from 'spotify-web-api-js' import InfiniteLoading from 'vue-infinite-loading' @@ -42,14 +50,17 @@ const artistData = { export default { name: 'SpotifyPageArtist', mixins: [ LoadDataBeforeEnterMixin(artistData) ], - components: { ContentWithHeading, SpotifyListItemAlbum, InfiniteLoading }, + components: { ContentWithHeading, SpotifyListItemAlbum, SpotifyModalDialogAlbum, InfiniteLoading }, data () { return { artist: {}, albums: [], total: 0, - offset: 0 + offset: 0, + + show_details_modal: false, + selected_album: {} } }, @@ -73,6 +84,11 @@ export default { $state.complete() } } + }, + + open_dialog: function (album) { + this.selected_album = album + this.show_details_modal = true } } } diff --git a/web-src/src/pages/SpotifyPageBrowse.vue b/web-src/src/pages/SpotifyPageBrowse.vue index 68b6eee4..c1def11b 100644 --- a/web-src/src/pages/SpotifyPageBrowse.vue +++ b/web-src/src/pages/SpotifyPageBrowse.vue @@ -8,7 +8,14 @@

New Releases

@@ -18,6 +25,7 @@ import { LoadDataBeforeEnterMixin } from './mixin' import ContentWithHeading from '@/templates/ContentWithHeading' import TabsMusic from '@/components/TabsMusic' import SpotifyListItemPlaylist from '@/components/SpotifyListItemPlaylist' +import SpotifyModalDialogPlaylist from '@/components/SpotifyModalDialogPlaylist' import store from '@/store' import * as types from '@/store/mutation_types' import SpotifyWebApi from 'spotify-web-api-js' @@ -43,12 +51,26 @@ const browseData = { export default { name: 'SpotifyPageBrowseFeaturedPlaylists', mixins: [ LoadDataBeforeEnterMixin(browseData) ], - components: { ContentWithHeading, TabsMusic, SpotifyListItemPlaylist }, + components: { ContentWithHeading, TabsMusic, SpotifyListItemPlaylist, SpotifyModalDialogPlaylist }, + + data () { + return { + show_playlist_details_modal: false, + selected_playlist: {} + } + }, computed: { featured_playlists () { return this.$store.state.spotify_featured_playlists } + }, + + methods: { + open_playlist_dialog: function (playlist) { + this.selected_playlist = playlist + this.show_playlist_details_modal = true + } } } diff --git a/web-src/src/pages/SpotifyPageBrowseNewReleases.vue b/web-src/src/pages/SpotifyPageBrowseNewReleases.vue index cbcb8184..5719396e 100644 --- a/web-src/src/pages/SpotifyPageBrowseNewReleases.vue +++ b/web-src/src/pages/SpotifyPageBrowseNewReleases.vue @@ -7,7 +7,14 @@

New Releases

@@ -18,6 +25,7 @@ import { LoadDataBeforeEnterMixin } from './mixin' import ContentWithHeading from '@/templates/ContentWithHeading' import TabsMusic from '@/components/TabsMusic' import SpotifyListItemAlbum from '@/components/SpotifyListItemAlbum' +import SpotifyModalDialogAlbum from '@/components/SpotifyModalDialogAlbum' import store from '@/store' import * as types from '@/store/mutation_types' import SpotifyWebApi from 'spotify-web-api-js' @@ -43,12 +51,26 @@ const browseData = { export default { name: 'SpotifyPageBrowseNewReleases', mixins: [ LoadDataBeforeEnterMixin(browseData) ], - components: { ContentWithHeading, TabsMusic, SpotifyListItemAlbum }, + components: { ContentWithHeading, TabsMusic, SpotifyListItemAlbum, SpotifyModalDialogAlbum }, + + data () { + return { + show_album_details_modal: false, + selected_album: {} + } + }, computed: { new_releases () { return this.$store.state.spotify_new_releases } + }, + + methods: { + open_album: function (album) { + this.selected_album = album + this.show_album_details_modal = true + } } } diff --git a/web-src/src/pages/SpotifyPagePlaylist.vue b/web-src/src/pages/SpotifyPagePlaylist.vue index 801656d0..96b8ba93 100644 --- a/web-src/src/pages/SpotifyPagePlaylist.vue +++ b/web-src/src/pages/SpotifyPagePlaylist.vue @@ -10,8 +10,15 @@ @@ -20,6 +27,7 @@ import { LoadDataBeforeEnterMixin } from './mixin' import ContentWithHeading from '@/templates/ContentWithHeading' import SpotifyListItemTrack from '@/components/SpotifyListItemTrack' +import SpotifyModalDialogTrack from '@/components/SpotifyModalDialogTrack' import store from '@/store' import webapi from '@/webapi' import SpotifyWebApi from 'spotify-web-api-js' @@ -47,14 +55,17 @@ const playlistData = { export default { name: 'SpotifyPagePlaylist', mixins: [ LoadDataBeforeEnterMixin(playlistData) ], - components: { ContentWithHeading, SpotifyListItemTrack, InfiniteLoading }, + components: { ContentWithHeading, SpotifyListItemTrack, SpotifyModalDialogTrack, InfiniteLoading }, data () { return { - playlist: {}, + playlist: { tracks: {} }, tracks: [], total: 0, - offset: 0 + offset: 0, + + show_track_details_modal: false, + selected_track: {} } }, @@ -83,6 +94,11 @@ export default { play: function () { this.show_details_modal = false webapi.player_play_uri(this.playlist.uri, true) + }, + + open_track_dialog: function (track) { + this.selected_track = track + this.show_track_details_modal = true } } } diff --git a/web-src/src/pages/SpotifyPageSearch.vue b/web-src/src/pages/SpotifyPageSearch.vue index cee35d9a..03014612 100644 --- a/web-src/src/pages/SpotifyPageSearch.vue +++ b/web-src/src/pages/SpotifyPageSearch.vue @@ -31,8 +31,15 @@

Tracks