2021-09-01 20:07:11 -05:00
|
|
|
<template>
|
|
|
|
<modals-modal v-model="show" width="90%">
|
2023-12-10 17:53:27 -06:00
|
|
|
<div class="w-full h-full bg-primary rounded-lg border border-fg/20">
|
2021-09-01 20:07:11 -05:00
|
|
|
<ul class="w-full rounded-lg text-base" role="listbox" aria-labelledby="listbox-label">
|
|
|
|
<template v-for="item in items">
|
2023-12-10 17:53:27 -06:00
|
|
|
<li :key="item.value" class="text-fg select-none relative py-4 pr-9 cursor-pointer" :class="item.value === selected ? 'bg-bg bg-opacity-50' : ''" role="option" @click="clickedOption(item.value)">
|
2021-09-01 20:07:11 -05:00
|
|
|
<div class="flex items-center">
|
|
|
|
<span class="font-normal ml-3 block truncate text-lg">{{ item.text }}</span>
|
|
|
|
</div>
|
2021-11-14 19:59:34 -06:00
|
|
|
<span v-if="item.value === selected" class="text-yellow-300 absolute inset-y-0 right-0 flex items-center pr-4">
|
|
|
|
<span class="material-icons text-3xl">{{ descending ? 'south' : 'north' }}</span>
|
2021-09-01 20:07:11 -05:00
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</modals-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: Boolean,
|
|
|
|
orderBy: String,
|
2023-05-20 17:12:36 -05:00
|
|
|
descending: Boolean,
|
|
|
|
episodes: Boolean
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-04-12 18:40:35 -05:00
|
|
|
bookItems: [
|
2021-09-01 20:07:11 -05:00
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelTitle,
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.title'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelAuthorFirstLast,
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.authorName'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelAuthorLastFirst,
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.authorNameLF'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
2022-08-25 17:50:55 -05:00
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelPublishYear,
|
2022-08-25 17:50:55 -05:00
|
|
|
value: 'media.metadata.publishedYear'
|
|
|
|
},
|
2021-09-01 20:07:11 -05:00
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelAddedAt,
|
2021-09-01 20:07:11 -05:00
|
|
|
value: 'addedAt'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelSize,
|
2021-09-01 20:07:11 -05:00
|
|
|
value: 'size'
|
2022-04-17 17:54:13 -05:00
|
|
|
},
|
2022-05-22 14:47:07 -05:00
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelDuration,
|
2022-05-22 14:47:07 -05:00
|
|
|
value: 'media.duration'
|
|
|
|
},
|
2022-04-17 17:54:13 -05:00
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelFileBirthtime,
|
2022-04-17 17:54:13 -05:00
|
|
|
value: 'birthtimeMs'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelFileModified,
|
2022-04-17 17:54:13 -05:00
|
|
|
value: 'mtimeMs'
|
2021-09-01 20:07:11 -05:00
|
|
|
}
|
2022-04-12 18:40:35 -05:00
|
|
|
],
|
|
|
|
podcastItems: [
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelTitle,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'media.metadata.title'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelAuthor,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'media.metadata.author'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelAddedAt,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'addedAt'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelSize,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'size'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelFileBirthtime,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'birthtimeMs'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelFileModified,
|
2022-04-12 18:40:35 -05:00
|
|
|
value: 'mtimeMs'
|
|
|
|
}
|
2023-05-20 17:12:36 -05:00
|
|
|
],
|
|
|
|
episodeItems: [
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelPubDate,
|
2023-05-20 17:12:36 -05:00
|
|
|
value: 'publishedAt'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelTitle,
|
2023-05-20 17:12:36 -05:00
|
|
|
value: 'title'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelSeason,
|
2023-05-20 17:12:36 -05:00
|
|
|
value: 'season'
|
|
|
|
},
|
|
|
|
{
|
2023-12-03 17:37:01 -06:00
|
|
|
text: this.$strings.LabelEpisode,
|
2023-05-20 17:12:36 -05:00
|
|
|
value: 'episode'
|
|
|
|
}
|
2021-09-01 20:07:11 -05:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show: {
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', val)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selected: {
|
|
|
|
get() {
|
|
|
|
return this.orderBy
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('update:orderBy', val)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selectedDesc: {
|
|
|
|
get() {
|
|
|
|
return this.descending
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('update:descending', val)
|
|
|
|
}
|
2022-04-12 18:40:35 -05:00
|
|
|
},
|
|
|
|
isPodcast() {
|
|
|
|
return this.$store.getters['libraries/getCurrentLibraryMediaType'] === 'podcast'
|
|
|
|
},
|
|
|
|
items() {
|
2023-05-20 17:12:36 -05:00
|
|
|
if (this.episodes) return this.episodeItems
|
2022-04-12 18:40:35 -05:00
|
|
|
if (this.isPodcast) return this.podcastItems
|
|
|
|
return this.bookItems
|
2021-09-01 20:07:11 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-12-08 00:28:28 -05:00
|
|
|
async clickedOption(val) {
|
2023-01-08 15:32:15 -06:00
|
|
|
await this.$hapticsImpact()
|
2021-09-01 20:07:11 -05:00
|
|
|
if (this.selected === val) {
|
|
|
|
this.selectedDesc = !this.selectedDesc
|
|
|
|
} else {
|
2021-10-16 15:50:13 -05:00
|
|
|
if (val === 'recent' || val === 'addedAt') this.selectedDesc = true // Progress defaults to descending
|
2021-09-01 20:07:11 -05:00
|
|
|
this.selected = val
|
|
|
|
}
|
|
|
|
this.show = false
|
|
|
|
this.$nextTick(() => this.$emit('change', val))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
2022-12-08 00:28:28 -05:00
|
|
|
</script>
|