diff --git a/web/satellite/src/components/browser/FileEntry.vue b/web/satellite/src/components/browser/FileEntry.vue index 02ed7c73d..98005430c 100644 --- a/web/satellite/src/components/browser/FileEntry.vue +++ b/web/satellite/src/components/browser/FileEntry.vue @@ -124,6 +124,7 @@ import { BrowserObject, useObjectBrowserStore } from '@/store/modules/objectBrow import { useAppStore } from '@/store/modules/appStore'; import { useConfigStore } from '@/store/modules/configStore'; import { AnalyticsHttpApi } from '@/api/analytics'; +import { ObjectType } from '@/utils/objectIcon'; import TableItem from '@/components/common/TableItem.vue'; @@ -154,32 +155,7 @@ const deleteConfirmation = ref(false); /** * Return the type of the file. */ -const fileType = computed((): string => { - const image = /(\.jpg|\.jpeg|\.png|\.gif)$/i; - const video = /(\.mp4|\.mkv|\.mov)$/i; - const audio = /(\.mp3|\.aac|\.wav|\.m4a)$/i; - const text = /(\.txt|\.docx|\.doc|\.pages)$/i; - const pdf = /(\.pdf)$/i; - const archive = /(\.zip|\.tar.gz|\.7z|\.rar)$/i; - const spreadsheet = /(\.xls|\.numbers|\.csv|\.xlsx|\.tsv)$/i; - - if (image.exec(props.file.Key)) { - return 'image'; - } else if (video.exec(props.file.Key)) { - return 'video'; - } else if (audio.exec(props.file.Key)) { - return 'audio'; - } else if (text.exec(props.file.Key)) { - return 'text'; - } else if (pdf.exec(props.file.Key)) { - return 'pdf'; - } else if (archive.exec(props.file.Key)) { - return 'archive'; - } else if (spreadsheet.exec(props.file.Key)) { - return 'spreadsheet'; - } - return 'file'; -}); +const fileType = computed((): string => ObjectType.findType(props.file.Key)); /** * Return the size of the file formatted. diff --git a/web/satellite/src/components/common/TableItem.vue b/web/satellite/src/components/common/TableItem.vue index 00d6d7f51..d3932f584 100644 --- a/web/satellite/src/components/common/TableItem.vue +++ b/web/satellite/src/components/common/TableItem.vue @@ -44,26 +44,13 @@ import { computed } from 'vue'; import { ProjectRole } from '@/types/projectMembers'; +import { ObjectType } from '@/utils/objectIcon'; import VTableCheckbox from '@/components/common/VTableCheckbox.vue'; import BucketGuide from '@/components/objects/BucketGuide.vue'; import MiddleTruncate from '@/components/browser/MiddleTruncate.vue'; import ProjectOwnershipTag from '@/components/project/ProjectOwnershipTag.vue'; -import TableLockedIcon from '@/../static/images/browser/tableLocked.svg'; -import ColorFolderIcon from '@/../static/images/objects/colorFolder.svg'; -import ColorBucketIcon from '@/../static/images/objects/colorBucket.svg'; -import FileIcon from '@/../static/images/objects/file.svg'; -import AudioIcon from '@/../static/images/objects/audio.svg'; -import VideoIcon from '@/../static/images/objects/video.svg'; -import ChevronLeftIcon from '@/../static/images/objects/chevronLeft.svg'; -import GraphIcon from '@/../static/images/objects/graph.svg'; -import PdfIcon from '@/../static/images/objects/pdf.svg'; -import PictureIcon from '@/../static/images/objects/picture.svg'; -import TxtIcon from '@/../static/images/objects/txt.svg'; -import ZipIcon from '@/../static/images/objects/zip.svg'; -import ProjectIcon from '@/../static/images/navigation/project.svg'; - const props = withDefaults(defineProps<{ selectDisabled?: boolean; selectHidden?: boolean; @@ -91,23 +78,7 @@ const props = withDefaults(defineProps<{ const emit = defineEmits(['selectClicked']); -const icons = new Map([ - ['locked', TableLockedIcon], - ['bucket', ColorBucketIcon], - ['folder', ColorFolderIcon], - ['file', FileIcon], - ['audio', AudioIcon], - ['video', VideoIcon], - ['back', ChevronLeftIcon], - ['spreadsheet', GraphIcon], - ['pdf', PdfIcon], - ['image', PictureIcon], - ['text', TxtIcon], - ['archive', ZipIcon], - ['project', ProjectIcon], -]); - -const icon = computed(() => icons.get(props.itemType.toLowerCase())); +const icon = computed((): string => ObjectType.findIcon(props.itemType)); const customIconClasses = computed(() => { const classes = {}; diff --git a/web/satellite/src/components/modals/objectUpload/ObjectsUploadingModal.vue b/web/satellite/src/components/modals/objectUpload/ObjectsUploadingModal.vue index 47860fcc8..a824f7c42 100644 --- a/web/satellite/src/components/modals/objectUpload/ObjectsUploadingModal.vue +++ b/web/satellite/src/components/modals/objectUpload/ObjectsUploadingModal.vue @@ -6,7 +6,10 @@