66} from 'react-icons-material-design' ;
77import type { ColumnDef } from '@tanstack/react-table' ;
88import { useTranslation } from 'i18n' ;
9+ import compact from 'lodash/compact' ;
910import { UserSegment } from '@types' ;
1011import { useFormatDateTime } from 'utils/date-time' ;
1112import { cn } from 'utils/style' ;
@@ -41,18 +42,21 @@ export const useColumns = ({
4142 cell : ( { row } ) => {
4243 const segment = row . original ;
4344 const { id, name } = segment ;
45+ const isUploading = getUploadingStatus ( segment ) ;
4446
4547 return (
4648 < div
47- onClick = { ( ) => onActionHandler ( segment , 'EDIT' ) }
49+ onClick = { ( ) =>
50+ onActionHandler ( segment , isUploading ? 'UPLOADING' : 'EDIT' )
51+ }
4852 className = "flex items-center gap-x-2 cursor-pointer min-w-[300px]"
4953 >
5054 < NameWithTooltip
5155 id = { id }
5256 content = { < NameWithTooltip . Content content = { name } id = { id } /> }
5357 trigger = { < NameWithTooltip . Trigger id = { id } name = { name } /> }
5458 />
55- { getUploadingStatus ( segment ) && < Spinner /> }
59+ { isUploading && < Spinner /> }
5660 </ div >
5761 ) ;
5862 }
@@ -157,14 +161,14 @@ export const useColumns = ({
157161
158162 return (
159163 < DisabledPopoverTooltip
160- options = { [
164+ options = { compact ( [
161165 {
162166 label : `${ t ( 'table:popover.download-segment' ) } ` ,
163167 icon : IconCloudDownloadOutlined ,
164168 value : 'DOWNLOAD' ,
165169 disabled : ! Number ( segment . includedUserCount )
166170 } ,
167- {
171+ ! getUploadingStatus ( segment ) && {
168172 label : `${ t ( 'table:popover.edit-segment' ) } ` ,
169173 icon : IconEditOutlined ,
170174 value : 'EDIT'
@@ -174,7 +178,7 @@ export const useColumns = ({
174178 icon : IconDeleteOutlined ,
175179 value : 'DELETE'
176180 }
177- ] }
181+ ] ) }
178182 onClick = { value =>
179183 onActionHandler ( segment , value as UserSegmentsActionsType )
180184 }
0 commit comments