From 7b87d130167606313df049ad53fa8aeb177d181a Mon Sep 17 00:00:00 2001 From: Yoones Khoshghadam Date: Thu, 5 Dec 2024 04:04:08 +0000 Subject: [PATCH] fix (nc-gui): grid cell use new icons --- .../components/cell/attachment/IconView.vue | 13 +++++++ .../components/cell/attachment/index.vue | 15 +------- .../nc-gui/composables/useAttachmentIcon.ts | 38 +++++++++++++++++++ 3 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 packages/nc-gui/components/cell/attachment/IconView.vue create mode 100644 packages/nc-gui/composables/useAttachmentIcon.ts diff --git a/packages/nc-gui/components/cell/attachment/IconView.vue b/packages/nc-gui/components/cell/attachment/IconView.vue new file mode 100644 index 0000000000..80422eacb5 --- /dev/null +++ b/packages/nc-gui/components/cell/attachment/IconView.vue @@ -0,0 +1,13 @@ + + + diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index 88a89e2143..5617e5d759 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -261,16 +261,7 @@ defineExpose({ @click="onFileClick(item)" /> - - - +
@@ -433,9 +424,7 @@ defineExpose({ }" @click="onFileClick(item)" > - - - +
diff --git a/packages/nc-gui/composables/useAttachmentIcon.ts b/packages/nc-gui/composables/useAttachmentIcon.ts new file mode 100644 index 0000000000..b4aaf18df8 --- /dev/null +++ b/packages/nc-gui/composables/useAttachmentIcon.ts @@ -0,0 +1,38 @@ + +export const useAttachmentIcon = (title: MaybeRefOrGetter, mimetype: MaybeRefOrGetter) => { + return computed(() => { + if (isImage(toValue(title) || '', toValue(mimetype))) { + return 'image' + } + + if (isPdf(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypePdf' + } + + if (isVideo(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypeVideo' + } + + if (isAudio(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypeAudio' + } + + if (isWord(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypeWord' + } + + if (isExcel(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypeExcel' + } + + if (isPresentation(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypePresentation' + } + + if (isZip(toValue(title) || '', toValue(mimetype))) { + return 'ncFileTypeZip' + } + + return 'ncFileTypeUnknown' + }) +}