vue · 1269 bytes Raw Blame History
1 <template>
2 <AppLayout>
3 <div class="files-view">
4 <!-- Upload modal -->
5 <Modal v-if="showUploadModal" @close="showUploadModal = false">
6 <template #title>Upload Files</template>
7 <FileUpload
8 :current-path="currentPath"
9 @uploaded="handleUploaded"
10 @close="showUploadModal = false"
11 />
12 </Modal>
13
14 <!-- File browser -->
15 <FileBrowser @upload="showUploadModal = true" />
16 </div>
17 </AppLayout>
18 </template>
19
20 <script setup lang="ts">
21 import { ref, computed } from 'vue'
22 import { useRoute } from 'vue-router'
23 import { useFilesStore } from '@/stores/files'
24 import AppLayout from '@/components/AppLayout.vue'
25 import FileBrowser from '@/components/FileBrowser.vue'
26 import FileUpload from '@/components/FileUpload.vue'
27 import Modal from '@/components/Modal.vue'
28
29 const route = useRoute()
30 const filesStore = useFilesStore()
31
32 const showUploadModal = ref(false)
33
34 const currentPath = computed(() => {
35 const path = Array.isArray(route.params.path) ? '/' + route.params.path.join('/') : route.params.path || '/'
36 return path
37 })
38
39 function handleUploaded(fileIds: string[]) {
40 showUploadModal.value = false
41 // Refresh the current directory
42 filesStore.loadDirectory(currentPath.value)
43 }
44 </script>