sceyt-chat-react-uikit 1.9.2-beta.2 → 1.9.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ChatContainer/index.d.ts +13 -0
- package/index.js +38 -18
- package/index.modern.js +38 -18
- package/package.json +1 -1
|
@@ -19,6 +19,19 @@ export interface IUploadTask {
|
|
|
19
19
|
}
|
|
20
20
|
export interface ICustomUploader {
|
|
21
21
|
upload: (attachment: IAttachment, uploadTask: IUploadTask, messageType: string | null | undefined) => void;
|
|
22
|
+
/**
|
|
23
|
+
* `messageId` is the ID of a message the attachment appears in, supplied by
|
|
24
|
+
* the client. Treat it as a hint, not proof of access:
|
|
25
|
+
* - Media previews (images, videos, voice, video thumbnails) are shared and
|
|
26
|
+
* cached by `uri`. When several messages use the same file (e.g. forwards),
|
|
27
|
+
* only the first request's ID is sent, and its failure is shared too.
|
|
28
|
+
* - A file already in the browser's attachment cache is served without
|
|
29
|
+
* calling `download`; that cache is per origin, not per user.
|
|
30
|
+
* - It may be empty (`''`) or missing for messages that are not confirmed yet.
|
|
31
|
+
* The backend must verify that the caller can read the message and that
|
|
32
|
+
* `uri` legitimately belongs to it (e.g. traced to its original upload),
|
|
33
|
+
* before serving the file.
|
|
34
|
+
*/
|
|
22
35
|
download: (uri: string, download: boolean, progressCallback: (progress: any) => void, messageType: string | null | undefined, messageId?: string | null) => Promise<any>;
|
|
23
36
|
cancelRequest: (requestPromise: any) => void;
|
|
24
37
|
}
|
package/index.js
CHANGED
|
@@ -42018,9 +42018,15 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
42018
42018
|
var previousVideoSourceRef = React.useRef(undefined);
|
|
42019
42019
|
React.useEffect(function () {
|
|
42020
42020
|
if (!videoThumb || downloadedPreviewImage) return;
|
|
42021
|
+
var customDownloader = getCustomDownloader();
|
|
42022
|
+
var previewRequest = customDownloader && !file.messageId ? getAttachmentUrlFromCache(videoThumb)["catch"](function () {
|
|
42023
|
+
return false;
|
|
42024
|
+
}).then(function (cachedUrl) {
|
|
42025
|
+
return typeof cachedUrl === 'string' ? cachedUrl : undefined;
|
|
42026
|
+
}) : downloadVideoThumb(videoThumb, customDownloader, messageType, file.messageId);
|
|
42021
42027
|
var cancelled = false;
|
|
42022
|
-
|
|
42023
|
-
if (!cancelled) {
|
|
42028
|
+
previewRequest.then(function (localPreviewUrl) {
|
|
42029
|
+
if (!cancelled && localPreviewUrl) {
|
|
42024
42030
|
dispatch(setUpdateMessageAttachmentAC(videoThumb, localPreviewUrl));
|
|
42025
42031
|
}
|
|
42026
42032
|
})["catch"](function (error) {
|
|
@@ -42029,7 +42035,7 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
42029
42035
|
return function () {
|
|
42030
42036
|
cancelled = true;
|
|
42031
42037
|
};
|
|
42032
|
-
}, [videoThumb, downloadedPreviewImage, dispatch, messageType]);
|
|
42038
|
+
}, [videoThumb, downloadedPreviewImage, dispatch, messageType, file.messageId]);
|
|
42033
42039
|
React.useEffect(function () {
|
|
42034
42040
|
var videoSource = src;
|
|
42035
42041
|
var canExtractFirstFrame = shouldExtractVideoFirstFrame(file.metadata);
|
|
@@ -42174,7 +42180,7 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
42174
42180
|
messageTimeBackgroundColor: overlayBackground2
|
|
42175
42181
|
}, !isRepliedMessage && !isPreview && /*#__PURE__*/React__default.createElement(SvgVideoCall, null), videoCurrentTime))));
|
|
42176
42182
|
}, function (prev, next) {
|
|
42177
|
-
return prev.src === next.src && prev.file.id === next.file.id && prev.file.url === next.file.url && prev.file.metadata === next.file.metadata && prev.uploading === next.uploading && prev.downloading === next.downloading && prev.width === next.width && prev.height === next.height && prev.borderRadius === next.borderRadius && prev.isRepliedMessage === next.isRepliedMessage && prev.isDetailsView === next.isDetailsView;
|
|
42183
|
+
return prev.src === next.src && prev.file.id === next.file.id && prev.file.messageId === next.file.messageId && prev.messageType === next.messageType && prev.file.url === next.file.url && prev.file.metadata === next.file.metadata && prev.uploading === next.uploading && prev.downloading === next.downloading && prev.width === next.width && prev.height === next.height && prev.borderRadius === next.borderRadius && prev.isRepliedMessage === next.isRepliedMessage && prev.isDetailsView === next.isDetailsView;
|
|
42178
42184
|
});
|
|
42179
42185
|
var VideoControls = styled__default.div(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 6;\n"])));
|
|
42180
42186
|
var VideoTime = styled__default.div(_templateObject2$q || (_templateObject2$q = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: ", ";\n font-size: ", ";\n display: flex;\n align-items: center;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n line-height: 14px;\n color: ", ";\n z-index: 10;\n\n & > svg {\n color: ", ";\n margin-right: 4px;\n }\n"])), function (props) {
|
|
@@ -42347,18 +42353,22 @@ var Attachment = function Attachment(_ref) {
|
|
|
42347
42353
|
var _useState8 = React.useState(false),
|
|
42348
42354
|
downloadIsCancelled = _useState8[0],
|
|
42349
42355
|
setDownloadIsCancelled = _useState8[1];
|
|
42350
|
-
var _useState9 = React.useState(
|
|
42351
|
-
|
|
42352
|
-
|
|
42356
|
+
var _useState9 = React.useState(false),
|
|
42357
|
+
fileDownloadFailed = _useState9[0],
|
|
42358
|
+
setFileDownloadFailed = _useState9[1];
|
|
42359
|
+
var fileDownloadCancelledRef = React.useRef(false);
|
|
42353
42360
|
var _useState0 = React.useState(0),
|
|
42354
|
-
|
|
42355
|
-
|
|
42356
|
-
var _useState1 = React.useState(
|
|
42357
|
-
|
|
42358
|
-
|
|
42361
|
+
videoDownloadRetry = _useState0[0],
|
|
42362
|
+
setVideoDownloadRetry = _useState0[1];
|
|
42363
|
+
var _useState1 = React.useState(0),
|
|
42364
|
+
imageDownloadRetry = _useState1[0],
|
|
42365
|
+
setImageDownloadRetry = _useState1[1];
|
|
42359
42366
|
var _useState10 = React.useState(false),
|
|
42360
|
-
|
|
42361
|
-
|
|
42367
|
+
isOriginalImageRestarting = _useState10[0],
|
|
42368
|
+
setIsOriginalImageRestarting = _useState10[1];
|
|
42369
|
+
var _useState11 = React.useState(false),
|
|
42370
|
+
isOriginalVideoRestarting = _useState11[0],
|
|
42371
|
+
setIsOriginalVideoRestarting = _useState11[1];
|
|
42362
42372
|
var originalVideoDownloadStartedRef = React.useRef(false);
|
|
42363
42373
|
var videoDownloadRequestRef = React.useRef(0);
|
|
42364
42374
|
var imageDownloadRequestRef = React.useRef(0);
|
|
@@ -42394,7 +42404,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42394
42404
|
var isPreparingVideo = attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING;
|
|
42395
42405
|
var isSharedOriginalVideoDownloading = sharedOriginalVideoDownload.state === 'loading';
|
|
42396
42406
|
var isSharedOriginalVideoCancelled = sharedOriginalVideoDownload.state === 'cancelled';
|
|
42397
|
-
var
|
|
42407
|
+
var isSharedOriginalVideoFailed = sharedOriginalVideoDownload.state === 'failed';
|
|
42408
|
+
var shouldShowVideoDownloadRetry = !isSharedOriginalVideoDownloading && !isOriginalVideoRestarting && (isSharedOriginalVideoCancelled || isSharedOriginalVideoFailed || !originalVideoDownloadKey && downloadIsCancelled);
|
|
42398
42409
|
var isVideoDownloading = downloadingFile || isSharedOriginalVideoDownloading;
|
|
42399
42410
|
var isVideoDownloadActive = isVideoDownloading || isOriginalVideoRestarting;
|
|
42400
42411
|
var shouldRenderVideoDownloadProgress = Boolean(!isRepliedMessage && !isPreview && (isInUploadingState || isVideoDownloadActive));
|
|
@@ -42455,7 +42466,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42455
42466
|
e.stopPropagation();
|
|
42456
42467
|
if (downloadIsCancelled) {
|
|
42457
42468
|
setDownloadIsCancelled(false);
|
|
42458
|
-
if (
|
|
42469
|
+
if (customDownloader) {
|
|
42459
42470
|
handleResumeOriginalImageDownload(e);
|
|
42460
42471
|
} else {
|
|
42461
42472
|
downloadImage(attachment.url);
|
|
@@ -42484,9 +42495,10 @@ var Attachment = function Attachment(_ref) {
|
|
|
42484
42495
|
closeMessageActions(enter);
|
|
42485
42496
|
}
|
|
42486
42497
|
};
|
|
42487
|
-
var handleCompleteDownload = function handleCompleteDownload(attachmentId) {
|
|
42498
|
+
var handleCompleteDownload = function handleCompleteDownload(attachmentId, failed) {
|
|
42488
42499
|
if (attachmentId === attachment.id) {
|
|
42489
42500
|
setDownloadingFile(false);
|
|
42501
|
+
setFileDownloadFailed(!!failed && !fileDownloadCancelledRef.current);
|
|
42490
42502
|
}
|
|
42491
42503
|
};
|
|
42492
42504
|
var handleStopStartDownloadFile = function handleStopStartDownloadFile(att) {
|
|
@@ -42500,6 +42512,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42500
42512
|
}
|
|
42501
42513
|
} else {
|
|
42502
42514
|
setDownloadIsCancelled(true);
|
|
42515
|
+
fileDownloadCancelledRef.current = true;
|
|
42503
42516
|
var attachmentId = att ? att.id : attachment.id;
|
|
42504
42517
|
cancelDownloadFile(attachmentId || '');
|
|
42505
42518
|
}
|
|
@@ -42516,6 +42529,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42516
42529
|
var handleDownloadFileToDevice = function handleDownloadFileToDevice(attachment) {
|
|
42517
42530
|
setDownloadingFile(true);
|
|
42518
42531
|
setDownloadIsCancelled(false);
|
|
42532
|
+
setFileDownloadFailed(false);
|
|
42533
|
+
fileDownloadCancelledRef.current = false;
|
|
42519
42534
|
downloadFile(attachment, true, handleCompleteDownload, function (progress) {
|
|
42520
42535
|
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
42521
42536
|
var uploadPercent = loadedRes && loadedRes * 100;
|
|
@@ -43396,6 +43411,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
43396
43411
|
})) : isPreview && attachment.attachmentUrl ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
|
|
43397
43412
|
src: attachment.attachmentUrl || attachmentUrl
|
|
43398
43413
|
})) : attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING && attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.PAUSED && (selectedFileAttachmentsIcon || /*#__PURE__*/React__default.createElement(SvgFileIcon, null)))), !isRepliedMessage && !isPreview && (/*#__PURE__*/React__default.createElement(DownloadFile$1, {
|
|
43414
|
+
role: 'button',
|
|
43415
|
+
"aria-label": fileDownloadFailed ? 'Download failed, retry' : 'Download file',
|
|
43416
|
+
visible: fileDownloadFailed && !downloadingFile,
|
|
43399
43417
|
widthThumb: !!attachmentThumb,
|
|
43400
43418
|
backgroundColor: attachmentThumb ? overlayBackground2 : accentColor,
|
|
43401
43419
|
onClick: function onClick() {
|
|
@@ -43491,7 +43509,9 @@ var FileThumbnailSkeleton = styled__default.div(_templateObject5$h || (_template
|
|
|
43491
43509
|
}, function (props) {
|
|
43492
43510
|
return props.color;
|
|
43493
43511
|
}, fileThumbnailShimmer);
|
|
43494
|
-
var DownloadFile$1 = styled__default.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display:
|
|
43512
|
+
var DownloadFile$1 = styled__default.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display: ", ";\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
|
|
43513
|
+
return props.visible ? 'flex' : 'none';
|
|
43514
|
+
}, function (props) {
|
|
43495
43515
|
return props.backgroundColor;
|
|
43496
43516
|
}, function (props) {
|
|
43497
43517
|
return props.widthThumb && 'absolute';
|
package/index.modern.js
CHANGED
|
@@ -41999,9 +41999,15 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
41999
41999
|
var previousVideoSourceRef = useRef(undefined);
|
|
42000
42000
|
useEffect(function () {
|
|
42001
42001
|
if (!videoThumb || downloadedPreviewImage) return;
|
|
42002
|
+
var customDownloader = getCustomDownloader();
|
|
42003
|
+
var previewRequest = customDownloader && !file.messageId ? getAttachmentUrlFromCache(videoThumb)["catch"](function () {
|
|
42004
|
+
return false;
|
|
42005
|
+
}).then(function (cachedUrl) {
|
|
42006
|
+
return typeof cachedUrl === 'string' ? cachedUrl : undefined;
|
|
42007
|
+
}) : downloadVideoThumb(videoThumb, customDownloader, messageType, file.messageId);
|
|
42002
42008
|
var cancelled = false;
|
|
42003
|
-
|
|
42004
|
-
if (!cancelled) {
|
|
42009
|
+
previewRequest.then(function (localPreviewUrl) {
|
|
42010
|
+
if (!cancelled && localPreviewUrl) {
|
|
42005
42011
|
dispatch(setUpdateMessageAttachmentAC(videoThumb, localPreviewUrl));
|
|
42006
42012
|
}
|
|
42007
42013
|
})["catch"](function (error) {
|
|
@@ -42010,7 +42016,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
42010
42016
|
return function () {
|
|
42011
42017
|
cancelled = true;
|
|
42012
42018
|
};
|
|
42013
|
-
}, [videoThumb, downloadedPreviewImage, dispatch, messageType]);
|
|
42019
|
+
}, [videoThumb, downloadedPreviewImage, dispatch, messageType, file.messageId]);
|
|
42014
42020
|
useEffect(function () {
|
|
42015
42021
|
var videoSource = src;
|
|
42016
42022
|
var canExtractFirstFrame = shouldExtractVideoFirstFrame(file.metadata);
|
|
@@ -42155,7 +42161,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
42155
42161
|
messageTimeBackgroundColor: overlayBackground2
|
|
42156
42162
|
}, !isRepliedMessage && !isPreview && /*#__PURE__*/React__default.createElement(SvgVideoCall, null), videoCurrentTime))));
|
|
42157
42163
|
}, function (prev, next) {
|
|
42158
|
-
return prev.src === next.src && prev.file.id === next.file.id && prev.file.url === next.file.url && prev.file.metadata === next.file.metadata && prev.uploading === next.uploading && prev.downloading === next.downloading && prev.width === next.width && prev.height === next.height && prev.borderRadius === next.borderRadius && prev.isRepliedMessage === next.isRepliedMessage && prev.isDetailsView === next.isDetailsView;
|
|
42164
|
+
return prev.src === next.src && prev.file.id === next.file.id && prev.file.messageId === next.file.messageId && prev.messageType === next.messageType && prev.file.url === next.file.url && prev.file.metadata === next.file.metadata && prev.uploading === next.uploading && prev.downloading === next.downloading && prev.width === next.width && prev.height === next.height && prev.borderRadius === next.borderRadius && prev.isRepliedMessage === next.isRepliedMessage && prev.isDetailsView === next.isDetailsView;
|
|
42159
42165
|
});
|
|
42160
42166
|
var VideoControls = styled.div(_templateObject$t || (_templateObject$t = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 6;\n"])));
|
|
42161
42167
|
var VideoTime = styled.div(_templateObject2$q || (_templateObject2$q = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: ", ";\n font-size: ", ";\n display: flex;\n align-items: center;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n line-height: 14px;\n color: ", ";\n z-index: 10;\n\n & > svg {\n color: ", ";\n margin-right: 4px;\n }\n"])), function (props) {
|
|
@@ -42328,18 +42334,22 @@ var Attachment = function Attachment(_ref) {
|
|
|
42328
42334
|
var _useState8 = useState(false),
|
|
42329
42335
|
downloadIsCancelled = _useState8[0],
|
|
42330
42336
|
setDownloadIsCancelled = _useState8[1];
|
|
42331
|
-
var _useState9 = useState(
|
|
42332
|
-
|
|
42333
|
-
|
|
42337
|
+
var _useState9 = useState(false),
|
|
42338
|
+
fileDownloadFailed = _useState9[0],
|
|
42339
|
+
setFileDownloadFailed = _useState9[1];
|
|
42340
|
+
var fileDownloadCancelledRef = useRef(false);
|
|
42334
42341
|
var _useState0 = useState(0),
|
|
42335
|
-
|
|
42336
|
-
|
|
42337
|
-
var _useState1 = useState(
|
|
42338
|
-
|
|
42339
|
-
|
|
42342
|
+
videoDownloadRetry = _useState0[0],
|
|
42343
|
+
setVideoDownloadRetry = _useState0[1];
|
|
42344
|
+
var _useState1 = useState(0),
|
|
42345
|
+
imageDownloadRetry = _useState1[0],
|
|
42346
|
+
setImageDownloadRetry = _useState1[1];
|
|
42340
42347
|
var _useState10 = useState(false),
|
|
42341
|
-
|
|
42342
|
-
|
|
42348
|
+
isOriginalImageRestarting = _useState10[0],
|
|
42349
|
+
setIsOriginalImageRestarting = _useState10[1];
|
|
42350
|
+
var _useState11 = useState(false),
|
|
42351
|
+
isOriginalVideoRestarting = _useState11[0],
|
|
42352
|
+
setIsOriginalVideoRestarting = _useState11[1];
|
|
42343
42353
|
var originalVideoDownloadStartedRef = useRef(false);
|
|
42344
42354
|
var videoDownloadRequestRef = useRef(0);
|
|
42345
42355
|
var imageDownloadRequestRef = useRef(0);
|
|
@@ -42375,7 +42385,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42375
42385
|
var isPreparingVideo = attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING;
|
|
42376
42386
|
var isSharedOriginalVideoDownloading = sharedOriginalVideoDownload.state === 'loading';
|
|
42377
42387
|
var isSharedOriginalVideoCancelled = sharedOriginalVideoDownload.state === 'cancelled';
|
|
42378
|
-
var
|
|
42388
|
+
var isSharedOriginalVideoFailed = sharedOriginalVideoDownload.state === 'failed';
|
|
42389
|
+
var shouldShowVideoDownloadRetry = !isSharedOriginalVideoDownloading && !isOriginalVideoRestarting && (isSharedOriginalVideoCancelled || isSharedOriginalVideoFailed || !originalVideoDownloadKey && downloadIsCancelled);
|
|
42379
42390
|
var isVideoDownloading = downloadingFile || isSharedOriginalVideoDownloading;
|
|
42380
42391
|
var isVideoDownloadActive = isVideoDownloading || isOriginalVideoRestarting;
|
|
42381
42392
|
var shouldRenderVideoDownloadProgress = Boolean(!isRepliedMessage && !isPreview && (isInUploadingState || isVideoDownloadActive));
|
|
@@ -42436,7 +42447,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42436
42447
|
e.stopPropagation();
|
|
42437
42448
|
if (downloadIsCancelled) {
|
|
42438
42449
|
setDownloadIsCancelled(false);
|
|
42439
|
-
if (
|
|
42450
|
+
if (customDownloader) {
|
|
42440
42451
|
handleResumeOriginalImageDownload(e);
|
|
42441
42452
|
} else {
|
|
42442
42453
|
downloadImage(attachment.url);
|
|
@@ -42465,9 +42476,10 @@ var Attachment = function Attachment(_ref) {
|
|
|
42465
42476
|
closeMessageActions(enter);
|
|
42466
42477
|
}
|
|
42467
42478
|
};
|
|
42468
|
-
var handleCompleteDownload = function handleCompleteDownload(attachmentId) {
|
|
42479
|
+
var handleCompleteDownload = function handleCompleteDownload(attachmentId, failed) {
|
|
42469
42480
|
if (attachmentId === attachment.id) {
|
|
42470
42481
|
setDownloadingFile(false);
|
|
42482
|
+
setFileDownloadFailed(!!failed && !fileDownloadCancelledRef.current);
|
|
42471
42483
|
}
|
|
42472
42484
|
};
|
|
42473
42485
|
var handleStopStartDownloadFile = function handleStopStartDownloadFile(att) {
|
|
@@ -42481,6 +42493,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42481
42493
|
}
|
|
42482
42494
|
} else {
|
|
42483
42495
|
setDownloadIsCancelled(true);
|
|
42496
|
+
fileDownloadCancelledRef.current = true;
|
|
42484
42497
|
var attachmentId = att ? att.id : attachment.id;
|
|
42485
42498
|
cancelDownloadFile(attachmentId || '');
|
|
42486
42499
|
}
|
|
@@ -42497,6 +42510,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42497
42510
|
var handleDownloadFileToDevice = function handleDownloadFileToDevice(attachment) {
|
|
42498
42511
|
setDownloadingFile(true);
|
|
42499
42512
|
setDownloadIsCancelled(false);
|
|
42513
|
+
setFileDownloadFailed(false);
|
|
42514
|
+
fileDownloadCancelledRef.current = false;
|
|
42500
42515
|
downloadFile(attachment, true, handleCompleteDownload, function (progress) {
|
|
42501
42516
|
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
42502
42517
|
var uploadPercent = loadedRes && loadedRes * 100;
|
|
@@ -43377,6 +43392,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
43377
43392
|
})) : isPreview && attachment.attachmentUrl ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
|
|
43378
43393
|
src: attachment.attachmentUrl || attachmentUrl
|
|
43379
43394
|
})) : attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING && attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.PAUSED && (selectedFileAttachmentsIcon || /*#__PURE__*/React__default.createElement(SvgFileIcon, null)))), !isRepliedMessage && !isPreview && (/*#__PURE__*/React__default.createElement(DownloadFile$1, {
|
|
43395
|
+
role: 'button',
|
|
43396
|
+
"aria-label": fileDownloadFailed ? 'Download failed, retry' : 'Download file',
|
|
43397
|
+
visible: fileDownloadFailed && !downloadingFile,
|
|
43380
43398
|
widthThumb: !!attachmentThumb,
|
|
43381
43399
|
backgroundColor: attachmentThumb ? overlayBackground2 : accentColor,
|
|
43382
43400
|
onClick: function onClick() {
|
|
@@ -43472,7 +43490,9 @@ var FileThumbnailSkeleton = styled.div(_templateObject5$h || (_templateObject5$h
|
|
|
43472
43490
|
}, function (props) {
|
|
43473
43491
|
return props.color;
|
|
43474
43492
|
}, fileThumbnailShimmer);
|
|
43475
|
-
var DownloadFile$1 = styled.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display:
|
|
43493
|
+
var DownloadFile$1 = styled.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display: ", ";\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
|
|
43494
|
+
return props.visible ? 'flex' : 'none';
|
|
43495
|
+
}, function (props) {
|
|
43476
43496
|
return props.backgroundColor;
|
|
43477
43497
|
}, function (props) {
|
|
43478
43498
|
return props.widthThumb && 'absolute';
|