From fa98cb91777a4e49dcddd169706a85b7ec829fd9 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 20 Nov 2023 12:08:17 -0800 Subject: [PATCH] Refactor empty folder to a separate component, allow creating new folders in empty folders again. --- frontend/src/components/EmptyFolder.vue | 37 +++++++++++++++++++++++++ frontend/src/repositories/Document.ts | 6 ++++ frontend/src/views/ExplorerView.vue | 29 ++++--------------- 3 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 frontend/src/components/EmptyFolder.vue diff --git a/frontend/src/components/EmptyFolder.vue b/frontend/src/components/EmptyFolder.vue new file mode 100644 index 0000000..4313f8a --- /dev/null +++ b/frontend/src/components/EmptyFolder.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/frontend/src/repositories/Document.ts b/frontend/src/repositories/Document.ts index 1ee9d46..2b311d8 100644 --- a/frontend/src/repositories/Document.ts +++ b/frontend/src/repositories/Document.ts @@ -40,6 +40,12 @@ export class Doc { const ext = this.name.split('.').pop()?.toLowerCase() return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'svg'].includes(ext || '') } + get previewable(): boolean { + if (this.img) return true + const ext = this.name.split('.').pop()?.toLowerCase() + // Not a comprehensive list, but good enough for now + return ['mp4', 'mkv', 'webm', 'ogg', 'mp3', 'flac', 'aac', 'pdf'].includes(ext || '') + } get previewurl(): string { return this.url.replace(/^\/files/, '/preview') } diff --git a/frontend/src/views/ExplorerView.vue b/frontend/src/views/ExplorerView.vue index 6511945..4ec9aef 100644 --- a/frontend/src/views/ExplorerView.vue +++ b/frontend/src/views/ExplorerView.vue @@ -1,14 +1,6 @@