2021-09-01 20:07:11 -05:00
|
|
|
<template>
|
|
|
|
<modals-modal v-model="show" width="90%">
|
|
|
|
<div class="w-full h-full bg-primary rounded-lg border border-white border-opacity-20">
|
|
|
|
<ul class="w-full rounded-lg text-base" role="listbox" aria-labelledby="listbox-label">
|
|
|
|
<template v-for="item in items">
|
|
|
|
<li :key="item.value" class="text-gray-50 select-none relative py-4 pr-9 cursor-pointer hover:bg-black-400" :class="item.value === selected ? 'bg-bg bg-opacity-50' : ''" role="option" @click="clickedOption(item.value)">
|
|
|
|
<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,
|
|
|
|
descending: Boolean
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-04-12 18:40:35 -05:00
|
|
|
bookItems: [
|
2021-09-01 20:07:11 -05:00
|
|
|
{
|
|
|
|
text: 'Title',
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.title'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Author (First Last)',
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.authorName'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Author (Last, First)',
|
2022-04-07 19:59:23 -05:00
|
|
|
value: 'media.metadata.authorNameLF'
|
2021-09-01 20:07:11 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Added At',
|
|
|
|
value: 'addedAt'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Size',
|
|
|
|
value: 'size'
|
2022-04-17 17:54:13 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'File Birthtime',
|
|
|
|
value: 'birthtimeMs'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'File Modified',
|
|
|
|
value: 'mtimeMs'
|
2021-09-01 20:07:11 -05:00
|
|
|
}
|
2022-04-12 18:40:35 -05:00
|
|
|
],
|
|
|
|
podcastItems: [
|
|
|
|
{
|
|
|
|
text: 'Title',
|
|
|
|
value: 'media.metadata.title'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Author',
|
|
|
|
value: 'media.metadata.author'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Added At',
|
|
|
|
value: 'addedAt'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'Size',
|
|
|
|
value: 'size'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'File Birthtime',
|
|
|
|
value: 'birthtimeMs'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: 'File Modified',
|
|
|
|
value: 'mtimeMs'
|
|
|
|
}
|
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() {
|
|
|
|
if (this.isPodcast) return this.podcastItems
|
|
|
|
return this.bookItems
|
2021-09-01 20:07:11 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
clickedOption(val) {
|
|
|
|
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() {}
|
|
|
|
}
|
|
|
|
</script>
|