@bindu-dashing/dam-solution-v2 5.8.97 → 5.8.99
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.
|
@@ -194,12 +194,20 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
194
194
|
},
|
|
195
195
|
});
|
|
196
196
|
const onDownloadFile = () => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
const downloadUrl = get(file, "thumbnailUrl") || get(file, "downloadUrl");
|
|
198
|
+
const isSingleFile = file && get(fileIds, "length", 0) <= 1;
|
|
199
|
+
// If single file with downloadUrl available, open directly in new tab
|
|
200
|
+
if (isSingleFile && downloadUrl) {
|
|
201
|
+
window.open(downloadUrl, "_blank");
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// For multiple files/folders or when downloadUrl is not available, use API
|
|
205
|
+
downloadFileMutation.mutate({
|
|
206
|
+
fileIds: file ? [get(file, "_id")] : fileIds,
|
|
207
|
+
folderIds: folderIds,
|
|
208
|
+
api,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
203
211
|
};
|
|
204
212
|
const onFavSuccess = (message) => {
|
|
205
213
|
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
|
|
@@ -11,6 +11,6 @@ const ImageViewer = ({ file }) => {
|
|
|
11
11
|
const zoomOptions = ["10", "25", "50", "75", "100"];
|
|
12
12
|
const imgWidth = 750 * (parseInt(zoom) / 100);
|
|
13
13
|
// const imgHeight = 333 * (parseInt(zoom) / 100);
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "md-lib-relative md-lib-flex md-lib-justify-center md-lib-items-center md-lib-h-[calc(100vh-65px)] md-lib-w-full md-lib-overflow-x-auto", children: _jsx("img", { src: get(file, "s3Url", SAMPLE_IMAGE_URL), alt: "", width: imgWidth, height: "auto" }) }), isAdmin && (_jsx(ImageOptions, { zoom: zoom, setZoom: setZoom, zoomOptions: zoomOptions, file: file }))] }));
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "md-lib-relative md-lib-flex md-lib-justify-center md-lib-items-center md-lib-h-[calc(100vh-65px)] md-lib-w-full md-lib-overflow-x-auto", children: _jsx("img", { src: get(file, "s3Url") || get(file, "downloadUrl") || get(file, "thumbnailUrl", SAMPLE_IMAGE_URL), alt: get(file, "name", ""), width: imgWidth, height: "auto" }) }), isAdmin && (_jsx(ImageOptions, { zoom: zoom, setZoom: setZoom, zoomOptions: zoomOptions, file: file }))] }));
|
|
15
15
|
};
|
|
16
16
|
export default ImageViewer;
|
|
@@ -17,7 +17,7 @@ const PreviewDetails = ({ file, hasPrev, hasNext, onPrev, onNext, }) => {
|
|
|
17
17
|
return _jsx(ImageViewer, { file: file });
|
|
18
18
|
}
|
|
19
19
|
else if (startsWith(mimetype, "video/")) {
|
|
20
|
-
return _jsx(VideoPlayer, { src: get(file, "s3Url") });
|
|
20
|
+
return _jsx(VideoPlayer, { src: get(file, "s3Url") || get(file, "downloadUrl") || get(file, "thumbnailUrl", "") });
|
|
21
21
|
}
|
|
22
22
|
// else if (mimetype === "application/pdf") {
|
|
23
23
|
// // return <PDFViewer fileUrl={get(file, "s3Url")} file={file} />;
|