From b10679b53cf43f889cc995796570be0aa447fb6d Mon Sep 17 00:00:00 2001 From: puri-ph4tt Date: Tue, 28 Nov 2023 09:22:44 +0700 Subject: [PATCH] refactor: file info preview mime type, icon, type --- Services/client/src/components/FileIcon.vue | 9 +- .../client/src/components/FileSearched.vue | 7 +- .../01_user/components/FileDownload.vue | 19 ++- Services/client/src/stores/file-info-data.ts | 119 ++++++++++-------- 4 files changed, 85 insertions(+), 69 deletions(-) diff --git a/Services/client/src/components/FileIcon.vue b/Services/client/src/components/FileIcon.vue index bf31845..4ed9f4c 100644 --- a/Services/client/src/components/FileIcon.vue +++ b/Services/client/src/components/FileIcon.vue @@ -3,7 +3,7 @@ import { useFileInfoStore } from '@/stores/file-info-data' const { mimeFileMapping } = useFileInfoStore() -defineProps<{ fileMimeType: any; size: string }>() +defineProps<{ fileMimeType: string | undefined; size: string }>() function getIcon(mimeType: string) { if (mimeFileMapping.hasOwnProperty(mimeType)) { @@ -23,13 +23,16 @@ function getSize(s: string) { if (s === 'preview') { return '6em' } + if (s === 'list') { + return '2em' + } } diff --git a/Services/client/src/components/FileSearched.vue b/Services/client/src/components/FileSearched.vue index bcd654b..32d849d 100644 --- a/Services/client/src/components/FileSearched.vue +++ b/Services/client/src/components/FileSearched.vue @@ -2,6 +2,7 @@ import { storeToRefs } from 'pinia' import { useSearchDataStore } from '@/stores/searched-data' import { useFileInfoStore } from '@/stores/file-info-data' +import FileIcon from '@/components/FileIcon.vue' const { foundFile } = storeToRefs(useSearchDataStore()) const { isPreview } = storeToRefs(useFileInfoStore()) @@ -27,7 +28,11 @@ const { getFileInfo } = useFileInfoStore() " > - + {{ value.title }} diff --git a/Services/client/src/modules/01_user/components/FileDownload.vue b/Services/client/src/modules/01_user/components/FileDownload.vue index b2f7c8b..2ad3c57 100644 --- a/Services/client/src/modules/01_user/components/FileDownload.vue +++ b/Services/client/src/modules/01_user/components/FileDownload.vue @@ -6,8 +6,7 @@ import { useFileInfoStore } from '@/stores/file-info-data' import FileIcon from '@/components/FileIcon.vue' const { isPreview, fileInfo } = storeToRefs(useFileInfoStore()) -const { getType } = useFileInfoStore() -const fileIconComp = ref>() +const { getType, getFormatDate, getSize } = useFileInfoStore()