From 27516e4368a969e93e795bd78cf7fa919bbc48ac Mon Sep 17 00:00:00 2001 From: Yoones Khoshghadam Date: Thu, 5 Dec 2024 04:04:08 +0000 Subject: [PATCH 1/3] fix (nc-gui): icon size and color in grid view attachment cell --- .../components/cell/attachment/Modal.vue | 18 ++++++++++++++++-- .../components/cell/attachment/index.vue | 4 ++-- .../expanded-form/Sidebar/Audits.vue | 7 ++++++- .../workspace/integrations/ConnectionsTab.vue | 1 - 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/components/cell/attachment/Modal.vue b/packages/nc-gui/components/cell/attachment/Modal.vue index e54dbc0fd3..369b78302f 100644 --- a/packages/nc-gui/components/cell/attachment/Modal.vue +++ b/packages/nc-gui/components/cell/attachment/Modal.vue @@ -158,9 +158,23 @@ const handleFileDelete = (i: number) => { @click.stop="onClick(item)" /> - + - +
diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index e3a0351357..88a89e2143 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -433,9 +433,9 @@ defineExpose({ }" @click="onFileClick(item)" > - + - +
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue index 88fe61e22e..8ace242c7d 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/Audits.vue @@ -83,7 +83,12 @@ watch(
- +
diff --git a/packages/nc-gui/components/workspace/integrations/ConnectionsTab.vue b/packages/nc-gui/components/workspace/integrations/ConnectionsTab.vue index e219210d9e..c5ea772a2e 100644 --- a/packages/nc-gui/components/workspace/integrations/ConnectionsTab.vue +++ b/packages/nc-gui/components/workspace/integrations/ConnectionsTab.vue @@ -464,7 +464,6 @@ onKeyStroke('ArrowDown', onDown) + +const props = defineProps<{ + item: any +}>() + +const icon = useAttachmentIcon(() => props.item.title, props.item.mimetype) + + + + 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' + }) +} From b8ebb1df043e139730468110b3747991505fdcae Mon Sep 17 00:00:00 2001 From: Yoones Khoshghadam Date: Thu, 5 Dec 2024 04:04:08 +0000 Subject: [PATCH 3/3] fix (nc-gui): polished attachment cell item sizing and positioning --- .../components/cell/attachment/index.vue | 82 ++++++++----------- 1 file changed, 32 insertions(+), 50 deletions(-) diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index 5617e5d759..b582582dc3 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -320,13 +320,7 @@ defineExpose({
@@ -346,14 +340,14 @@ defineExpose({
- + @@ -362,11 +356,11 @@ defineExpose({ type="secondary" size="xsmall" data-testid="attachment-cell-file-picker-button" - class="!px-2 !h-5.5 !min-w-[fit-content]" + class="!px-2 !h-7 !min-w-[fit-content]" @click.stop="open" > -
- +
+ {{ $t('activity.addFiles') }} @@ -380,54 +374,42 @@ defineExpose({ ref="sortableRef" :class="{ 'justify-center': !isGallery && !isKanban, - 'py-1': rowHeight === 1, - 'py-1.5 !gap-4 ': rowHeight !== 1, }" - class="nc-attachment-wrapper flex cursor-pointer w-full items-center flex-wrap gap-3 nc-scrollbar-thin mt-0 items-start px-[1px]" + class="nc-attachment-wrapper flex cursor-pointer w-full items-center flex-wrap gap-2 mt-0 items-start overflow-y-auto nc-scrollbar-thin" :style="{ - maxHeight: `max(100%, ${isGrid ? '22px' : '32px'})`, + height: `max(${!rowHeight || rowHeight === 1 ? rowHeightInPx['1']: rowHeightInPx[`${rowHeight}`] - 17}px, ${isGrid ? 22 : 32}px)`, + paddingTop: !rowHeight || rowHeight === 1 ? '4px !important' : undefined, + paddingBottom: !rowHeight || rowHeight === 1 ? '4px !important' : undefined, }" > - +
+