2022-04-02 19:43:43 -05:00
|
|
|
<template>
|
|
|
|
<modals-modal v-model="show" :width="300" height="100%">
|
|
|
|
<template #outer>
|
2023-06-04 14:59:55 -05:00
|
|
|
<div class="absolute top-10 left-4 z-40" style="max-width: 80%">
|
2023-12-03 17:37:01 -06:00
|
|
|
<p class="text-white text-lg truncate">{{ $strings.HeaderSelectDownloadLocation }}</p>
|
2022-04-02 19:43:43 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center" @click="show = false">
|
2025-03-03 17:28:07 -06:00
|
|
|
<div ref="container" class="w-full overflow-x-hidden overflow-y-auto bg-primary rounded-lg border border-fg/20" style="max-height: 75%" @click.stop>
|
2022-04-02 19:43:43 -05:00
|
|
|
<ul class="h-full w-full" role="listbox" aria-labelledby="listbox-label">
|
|
|
|
<template v-for="folder in localFolders">
|
2025-03-03 17:28:07 -06:00
|
|
|
<li :key="folder.id" :id="`folder-${folder.id}`" class="text-fg select-none relative py-5" role="option" @click="clickedOption(folder)">
|
2022-04-02 19:43:43 -05:00
|
|
|
<div class="relative flex items-center pl-3" style="padding-right: 4.5rem">
|
2025-03-30 23:26:14 -07:00
|
|
|
<span class="material-symbols text-xl mr-2 text-fg text-opacity-80">folder</span>
|
2025-03-03 17:28:07 -06:00
|
|
|
<p class="font-normal block truncate text-sm text-fg text-opacity-80">{{ folder.name }}</p>
|
2022-04-02 19:43:43 -05:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</modals-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
localFolders: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2023-06-04 14:59:55 -05:00
|
|
|
show(newVal) {
|
|
|
|
if (newVal) {
|
|
|
|
this.$nextTick(this.init)
|
|
|
|
}
|
2022-04-02 19:43:43 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show: {
|
|
|
|
get() {
|
2023-06-04 14:59:55 -05:00
|
|
|
return this.$store.state.globals.showSelectLocalFolderModal
|
2022-04-02 19:43:43 -05:00
|
|
|
},
|
|
|
|
set(val) {
|
2023-06-04 14:59:55 -05:00
|
|
|
this.$store.commit('globals/setShowSelectLocalFolderModal', val)
|
2022-04-02 19:43:43 -05:00
|
|
|
}
|
2023-06-04 14:59:55 -05:00
|
|
|
},
|
|
|
|
modalData() {
|
|
|
|
return this.$store.state.globals.localFolderSelectData || {}
|
|
|
|
},
|
|
|
|
callback() {
|
|
|
|
return this.modalData.callback
|
|
|
|
},
|
|
|
|
mediaType() {
|
|
|
|
return this.modalData.mediaType
|
2022-04-02 19:43:43 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
clickedOption(folder) {
|
2023-06-04 14:59:55 -05:00
|
|
|
this.show = false
|
|
|
|
if (!this.callback) {
|
|
|
|
console.error('Callback not set')
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.callback(folder)
|
2022-04-02 19:43:43 -05:00
|
|
|
},
|
|
|
|
async init() {
|
2023-06-04 14:59:55 -05:00
|
|
|
const localFolders = (await this.$db.getLocalFolders()) || []
|
2023-06-03 17:24:32 -05:00
|
|
|
|
|
|
|
if (!localFolders.some((lf) => lf.id === `internal-${this.mediaType}`)) {
|
|
|
|
localFolders.push({
|
|
|
|
id: `internal-${this.mediaType}`,
|
2023-12-03 17:37:01 -06:00
|
|
|
name: this.$strings.LabelInternalAppStorage,
|
2023-06-03 17:24:32 -05:00
|
|
|
mediaType: this.mediaType
|
|
|
|
})
|
|
|
|
}
|
2022-04-02 19:43:43 -05:00
|
|
|
this.localFolders = localFolders.filter((lf) => lf.mediaType == this.mediaType)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|