Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): attachment drop overlay in expanded form and form view

Ramesh Manedec5329ff6f3
diff --git a/packages/nc-gui/components/cell/attachment/Card.vue b/packages/nc-gui/components/cell/attachment/Card.vue
index 7d2b4eb70a..c796c42c1d 100644
--- a/packages/nc-gui/components/cell/attachment/Card.vue
+++ b/packages/nc-gui/components/cell/attachment/Card.vue
@@ -89,7 +89,7 @@ const handleFileDeleteStart = () => {
</script>
<template>
- <div class="nc-attachment-item group gap-1 flex border-1 rounded-md border-gray-200 flex-col relative">
+ <div class="nc-attachment-item group gap-1 flex border-1 rounded-md border-nc-border-gray-medium flex-col relative">
<NcCheckbox
v-if="allowSelection"
v-model:checked="isSelected"
@@ -117,7 +117,7 @@ const handleFileDeleteStart = () => {
<div class="relative px-1 pb-1 items-center flex" :title="attachment.title">
<div
- class="flex w-full text-[12px] items-center text-gray-700 cursor-default h-5"
+ class="flex w-full text-[12px] items-center text-nc-content-gray-subtle cursor-default h-5"
:class="{ truncate: !isRenamingFile }"
@dblclick.stop="allowRename && isEditAllowed && handleFileRenameStart()"
>
@@ -140,13 +140,13 @@ const handleFileDeleteStart = () => {
/>
</div>
<div
- class="flex-none hide-ui transition-all transition-ease-in-out !h-5 gap-0.5 flex items-center bg-white"
+ class="flex-none hide-ui transition-all transition-ease-in-out !h-5 gap-0.5 flex items-center bg-nc-bg-default"
:class="{ '!h-auto !w-auto !overflow-visible !whitespace-normal': isRenamingFile }"
>
<NcTooltip placement="bottom">
<template #title> {{ $t('title.downloadFile') }} </template>
<NcButton
- class="!p-0 !w-5 !h-5 !text-gray-500 !min-w-[fit-content]"
+ class="!p-0 !w-5 !h-5 !text-nc-content-gray-muted !min-w-[fit-content]"
size="xsmall"
type="text"
@click="downloadAttachment(attachment)"
@@ -159,7 +159,7 @@ const handleFileDeleteStart = () => {
<template #title> {{ $t('title.renameFile') }} </template>
<NcButton
size="xsmall"
- class="!p-0 nc-attachment-rename !h-5 !w-5 !text-gray-500 !min-w-[fit-content] gap-2"
+ class="!p-0 nc-attachment-rename !h-5 !w-5 !text-nc-content-gray-muted !min-w-[fit-content] gap-2"
type="text"
@click="handleFileRenameStart"
>
@@ -170,7 +170,7 @@ const handleFileDeleteStart = () => {
<NcTooltip v-if="allowDelete && isEditAllowed" placement="bottom">
<template #title> {{ $t('title.removeFile') }} </template>
<NcButton
- class="!p-0 !h-5 !w-5 !text-red-500 nc-attachment-remove !min-w-[fit-content]"
+ class="!p-0 !h-5 !w-5 !text-nc-fill-red-medium nc-attachment-remove !min-w-[fit-content]"
size="xsmall"
type="text"
@click="handleFileDeleteStart"
diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue
index 62fbef8b5e..1084dd268e 100644
--- a/packages/nc-gui/components/cell/attachment/index.vue
+++ b/packages/nc-gui/components/cell/attachment/index.vue
@@ -321,14 +321,14 @@ onUnmounted(() => {
</script>
<template>
- <div v-if="isExpandedForm || isForm" class="form-attachment-cell">
+ <div v-if="isExpandedForm || isForm" class="form-attachment-cell relative">
<LazyCellAttachmentCarousel v-if="selectedFile" />
<div v-if="visibleItems.length > 0" ref="sortableRef" class="flex flex-wrap items-stretch mb-2 gap-2">
<CellAttachmentCard
v-for="(item, i) in expandedFormVisibelItems"
:key="`${item?.title}-${i}`"
v-model:dragging="dragging"
- class="nc-attachment-item group gap-2 flex border-1 rounded-md border-gray-200 flex-col relative w-[124px] overflow-hidden"
+ class="nc-attachment-item group gap-2 flex border-1 bg-nc-bg-default rounded-md border-nc-border-gray-medium flex-col relative w-[124px] overflow-hidden"
:attachment="item"
:index="i"
:allow-selection="false"
@@ -370,6 +370,17 @@ onUnmounted(() => {
</NcTooltip>
</div>
+ <div
+ v-if="!isReadonly && !dragging && !!currentCellRef && isOverDropZone && visibleItems.length"
+ class="absolute -top-1 -left-1 -right-1 bottom-0 border-dashed border-2 border-nc-fill-primary rounded-lg flex flex-col items-center justify-center"
+ >
+ <GeneralIcon icon="upload" class="flex-none w-6 h-6 text-nc-content-brand" />
+
+ <div class="p-3">
+ <h1 class="text-nc-content-brand font-bold">{{ $t('labels.dropHere') }}</h1>
+ </div>
+ </div>
+
<LazyGeneralDeleteModal
v-model:visible="isConfirmModalOpen"
entity-name="File"
@@ -430,7 +441,7 @@ onUnmounted(() => {
@click.stop="openAttachmentModal"
>
<div class="flex items-center gap-1 justify-center">
- <GeneralIcon icon="upload" class="text-gray-500 text-[10px] h-3.5 w-3.5" />
+ <GeneralIcon icon="upload" class="text-nc-content-gray-muted text-[10px] h-3.5 w-3.5" />
<span class="text-[11px]">
{{ $t('activity.addFiles') }}
</span>
@@ -501,7 +512,7 @@ onUnmounted(() => {
>
<component :is="iconMap.reload" v-if="isLoading" :class="{ 'animate-infinite animate-spin': isLoading }" />
- <component :is="iconMap.maximize" v-else class="transform group-hover:(!text-gray-800) text-gray-700 w-3 h-3" />
+ <component :is="iconMap.maximize" v-else class="transform group-hover:(!text-nc-content-gray) text-nc-content-gray-subtle w-3 h-3" />
</NcButton>
</NcTooltip>
@@ -523,7 +534,7 @@ onUnmounted(() => {
class="!p-0 !w-5 !h-5 !min-w-[fit-content] add-files"
@click.stop="openAttachmentModal"
>
- <GeneralIcon icon="ncPaperclip" class="w-3 group-hover:(!text-gray-800) text-nc-content-gray-subtle" />
+ <GeneralIcon icon="ncPaperclip" class="w-3 group-hover:(!text-nc-content-gray) text-nc-content-gray-subtle" />
</NcButton>
</NcTooltip>
</template>
@@ -551,7 +562,7 @@ onUnmounted(() => {
.nc-cell {
.nc-attachment-cell {
.nc-attachment {
- @apply min-h-5.5 !ring-1 !ring-gray-300 !rounded;
+ @apply min-h-5.5 !ring-1 !ring-nc-border-gray-dark !rounded;
}
.ghost,