diff --git a/web-src/src/components/ListComposers.vue b/web-src/src/components/ListComposers.vue new file mode 100644 index 00000000..e87407d0 --- /dev/null +++ b/web-src/src/components/ListComposers.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/web-src/src/components/ListItemComposer.vue b/web-src/src/components/ListItemComposer.vue new file mode 100644 index 00000000..586a2376 --- /dev/null +++ b/web-src/src/components/ListItemComposer.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/web-src/src/components/ModalDialogComposer.vue b/web-src/src/components/ModalDialogComposer.vue new file mode 100644 index 00000000..7051be42 --- /dev/null +++ b/web-src/src/components/ModalDialogComposer.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/web-src/src/components/TabsMusic.vue b/web-src/src/components/TabsMusic.vue index fe47b9ab..b5353025 100644 --- a/web-src/src/components/TabsMusic.vue +++ b/web-src/src/components/TabsMusic.vue @@ -29,6 +29,12 @@ Genres + + + + Composers + + diff --git a/web-src/src/lib/Composers.js b/web-src/src/lib/Composers.js new file mode 100644 index 00000000..12bad844 --- /dev/null +++ b/web-src/src/lib/Composers.js @@ -0,0 +1,62 @@ + +export default class Composers { + constructor (items, options = { hideSingles: false, hideSpotify: false, sort: 'Name', group: false }) { + this.items = items + this.options = options + this.grouped = {} + this.sortedAndFiltered = [] + this.indexList = [] + + this.init() + } + + init () { + this.createSortedAndFilteredList() + this.createGroupedList() + this.createIndexList() + } + + getComposerIndex (composer) { + if (this.options.sort === 'Name') { + return composer.name_sort.charAt(0).toUpperCase() + } + return composer.time_added.substring(0, 4) + } + + isComposerVisible (composer) { + if (this.options.hideSingles && composer.track_count <= (composer.album_count * 2)) { + return false + } + if (this.options.hideSpotify && composer.data_kind === 'spotify') { + return false + } + return true + } + + createIndexList () { + this.indexList = [...new Set(this.sortedAndFiltered + .map(composer => this.getComposerIndex(composer)))] + } + + createSortedAndFilteredList () { + var composersSorted = this.items + if (this.options.hideSingles || this.options.hideSpotify || this.options.hideOther) { + composersSorted = composersSorted.filter(composer => this.isComposerVisible(composer)) + } + if (this.options.sort === 'Recently added') { + composersSorted = [...composersSorted].sort((a, b) => b.time_added.localeCompare(a.time_added)) + } + this.sortedAndFiltered = composersSorted + } + + createGroupedList () { + if (!this.options.group) { + this.grouped = {} + } + this.grouped = this.sortedAndFiltered.reduce((r, composer) => { + const idx = this.getComposerIndex(composer) + r[idx] = [...r[idx] || [], composer] + return r + }, {}) + } +} diff --git a/web-src/src/pages/PageComposer.vue b/web-src/src/pages/PageComposer.vue new file mode 100644 index 00000000..328d6758 --- /dev/null +++ b/web-src/src/pages/PageComposer.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/web-src/src/pages/PageComposerTracks.vue b/web-src/src/pages/PageComposerTracks.vue new file mode 100644 index 00000000..1b3cad35 --- /dev/null +++ b/web-src/src/pages/PageComposerTracks.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/web-src/src/pages/PageComposers.vue b/web-src/src/pages/PageComposers.vue new file mode 100644 index 00000000..96a5d793 --- /dev/null +++ b/web-src/src/pages/PageComposers.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/web-src/src/pages/PageSearch.vue b/web-src/src/pages/PageSearch.vue index a4ae6848..e695ed09 100644 --- a/web-src/src/pages/PageSearch.vue +++ b/web-src/src/pages/PageSearch.vue @@ -94,6 +94,28 @@ + + + + + + + + + +