Refactor empty folder to a separate component, allow creating new folders in empty folders again.

This commit is contained in:
Leo Vasanko
2023-11-20 12:08:17 -08:00
parent b3ab09a614
commit fa98cb9177
3 changed files with 48 additions and 24 deletions

View File

@@ -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')
}