| | |
| | | }: FileImageItemProps) => { |
| | | const { id, progress, base64Url, url, name } = file |
| | | const [imagePreviewUrl, setImagePreviewUrl] = useState('') |
| | | const download_url = url ? `${url}&as_attachment=true` : base64Url |
| | | |
| | | return ( |
| | | <> |
| | |
| | | { |
| | | showDeleteAction && ( |
| | | <Button |
| | | className='absolute -right-1.5 -top-1.5 z-[11] hidden h-5 w-5 rounded-full p-0 group-hover/file-image:flex' |
| | | className='hidden group-hover/file-image:flex absolute -right-1.5 -top-1.5 p-0 w-5 h-5 rounded-full z-[11]' |
| | | onClick={() => onRemove?.(id)} |
| | | > |
| | | <RiCloseLine className='h-4 w-4 text-components-button-secondary-text' /> |
| | | <RiCloseLine className='w-4 h-4 text-components-button-secondary-text' /> |
| | | </Button> |
| | | ) |
| | | } |
| | | <FileImageRender |
| | | className='h-[68px] w-[68px] shadow-md' |
| | | className='w-[68px] h-[68px] shadow-md' |
| | | imageUrl={base64Url || url || ''} |
| | | showDownloadAction={showDownloadAction} |
| | | /> |
| | | { |
| | | progress >= 0 && !fileIsUploaded(file) && ( |
| | | <div className='absolute inset-0 z-10 flex items-center justify-center border-[2px] border-effects-image-frame bg-background-overlay-alt'> |
| | | <div className='absolute inset-0 flex items-center justify-center border-[2px] border-effects-image-frame bg-background-overlay-alt z-10'> |
| | | <ProgressCircle |
| | | percentage={progress} |
| | | size={12} |
| | |
| | | } |
| | | { |
| | | progress === -1 && ( |
| | | <div className='absolute inset-0 z-10 flex items-center justify-center border-[2px] border-state-destructive-border bg-background-overlay-destructive'> |
| | | <div className='absolute inset-0 flex items-center justify-center border-[2px] border-state-destructive-border bg-background-overlay-destructive z-10'> |
| | | <ReplayLine |
| | | className='h-5 w-5' |
| | | className='w-5 h-5' |
| | | onClick={() => onReUpload?.(id)} |
| | | /> |
| | | </div> |
| | |
| | | } |
| | | { |
| | | showDownloadAction && ( |
| | | <div className='absolute inset-0.5 z-10 hidden bg-background-overlay-alt bg-opacity-[0.3] group-hover/file-image:block'> |
| | | <div className='hidden group-hover/file-image:block absolute inset-0.5 bg-background-overlay-alt bg-opacity-[0.3] z-10'> |
| | | <div |
| | | className='absolute bottom-0.5 right-0.5 flex h-6 w-6 items-center justify-center rounded-lg bg-components-actionbar-bg shadow-md' |
| | | className='absolute bottom-0.5 right-0.5 flex items-center justify-center w-6 h-6 rounded-lg bg-components-actionbar-bg shadow-md' |
| | | onClick={(e) => { |
| | | e.stopPropagation() |
| | | downloadFile(download_url || '', name) |
| | | downloadFile(url || base64Url || '', name) |
| | | }} |
| | | > |
| | | <RiDownloadLine className='h-4 w-4 text-text-tertiary' /> |
| | | <RiDownloadLine className='w-4 h-4 text-text-tertiary' /> |
| | | </div> |
| | | </div> |
| | | ) |