@anji-dashing/dam-solution-v2 5.8.173
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/README.md +53 -0
- package/build/AssetType/AddFieldProperties.d.ts +10 -0
- package/build/AssetType/AddFieldProperties.js +359 -0
- package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
- package/build/AssetType/AssetTemplatesTable.js +172 -0
- package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
- package/build/AssetType/CreateAssetTemplate.js +70 -0
- package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
- package/build/AssetType/CreateOrEditAssetTemplate.js +100 -0
- package/build/AssetType/DraggedField.d.ts +14 -0
- package/build/AssetType/DraggedField.js +58 -0
- package/build/AssetType/EditAssetTemplate.d.ts +5 -0
- package/build/AssetType/EditAssetTemplate.js +257 -0
- package/build/AssetType/FieldsSection.d.ts +14 -0
- package/build/AssetType/FieldsSection.js +268 -0
- package/build/AssetType/assetTemplatesContainer.d.ts +2 -0
- package/build/AssetType/assetTemplatesContainer.js +71 -0
- package/build/AssetType/fieldProperties/DateField.d.ts +5 -0
- package/build/AssetType/fieldProperties/DateField.js +23 -0
- package/build/AssetType/fieldProperties/NumberField.d.ts +5 -0
- package/build/AssetType/fieldProperties/NumberField.js +91 -0
- package/build/AssetType/fieldProperties/OptionsField.d.ts +6 -0
- package/build/AssetType/fieldProperties/OptionsField.js +55 -0
- package/build/AssetType/fieldProperties/TextField.d.ts +5 -0
- package/build/AssetType/fieldProperties/TextField.js +92 -0
- package/build/AssetType/index.d.ts +11 -0
- package/build/AssetType/index.js +25 -0
- package/build/AssetType/routes.d.ts +3 -0
- package/build/AssetType/routes.js +17 -0
- package/build/BookView/ProductDescription.d.ts +4 -0
- package/build/BookView/ProductDescription.js +20 -0
- package/build/BookView/bookDetail.d.ts +4 -0
- package/build/BookView/bookDetail.js +106 -0
- package/build/BookView/bookInfo.d.ts +4 -0
- package/build/BookView/bookInfo.js +17 -0
- package/build/BookView/description.d.ts +4 -0
- package/build/BookView/description.js +5 -0
- package/build/BookView/index.d.ts +10 -0
- package/build/BookView/index.js +23 -0
- package/build/CreateClient/CreateClientBtn.d.ts +14 -0
- package/build/CreateClient/CreateClientBtn.js +54 -0
- package/build/CreateClient/CreateClientForm.d.ts +15 -0
- package/build/CreateClient/CreateClientForm.js +347 -0
- package/build/CreateClient/index.d.ts +20 -0
- package/build/CreateClient/index.js +18 -0
- package/build/ImagePicker/MetaFieldOptions.d.ts +14 -0
- package/build/ImagePicker/MetaFieldOptions.js +75 -0
- package/build/ImagePicker/TestImagePickerModal.d.ts +8 -0
- package/build/ImagePicker/TestImagePickerModal.js +72 -0
- package/build/ImagePicker/TestImgFromMetaData.d.ts +7 -0
- package/build/ImagePicker/TestImgFromMetaData.js +82 -0
- package/build/ImagePicker/imagePickerComponent.d.ts +6 -0
- package/build/ImagePicker/imagePickerComponent.js +63 -0
- package/build/ImagePicker/index.d.ts +13 -0
- package/build/ImagePicker/index.js +24 -0
- package/build/ImagePicker/routes.d.ts +6 -0
- package/build/ImagePicker/routes.js +17 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.d.ts +8 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.js +223 -0
- package/build/ImagePickerFilters/index.d.ts +12 -0
- package/build/ImagePickerFilters/index.js +19 -0
- package/build/MyDrive/ActionBar.d.ts +8 -0
- package/build/MyDrive/ActionBar.js +190 -0
- package/build/MyDrive/AddDrive.d.ts +5 -0
- package/build/MyDrive/AddDrive.js +189 -0
- package/build/MyDrive/AddFolder.d.ts +11 -0
- package/build/MyDrive/AddFolder.js +165 -0
- package/build/MyDrive/BreadCrumbList.d.ts +10 -0
- package/build/MyDrive/BreadCrumbList.js +81 -0
- package/build/MyDrive/BulkUploadModal.d.ts +2 -0
- package/build/MyDrive/BulkUploadModal.js +324 -0
- package/build/MyDrive/DriveContainer.d.ts +14 -0
- package/build/MyDrive/DriveContainer.js +343 -0
- package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
- package/build/MyDrive/FileDownloadHistory.js +107 -0
- package/build/MyDrive/FileMenuOptions.d.ts +11 -0
- package/build/MyDrive/FileMenuOptions.js +450 -0
- package/build/MyDrive/FilesGridView.d.ts +9 -0
- package/build/MyDrive/FilesGridView.js +25 -0
- package/build/MyDrive/FolderGridView.d.ts +20 -0
- package/build/MyDrive/FolderGridView.js +95 -0
- package/build/MyDrive/FolderListView.d.ts +26 -0
- package/build/MyDrive/FolderListView.js +226 -0
- package/build/MyDrive/FolderMenuOptions.d.ts +5 -0
- package/build/MyDrive/FolderMenuOptions.js +350 -0
- package/build/MyDrive/FolderTree.d.ts +8 -0
- package/build/MyDrive/FolderTree.js +479 -0
- package/build/MyDrive/ImageEditor/EditImage.d.ts +6 -0
- package/build/MyDrive/ImageEditor/EditImage.js +97 -0
- package/build/MyDrive/ImageEditor/EditImageModal.d.ts +8 -0
- package/build/MyDrive/ImageEditor/EditImageModal.js +30 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.d.ts +10 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.js +99 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.d.ts +8 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.js +35 -0
- package/build/MyDrive/ImagePickerDrive.d.ts +1 -0
- package/build/MyDrive/ImagePickerDrive.js +41 -0
- package/build/MyDrive/MyDriveMainContainer.d.ts +6 -0
- package/build/MyDrive/MyDriveMainContainer.js +63 -0
- package/build/MyDrive/SearchFilter.d.ts +8 -0
- package/build/MyDrive/SearchFilter.js +73 -0
- package/build/MyDrive/ShareBtn.d.ts +5 -0
- package/build/MyDrive/ShareBtn.js +19 -0
- package/build/MyDrive/ToggleView.d.ts +4 -0
- package/build/MyDrive/ToggleView.js +12 -0
- package/build/MyDrive/UploadStatusModal.d.ts +12 -0
- package/build/MyDrive/UploadStatusModal.js +52 -0
- package/build/MyDrive/fileDetails/CommentEntity.d.ts +8 -0
- package/build/MyDrive/fileDetails/CommentEntity.js +102 -0
- package/build/MyDrive/fileDetails/Comments.d.ts +6 -0
- package/build/MyDrive/fileDetails/Comments.js +65 -0
- package/build/MyDrive/fileDetails/Compliance.d.ts +2 -0
- package/build/MyDrive/fileDetails/Compliance.js +18 -0
- package/build/MyDrive/fileDetails/CreateComment.d.ts +7 -0
- package/build/MyDrive/fileDetails/CreateComment.js +48 -0
- package/build/MyDrive/fileDetails/Editor.d.ts +6 -0
- package/build/MyDrive/fileDetails/Editor.js +55 -0
- package/build/MyDrive/fileDetails/EmojiPicker.d.ts +5 -0
- package/build/MyDrive/fileDetails/EmojiPicker.js +6 -0
- package/build/MyDrive/fileDetails/FileDetails.d.ts +11 -0
- package/build/MyDrive/fileDetails/FileDetails.js +125 -0
- package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
- package/build/MyDrive/fileDetails/FileHeader.js +27 -0
- package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
- package/build/MyDrive/fileDetails/FileViewer.js +17 -0
- package/build/MyDrive/fileDetails/ImageOptions.d.ts +2 -0
- package/build/MyDrive/fileDetails/ImageOptions.js +44 -0
- package/build/MyDrive/fileDetails/ImageViewer.d.ts +6 -0
- package/build/MyDrive/fileDetails/ImageViewer.js +16 -0
- package/build/MyDrive/fileDetails/ManageFile.d.ts +7 -0
- package/build/MyDrive/fileDetails/ManageFile.js +34 -0
- package/build/MyDrive/fileDetails/MetaForm.d.ts +15 -0
- package/build/MyDrive/fileDetails/MetaForm.js +199 -0
- package/build/MyDrive/fileDetails/Metadata.d.ts +8 -0
- package/build/MyDrive/fileDetails/Metadata.js +52 -0
- package/build/MyDrive/fileDetails/PdfOptions.d.ts +9 -0
- package/build/MyDrive/fileDetails/PdfOptions.js +35 -0
- package/build/MyDrive/fileDetails/PdfViewer.d.ts +8 -0
- package/build/MyDrive/fileDetails/PdfViewer.js +18 -0
- package/build/MyDrive/fileDetails/Previewdetails.d.ts +10 -0
- package/build/MyDrive/fileDetails/Previewdetails.js +53 -0
- package/build/MyDrive/fileDetails/VideoPlayer.d.ts +4 -0
- package/build/MyDrive/fileDetails/VideoPlayer.js +21 -0
- package/build/MyDrive/files/AssetSelectionFormItem.d.ts +7 -0
- package/build/MyDrive/files/AssetSelectionFormItem.js +14 -0
- package/build/MyDrive/files/FolderTabs.d.ts +6 -0
- package/build/MyDrive/files/FolderTabs.js +90 -0
- package/build/MyDrive/files/MapFile.d.ts +9 -0
- package/build/MyDrive/files/MapFile.js +239 -0
- package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
- package/build/MyDrive/files/MoveToAnotherFolder.js +67 -0
- package/build/MyDrive/filesListView.d.ts +2 -0
- package/build/MyDrive/filesListView.js +57 -0
- package/build/MyDrive/index.d.ts +16 -0
- package/build/MyDrive/index.js +50 -0
- package/build/MyDrive/routes.d.ts +10 -0
- package/build/MyDrive/routes.js +12 -0
- package/build/PenView/PenDetails.d.ts +4 -0
- package/build/PenView/PenDetails.js +114 -0
- package/build/PenView/ProductDescription.d.ts +5 -0
- package/build/PenView/ProductDescription.js +51 -0
- package/build/PenView/index.d.ts +10 -0
- package/build/PenView/index.js +23 -0
- package/build/RefreshKey/RefreshKeyBtn.d.ts +1 -0
- package/build/RefreshKey/RefreshKeyBtn.js +42 -0
- package/build/RefreshKey/index.d.ts +9 -0
- package/build/RefreshKey/index.js +23 -0
- package/build/ShoesView/ProductDescription.d.ts +4 -0
- package/build/ShoesView/ProductDescription.js +25 -0
- package/build/ShoesView/ShoeDetails.d.ts +4 -0
- package/build/ShoesView/ShoeDetails.js +96 -0
- package/build/ShoesView/index.d.ts +10 -0
- package/build/ShoesView/index.js +23 -0
- package/build/common/Button.d.ts +2 -0
- package/build/common/Button.js +18 -0
- package/build/common/CustomElements.d.ts +98 -0
- package/build/common/CustomElements.js +77 -0
- package/build/common/LoadMoreItems.d.ts +7 -0
- package/build/common/LoadMoreItems.js +33 -0
- package/build/common/RenderFormItem.d.ts +42 -0
- package/build/common/RenderFormItem.js +98 -0
- package/build/common/RenderThumnail.d.ts +7 -0
- package/build/common/RenderThumnail.js +6 -0
- package/build/common/deleteModal.d.ts +1 -0
- package/build/common/deleteModal.js +12 -0
- package/build/common/folders/TypeAndDateFilters.d.ts +13 -0
- package/build/common/folders/TypeAndDateFilters.js +66 -0
- package/build/common/folders/getFolderOrFileIcon.d.ts +2 -0
- package/build/common/folders/getFolderOrFileIcon.js +41 -0
- package/build/common/loader/CustomLoader.d.ts +7 -0
- package/build/common/loader/CustomLoader.js +8 -0
- package/build/common/loader/loader.d.ts +1 -0
- package/build/common/loader/loader.js +6 -0
- package/build/common/notifications.d.ts +2 -0
- package/build/common/notifications.js +30 -0
- package/build/common/steps.d.ts +4 -0
- package/build/common/steps.js +7 -0
- package/build/hocs/AppProvider.d.ts +3 -0
- package/build/hocs/AppProvider.js +11 -0
- package/build/hocs/DamConfigContext.d.ts +2 -0
- package/build/hocs/DamConfigContext.js +153 -0
- package/build/hocs/ThemeContext.d.ts +15 -0
- package/build/hocs/ThemeContext.js +131 -0
- package/build/hocs/ToastProvider.d.ts +2 -0
- package/build/hocs/ToastProvider.js +6 -0
- package/build/hocs/appConstants.d.ts +124 -0
- package/build/hocs/appConstants.js +211 -0
- package/build/hocs/configureAxios.d.ts +2 -0
- package/build/hocs/configureAxios.js +65 -0
- package/build/hocs/helpers.d.ts +17 -0
- package/build/hocs/helpers.js +201 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +12 -0
- package/build/react-query/hooks/brand-hooks.d.ts +3 -0
- package/build/react-query/hooks/brand-hooks.js +10 -0
- package/build/react-query/hooks/folder-hooks.d.ts +7 -0
- package/build/react-query/hooks/folder-hooks.js +119 -0
- package/build/react-query/services/brand-services.d.ts +4 -0
- package/build/react-query/services/brand-services.js +41 -0
- package/build/react-query/services/file-services.d.ts +43 -0
- package/build/react-query/services/file-services.js +69 -0
- package/build/react-query/services/folder-services.d.ts +46 -0
- package/build/react-query/services/folder-services.js +87 -0
- package/build/react-query/services/image-picker-services.d.ts +5 -0
- package/build/react-query/services/image-picker-services.js +47 -0
- package/build/settings/InviteTeamModal.d.ts +12 -0
- package/build/settings/InviteTeamModal.js +174 -0
- package/build/settings/UpdateInvitationAccessType.d.ts +9 -0
- package/build/settings/UpdateInvitationAccessType.js +96 -0
- package/build/settings/getUserAvatar.d.ts +7 -0
- package/build/settings/getUserAvatar.js +11 -0
- package/build/style.css +1 -0
- package/build/types/assetType.d.ts +8 -0
- package/build/types/assetType.js +1 -0
- package/build/ui/pageTitle.d.ts +3 -0
- package/build/ui/pageTitle.js +4 -0
- package/build/utilities/FoldersContext.d.ts +16 -0
- package/build/utilities/FoldersContext.js +15 -0
- package/build/utilities/NavigatorProvider.d.ts +2 -0
- package/build/utilities/NavigatorProvider.js +10 -0
- package/build/utilities/constants/apiUrls.d.ts +97 -0
- package/build/utilities/constants/apiUrls.js +117 -0
- package/build/utilities/constants/imageUrls.d.ts +6 -0
- package/build/utilities/constants/imageUrls.js +6 -0
- package/build/utilities/constants/interface.d.ts +371 -0
- package/build/utilities/constants/interface.js +142 -0
- package/build/utilities/constants/messages.d.ts +55 -0
- package/build/utilities/constants/messages.js +55 -0
- package/build/utilities/constants/queryKeys.d.ts +16 -0
- package/build/utilities/constants/queryKeys.js +33 -0
- package/build/utilities/constants/routes.d.ts +22 -0
- package/build/utilities/constants/routes.js +22 -0
- package/build/utilities/helpers/validators.d.ts +12 -0
- package/build/utilities/helpers/validators.js +89 -0
- package/build/utilities/useAppNavigate.d.ts +2 -0
- package/build/utilities/useAppNavigate.js +35 -0
- package/build/utilities/useAppParams.d.ts +8 -0
- package/build/utilities/useAppParams.js +72 -0
- package/package.json +93 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { Pagination } from "antd";
|
|
12
|
+
import { useEffect, useMemo, useState } from "react";
|
|
13
|
+
import CreateComment from "./CreateComment";
|
|
14
|
+
import { EntityType, NotificationStatus, } from "../../utilities/constants/interface";
|
|
15
|
+
import { DEFAULT_PAGE } from "../../hocs/appConstants";
|
|
16
|
+
import { showNotification } from "../../common/notifications";
|
|
17
|
+
import { SOMETHING_WENT_WRONG } from "../../utilities/constants/messages";
|
|
18
|
+
import { get, map } from "lodash";
|
|
19
|
+
import { FETCH_COMMENTS_URL, FETCH_REPLIES_URL, } from "../../utilities/constants/apiUrls";
|
|
20
|
+
import { addQueryParams } from "../../hocs/helpers";
|
|
21
|
+
import CommentEntity from "./CommentEntity";
|
|
22
|
+
import CustomLoader from "../../common/loader/CustomLoader";
|
|
23
|
+
import { createApiClient } from "../../hocs/configureAxios";
|
|
24
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
25
|
+
import { COMMENT_EMPTY_URL } from "../../utilities/constants/imageUrls";
|
|
26
|
+
const Comments = ({ file, parentId, }) => {
|
|
27
|
+
const [state, setState] = useState({
|
|
28
|
+
loading: false,
|
|
29
|
+
comments: [],
|
|
30
|
+
totalPages: 0,
|
|
31
|
+
totalCount: 0,
|
|
32
|
+
currentPage: DEFAULT_PAGE,
|
|
33
|
+
});
|
|
34
|
+
const damConfig = useDamConfig();
|
|
35
|
+
const { brand } = damConfig;
|
|
36
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
37
|
+
const { loading, comments, totalPages, totalCount, currentPage } = state;
|
|
38
|
+
const fetchComments = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (params = {}) {
|
|
39
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: true })));
|
|
40
|
+
const options = parentId
|
|
41
|
+
? params
|
|
42
|
+
: Object.assign(Object.assign({}, params), { referenceId: get(file, "_id"), referenceType: EntityType.FILE });
|
|
43
|
+
try {
|
|
44
|
+
const response = parentId
|
|
45
|
+
? yield api.get(`${FETCH_REPLIES_URL.replace(":commentId", parentId)}?${addQueryParams(options)}`)
|
|
46
|
+
: yield api.get(`${FETCH_COMMENTS_URL.replace(":fileId", get(file, "_id"))}?${addQueryParams(options)}`);
|
|
47
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false, comments: parentId
|
|
48
|
+
? get(response, "data.replies", [])
|
|
49
|
+
: get(response, "data.comments", []), totalCount: get(response, "data.totalCount", 0), totalPages: get(response, "data.totalPages", 0), currentPage: get(response, "data.currentPage", DEFAULT_PAGE) })));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false })));
|
|
53
|
+
showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (brand && (file || parentId)) {
|
|
58
|
+
fetchComments();
|
|
59
|
+
}
|
|
60
|
+
}, [file, parentId]);
|
|
61
|
+
return (_jsxs("div", { className: parentId ? "md-lib-px-2" : "md-lib-px-5 md-lib-min-h-[calc(100vh-135px)]", children: [loading ? (_jsx("div", { className: "md-lib-flex md-lib-justify-center md-lib-mt-8", children: _jsx(CustomLoader, {}) })) : (_jsxs(_Fragment, { children: [totalCount < 1 ? (_jsxs("div", { className: `md-lib-flex md-lib-flex-col md-lib-items-center md-lib-justify-center ${parentId ? "" : ""} `, children: [_jsx("img", { src: COMMENT_EMPTY_URL, alt: "No comments", width: 182, height: 114 }), _jsx("p", { className: "md-lib-pt-3 md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor", children: parentId
|
|
62
|
+
? "No replies has been added yet"
|
|
63
|
+
: "No comments has been added yet" })] })) : (_jsx("div", { className: "md-lib-space-y-6 md-lib-pb-6", children: map(comments, (comment) => (_jsx(CommentEntity, { comment: comment, refreshData: (params) => fetchComments(params), parentId: parentId, file: file }))) })), _jsx(CreateComment, { file: file, refreshData: () => fetchComments(), parentId: parentId })] })), totalPages > 1 && (_jsx(Pagination, { total: totalCount, showSizeChanger: false, onChange: (page) => fetchComments({ page }) }))] }));
|
|
64
|
+
};
|
|
65
|
+
export default Comments;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Select } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { GoPlusCircle } from "react-icons/go";
|
|
5
|
+
import { COMPLIANCE_EMPTY_URL } from "../../utilities/constants/imageUrls";
|
|
6
|
+
const GoPlusCircleIcon = GoPlusCircle;
|
|
7
|
+
const Compliance = () => {
|
|
8
|
+
const [metadata, setMetadata] = useState(true);
|
|
9
|
+
const options = [
|
|
10
|
+
{ value: "basic_product", label: "Basic product" },
|
|
11
|
+
{ value: "basic_product_test", label: "Basic product test" },
|
|
12
|
+
{ value: "basic_details", label: "Basic details" },
|
|
13
|
+
{ value: "basic_properties", label: "Basic properties" },
|
|
14
|
+
{ value: "product_detail", label: "Product Detail" },
|
|
15
|
+
];
|
|
16
|
+
return (_jsx("div", { children: !metadata ? (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-items-center md-lib-justify-center min-h-[calc(100vh-127px)]", children: [_jsx("img", { src: COMPLIANCE_EMPTY_URL, alt: "No comments", width: 182, height: 114 }), _jsx("p", { className: "md-lib-py-3 md-lib-pb-2 md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor", children: "No brand guidelines has been created yet" }), _jsx(Button, { size: "large", type: "primary", icon: _jsx(GoPlusCircleIcon, { size: 24 }), children: "Add Guidelines" })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between md-lib-pb-4 md-lib-gap-2 md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-px-5", children: [_jsx(Select, { options: options, placeholder: "Select Template", className: "md-lib-w-full md-lib-h-12", popupClassName: "custom-template-options" }), _jsx(Button, { size: "large", variant: "outlined", color: "primary", children: "Check" })] }), _jsx("div", { className: "md-lib-p-5" })] })) }));
|
|
17
|
+
};
|
|
18
|
+
export default Compliance;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useMemo, useState } from "react";
|
|
12
|
+
import CustomButton from "../../common/Button";
|
|
13
|
+
import Editor from "./Editor";
|
|
14
|
+
import { showNotification } from "../../common/notifications";
|
|
15
|
+
import { CREATE_SUCCESS, SOMETHING_WENT_WRONG, } from "../../utilities/constants/messages";
|
|
16
|
+
import { EntityType, NotificationStatus, } from "../../utilities/constants/interface";
|
|
17
|
+
import { get, merge } from "lodash";
|
|
18
|
+
import { FETCH_COMMENTS_URL } from "../../utilities/constants/apiUrls";
|
|
19
|
+
import { createApiClient } from "../../hocs/configureAxios";
|
|
20
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
21
|
+
function CreateComment({ file, refreshData, parentId, }) {
|
|
22
|
+
const damConfig = useDamConfig();
|
|
23
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
24
|
+
const [state, setState] = useState({
|
|
25
|
+
editorState: "",
|
|
26
|
+
loading: false,
|
|
27
|
+
});
|
|
28
|
+
const { editorState, loading } = state;
|
|
29
|
+
const handleCreate = () => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: true })));
|
|
31
|
+
try {
|
|
32
|
+
const response = yield api.post(FETCH_COMMENTS_URL, merge({}, {
|
|
33
|
+
referenceId: get(file, "_id"),
|
|
34
|
+
referenceType: EntityType.FILE,
|
|
35
|
+
text: editorState,
|
|
36
|
+
}, parentId ? { parentId } : {}));
|
|
37
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false, editorState: "" })));
|
|
38
|
+
refreshData();
|
|
39
|
+
showNotification(get(response, "data.message", CREATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false })));
|
|
43
|
+
showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-2", children: [_jsx(Editor, { setEditorState: (state) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { editorState: state }))), parentId: parentId }), _jsx("div", { className: "md-lib-flex md-lib-justify-end md-lib-pt-2", children: _jsx(CustomButton, { type: "primary", label: parentId ? "Reply" : "Comment", onClick: handleCreate, loading: loading }) })] }));
|
|
47
|
+
}
|
|
48
|
+
export default CreateComment;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useEditor, EditorContent } from "@tiptap/react";
|
|
4
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
5
|
+
import Underline from "@tiptap/extension-underline";
|
|
6
|
+
import Strike from "@tiptap/extension-strike";
|
|
7
|
+
import { Button } from "antd";
|
|
8
|
+
import { BoldOutlined, ItalicOutlined, UnderlineOutlined, StrikethroughOutlined, SmileOutlined, } from "@ant-design/icons";
|
|
9
|
+
import EmojiPicker from "./EmojiPicker";
|
|
10
|
+
const Editor = ({ setEditorState, editorState, parentId, }) => {
|
|
11
|
+
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
|
12
|
+
const [activeFormats, setActiveFormats] = useState({
|
|
13
|
+
bold: false,
|
|
14
|
+
italic: false,
|
|
15
|
+
underline: false,
|
|
16
|
+
strike: false,
|
|
17
|
+
});
|
|
18
|
+
const editor = useEditor({
|
|
19
|
+
extensions: [StarterKit.configure({}), Underline, Strike],
|
|
20
|
+
content: editorState || "",
|
|
21
|
+
immediatelyRender: false,
|
|
22
|
+
onUpdate: () => {
|
|
23
|
+
updateFormatStates();
|
|
24
|
+
if (setEditorState) {
|
|
25
|
+
setEditorState((editor === null || editor === void 0 ? void 0 : editor.getHTML()) || "");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const updateFormatStates = () => {
|
|
30
|
+
if (!editor)
|
|
31
|
+
return;
|
|
32
|
+
setActiveFormats({
|
|
33
|
+
bold: editor.isActive("bold"),
|
|
34
|
+
italic: editor.isActive("italic"),
|
|
35
|
+
underline: editor.isActive("underline"),
|
|
36
|
+
strike: editor.isActive("strike"),
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!editor)
|
|
41
|
+
return;
|
|
42
|
+
updateFormatStates();
|
|
43
|
+
editor.on("selectionUpdate", updateFormatStates);
|
|
44
|
+
editor.on("transaction", updateFormatStates);
|
|
45
|
+
return () => {
|
|
46
|
+
editor.off("selectionUpdate", updateFormatStates);
|
|
47
|
+
editor.off("transaction", updateFormatStates);
|
|
48
|
+
};
|
|
49
|
+
}, [editor]);
|
|
50
|
+
return (_jsxs("div", { className: "md-lib-w-full md-lib-max-w-2xl md-lib-mx-auto md-lib-mt-8 md-lib-p-2 md-lib-border md-lib-rounded md-lib-shadow-sm", children: [_jsxs("div", { className: "md-lib-flex md-lib-gap-2 mb-4", children: [_jsx(Button, { icon: _jsx(BoldOutlined, {}), onClick: () => editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleBold().run(), type: activeFormats.bold ? "primary" : "default" }), _jsx(Button, { icon: _jsx(ItalicOutlined, {}), onClick: () => editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleItalic().run(), type: activeFormats.italic ? "primary" : "default" }), _jsx(Button, { icon: _jsx(UnderlineOutlined, {}), onClick: () => editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleUnderline().run(), type: activeFormats.underline ? "primary" : "default" }), _jsx(Button, { icon: _jsx(StrikethroughOutlined, {}), onClick: () => editor === null || editor === void 0 ? void 0 : editor.chain().focus().toggleStrike().run(), type: activeFormats.strike ? "primary" : "default" }), _jsx(Button, { icon: _jsx(SmileOutlined, {}), onClick: () => setShowEmojiPicker(!showEmojiPicker) })] }), showEmojiPicker && (_jsx(EmojiPicker, { onSelect: (emoji) => {
|
|
51
|
+
editor === null || editor === void 0 ? void 0 : editor.chain().focus().insertContent(emoji).run();
|
|
52
|
+
setShowEmojiPicker(false);
|
|
53
|
+
} })), _jsx(EditorContent, { editor: editor, className: `md-lib-prose dark:md-lib-prose-invert md-lib-border md-lib-rounded ${parentId ? "md-lib-min-h-14" : "md-lib-min-h-36"} md-lib-p-2 focus:md-lib-outline-none` })] }));
|
|
54
|
+
};
|
|
55
|
+
export default Editor;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import data from "@emoji-mart/data";
|
|
3
|
+
import Picker from "@emoji-mart/react";
|
|
4
|
+
export default function EmojiPicker({ onSelect }) {
|
|
5
|
+
return (_jsx("div", { className: "md-lib-absolute md-lib-z-50 md-lib-mt-2", children: _jsx(Picker, { data: data, onEmojiSelect: (emoji) => onSelect(emoji.native), theme: "light" }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileEntity } from "../../utilities/constants/interface";
|
|
3
|
+
declare const FileDetails: ({ open, handleClose, file, files, fileIds, onCloseSelection, }: {
|
|
4
|
+
handleClose?: () => void;
|
|
5
|
+
open: boolean;
|
|
6
|
+
file?: FileEntity;
|
|
7
|
+
files?: FileEntity[] | undefined;
|
|
8
|
+
fileIds?: string[];
|
|
9
|
+
onCloseSelection?: () => void;
|
|
10
|
+
}) => React.ReactPortal | null;
|
|
11
|
+
export default FileDetails;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import ReactDOM from "react-dom";
|
|
4
|
+
import FileDetailsHeader from "./FileHeader";
|
|
5
|
+
import FileViewer from "./FileViewer";
|
|
6
|
+
import { get, nth } from "lodash";
|
|
7
|
+
import { useFile } from "../../react-query/services/file-services";
|
|
8
|
+
import Loader from "../../common/loader/loader";
|
|
9
|
+
import { createApiClient } from "../../hocs/configureAxios";
|
|
10
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
11
|
+
import useAppParams from "../../utilities/useAppParams";
|
|
12
|
+
const FileDetails = ({ open, handleClose, file, files, fileIds, onCloseSelection, }) => {
|
|
13
|
+
// Get the initial file - prefer file prop, fallback to first item in files array
|
|
14
|
+
const initialFile = useMemo(() => {
|
|
15
|
+
if (file)
|
|
16
|
+
return file;
|
|
17
|
+
if (files && files.length > 0)
|
|
18
|
+
return nth(files, 0);
|
|
19
|
+
return undefined;
|
|
20
|
+
}, [file, files]);
|
|
21
|
+
// Get the initial file ID - from file, files array, or fileIds prop
|
|
22
|
+
const initialFileId = useMemo(() => {
|
|
23
|
+
if (file)
|
|
24
|
+
return get(file, "_id") || "";
|
|
25
|
+
if (files && files.length > 0)
|
|
26
|
+
return get(nth(files, 0), "_id") || "";
|
|
27
|
+
if (fileIds && fileIds.length > 0)
|
|
28
|
+
return fileIds[0];
|
|
29
|
+
return "";
|
|
30
|
+
}, [file, files, fileIds]);
|
|
31
|
+
console.log("## FileDetails - files:", files, "file:", file, "initialFile:", initialFile, "fileIds:", fileIds, "initialFileId:", initialFileId);
|
|
32
|
+
const { id } = useAppParams();
|
|
33
|
+
const damConfig = useDamConfig();
|
|
34
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
35
|
+
const [state, setState] = useState({
|
|
36
|
+
visible: false,
|
|
37
|
+
currentIndex: 0,
|
|
38
|
+
currentFileId: initialFileId,
|
|
39
|
+
});
|
|
40
|
+
const { visible, currentIndex, currentFileId } = state;
|
|
41
|
+
// Update currentFileId when initialFileId changes (e.g., when props load)
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (initialFileId && !currentFileId) {
|
|
44
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentFileId: initialFileId })));
|
|
45
|
+
}
|
|
46
|
+
}, [initialFileId, currentFileId]);
|
|
47
|
+
const { data: fileData, isFetching, refetch } = useFile(api, currentFileId);
|
|
48
|
+
console.log("fileData", fileData, "isFetching", isFetching);
|
|
49
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const prevFileId = useRef();
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const prevFileState = prevFileId.current;
|
|
55
|
+
const shouldRefetch = prevFileState !== currentFileId;
|
|
56
|
+
if (shouldRefetch) {
|
|
57
|
+
refetch();
|
|
58
|
+
}
|
|
59
|
+
prevFileId.current = currentFileId;
|
|
60
|
+
}, [currentFileId]);
|
|
61
|
+
const currentFile = useMemo(() => {
|
|
62
|
+
// Priority: fileData (from API) > file prop > files array item > initialFile
|
|
63
|
+
if (fileData) {
|
|
64
|
+
return fileData;
|
|
65
|
+
}
|
|
66
|
+
else if (id) {
|
|
67
|
+
return file || initialFile;
|
|
68
|
+
}
|
|
69
|
+
else if (file) {
|
|
70
|
+
return file;
|
|
71
|
+
}
|
|
72
|
+
else if (files && files.length > 0) {
|
|
73
|
+
return nth(files, currentIndex);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return initialFile;
|
|
77
|
+
}
|
|
78
|
+
}, [files, currentIndex, file, initialFile, fileData, isFetching, id]);
|
|
79
|
+
const handlePrevious = () => {
|
|
80
|
+
if (files && currentIndex > 0) {
|
|
81
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: prevState.currentIndex - 1, currentFileId: get(nth(files, currentIndex - 1), "_id") || get(currentFile, "prevFileId") || "" })));
|
|
82
|
+
}
|
|
83
|
+
else if (fileIds && fileIds.length > 1 && currentIndex > 0) {
|
|
84
|
+
const prevIndex = currentIndex - 1;
|
|
85
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: prevIndex, currentFileId: fileIds[prevIndex] || "" })));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentFileId: get(currentFile, "prevFileId") || "" })));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const handleNext = () => {
|
|
92
|
+
if (files && currentIndex < get(files, "length", 0) - 1) {
|
|
93
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: prevState.currentIndex + 1, currentFileId: get(nth(files, currentIndex + 1), "_id") || get(currentFile, "nextFileId") || "" })));
|
|
94
|
+
}
|
|
95
|
+
else if (fileIds && fileIds.length > 1 && currentIndex < fileIds.length - 1) {
|
|
96
|
+
const nextIndex = currentIndex + 1;
|
|
97
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: nextIndex, currentFileId: fileIds[nextIndex] || "" })));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentFileId: get(currentFile, "nextFileId") || "" })));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (open) {
|
|
105
|
+
setTimeout(() => setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: true }))), 10);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: false })));
|
|
109
|
+
}
|
|
110
|
+
}, [open]);
|
|
111
|
+
if (!open && !visible)
|
|
112
|
+
return null;
|
|
113
|
+
const modalContent = (_jsxs("div", { className: `md-lib-fixed md-lib-inset-0 md-lib-z-[1000] md-lib-w-screen md-lib-h-screen md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-text-black dark:md-lib-text-white md-lib-overflow-auto md-lib-transform md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out ${open && visible
|
|
114
|
+
? "md-lib-opacity-100 md-lib-translate-y-0"
|
|
115
|
+
: "md-lib-opacity-0 md-lib-translate-y-4"}`, onTransitionEnd: () => {
|
|
116
|
+
if (!open)
|
|
117
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: false })));
|
|
118
|
+
}, children: [_jsx(FileDetailsHeader, { handleClose: handleClose, file: currentFile, onCloseSelection: onCloseSelection }), isFetching ? (_jsx(Loader, {})) : (_jsx(FileViewer, { file: currentFile, hasPrev: (!!files && currentIndex > 0) ||
|
|
119
|
+
(!!fileIds && fileIds.length > 1 && currentIndex > 0) ||
|
|
120
|
+
!!get(currentFile, "prevFileId"), hasNext: (!!files && currentIndex < get(files, "length", 0) - 1) ||
|
|
121
|
+
(!!fileIds && fileIds.length > 1 && currentIndex < fileIds.length - 1) ||
|
|
122
|
+
!!get(currentFile, "nextFileId"), onPrev: handlePrevious, onNext: handleNext, handleClose: handleClose }))] }));
|
|
123
|
+
return ReactDOM.createPortal(modalContent, document.body);
|
|
124
|
+
};
|
|
125
|
+
export default FileDetails;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FileEntity, FolderEntity } from "../../utilities/constants/interface";
|
|
2
|
+
declare const FileDetailsHeader: ({ handleClose, file, onCloseSelection, }: {
|
|
3
|
+
handleClose?: () => void;
|
|
4
|
+
file: FileEntity & FolderEntity;
|
|
5
|
+
onCloseSelection?: () => void;
|
|
6
|
+
}) => JSX.Element;
|
|
7
|
+
export default FileDetailsHeader;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "antd";
|
|
3
|
+
import { IoIosClose } from "react-icons/io";
|
|
4
|
+
import { BsDownload } from "react-icons/bs";
|
|
5
|
+
import { DriveModes, NotificationStatus, } from "../../utilities/constants/interface";
|
|
6
|
+
import { get } from "lodash";
|
|
7
|
+
import { showNotification } from "../../common/notifications";
|
|
8
|
+
import { INVALID_URL } from "../../utilities/constants/messages";
|
|
9
|
+
import FileMenuOptions from "../FileMenuOptions";
|
|
10
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
11
|
+
import useAppParams from "../../utilities/useAppParams";
|
|
12
|
+
const IoIosCloseIcon = IoIosClose;
|
|
13
|
+
const BsDownloadIcon = BsDownload;
|
|
14
|
+
const FileDetailsHeader = ({ handleClose, file, onCloseSelection, }) => {
|
|
15
|
+
const damConfig = useDamConfig();
|
|
16
|
+
const { isAdmin } = damConfig;
|
|
17
|
+
const { id, type } = useAppParams();
|
|
18
|
+
return (_jsxs("div", { className: "md-lib-bg-white dark:md-lib-bg-darkPrimaryHoverColor md-lib-py-3 md-lib-px-5 md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex md-lib-justify-between md-lib-items-center", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-5", children: [!id && type !== DriveModes.FILE && (_jsx(IoIosCloseIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-cursor-pointer", size: 24, onClick: handleClose })), !!file && (_jsx("h4", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-truncate md-lib-max-w-[calc(100vw-180px)]", title: get(file, "name", "N/A"), children: get(file, "name", "N/A") }))] }), !!file && (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4", children: [_jsx(FileMenuOptions, { file: file, fileIds: get(file, "_id") ? [get(file, "_id")] : [], onCloseSelection: onCloseSelection, fileModal: true }), _jsx(Button, { size: "large", className: "md-lib-bg-secondaryColor dark:md-lib-bg-darkSecondaryColor hover:md-lib-bg-secondaryHoverColor dark:hover:md-lib-bg-darkSecondaryColor md-lib-border-none", onClick: () => {
|
|
19
|
+
const url = get(file, "downloadUrl") || get(file, "s3Url") || get(file, "thumbnailUrl");
|
|
20
|
+
if (!url) {
|
|
21
|
+
showNotification(INVALID_URL, NotificationStatus.ERROR);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
window.open(url, "_blank");
|
|
25
|
+
}, children: _jsx(BsDownloadIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor", size: 24 }) })] }))] }));
|
|
26
|
+
};
|
|
27
|
+
export default FileDetailsHeader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileEntity } from "../../utilities/constants/interface";
|
|
2
|
+
declare const FileViewer: ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }: {
|
|
3
|
+
file: FileEntity;
|
|
4
|
+
hasPrev: boolean;
|
|
5
|
+
hasNext: boolean;
|
|
6
|
+
onPrev: () => void;
|
|
7
|
+
onNext: () => void;
|
|
8
|
+
handleClose?: () => void;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
export default FileViewer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Layout, Button } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
5
|
+
import PreviewDetails from "./Previewdetails";
|
|
6
|
+
import MapFile from "../files/MapFile";
|
|
7
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
8
|
+
import { get } from "lodash";
|
|
9
|
+
const { Content } = Layout;
|
|
10
|
+
const FileViewer = ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }) => {
|
|
11
|
+
const damConfig = useDamConfig();
|
|
12
|
+
const brand = damConfig === null || damConfig === void 0 ? void 0 : damConfig.brand;
|
|
13
|
+
const showFilePreview = get(brand, "showFilePreview", false);
|
|
14
|
+
const [metadataOpen, setMetadataOpen] = useState(showFilePreview);
|
|
15
|
+
return (_jsx(Layout, { className: "md-lib-h-full", children: _jsxs(Content, { className: "md-lib-flex md-lib-h-full md-lib-w-full", children: [_jsx("div", { className: `md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor md-lib-min-h-full ${metadataOpen ? "md-lib-flex-1" : "md-lib-flex-1 md-lib-w-full"}`, children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev, showFilePreview: showFilePreview }) }), showFilePreview && (_jsxs(_Fragment, { children: [_jsx(Button, { type: "text", className: "md-lib-shrink-0 md-lib-flex md-lib-items-center md-lib-justify-center md-lib-w-10 md-lib-h-10 md-lib-rounded-none md-lib-bg-black/50 hover:md-lib-bg-black/70 dark:md-lib-bg-white/20 dark:hover:md-lib-bg-white/30 md-lib-text-white md-lib-border-0 md-lib-self-start md-lib-mt-4", onClick: () => setMetadataOpen((prev) => !prev), "aria-label": metadataOpen ? "Hide Metadata" : "Show Metadata", children: metadataOpen ? (_jsx(RightOutlined, { className: "md-lib-text-lg" })) : (_jsx(LeftOutlined, { className: "md-lib-text-lg" })) }), metadataOpen && (_jsx("div", { className: "md-lib-w-[400px] md-lib-min-w-[320px] md-lib-shrink-0 md-lib-border-l md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-bg-backgroundColor dark:md-lib-bg-darkPrimary md-lib-overflow-y-auto", children: _jsx(MapFile, { fromUpload: false, filesList: file ? [file] : [], handleCancel: handleClose ? () => handleClose() : undefined }) }))] }))] }) }));
|
|
16
|
+
};
|
|
17
|
+
export default FileViewer;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { AiOutlineInfoCircle, AiOutlineZoomIn, AiOutlineZoomOut, AiOutlineEdit, } from "react-icons/ai";
|
|
3
|
+
import { FiChevronDown } from "react-icons/fi";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { PiCameraRotate } from "react-icons/pi";
|
|
6
|
+
import { MdOutlineCrop } from "react-icons/md";
|
|
7
|
+
import { Dropdown, Popover, } from "antd";
|
|
8
|
+
import EditImageModal from "../ImageEditor/EditImageModal";
|
|
9
|
+
import ManageFile from "./ManageFile";
|
|
10
|
+
import { FileInfoContent } from "../../common/CustomElements";
|
|
11
|
+
const AiOutlineInfoCircleIcon = AiOutlineInfoCircle;
|
|
12
|
+
const AiOutlineZoomOutIcon = AiOutlineZoomOut;
|
|
13
|
+
const FiChevronDownIcon = FiChevronDown;
|
|
14
|
+
const AiOutlineZoomInIcon = AiOutlineZoomIn;
|
|
15
|
+
const PiCameraRotateIcon = PiCameraRotate;
|
|
16
|
+
const MdOutlineCropIcon = MdOutlineCrop;
|
|
17
|
+
const AiOutlineEditIcon = AiOutlineEdit;
|
|
18
|
+
const ImageOptions = ({ zoom, setZoom, zoomOptions, file }) => {
|
|
19
|
+
const [state, setState] = useState({
|
|
20
|
+
showEditModal: false,
|
|
21
|
+
showFileAccess: false,
|
|
22
|
+
});
|
|
23
|
+
const { showEditModal, showFileAccess } = state;
|
|
24
|
+
const toggleFileAccess = () => {
|
|
25
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showFileAccess: !prevState.showFileAccess })));
|
|
26
|
+
};
|
|
27
|
+
const toggleEditModal = () => {
|
|
28
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showEditModal: !prevState.showEditModal })));
|
|
29
|
+
};
|
|
30
|
+
const zoomMenuItems = zoomOptions.map((value) => ({
|
|
31
|
+
key: value,
|
|
32
|
+
label: value,
|
|
33
|
+
}));
|
|
34
|
+
const handleZoomChange = ({ key }) => {
|
|
35
|
+
setZoom(key);
|
|
36
|
+
};
|
|
37
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-rounded-xl md-lib-shadow-md md-lib-px-4 md-lib-py-2 md-lib-flex md-lib-items-center md-lib-gap-4 md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-z-50", children: [_jsx(Popover, { content: _jsx(FileInfoContent, { file: file }), title: "File Info", placement: "top", children: _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: toggleFileAccess, children: _jsx(AiOutlineInfoCircleIcon, { className: "md-lib-text-[20px]" }) }) }), _jsx("div", { className: "md-lib-w-[1px] md-lib-h-5 md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor" }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom((prev) => `${parseInt(prev) - 5}%`), disabled: zoom === "10%", children: _jsx(AiOutlineZoomOutIcon, { className: "md-lib-text-[20px]" }) }), _jsx(Dropdown, { menu: {
|
|
38
|
+
items: zoomMenuItems,
|
|
39
|
+
onClick: handleZoomChange,
|
|
40
|
+
selectable: true,
|
|
41
|
+
selectedKeys: [zoom],
|
|
42
|
+
}, trigger: ["click"], placement: "top", children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-1 md-lib-px-3 md-lib-py-1 md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-md md-lib-cursor-pointer md-lib-text-sm md-lib-text-textColor dark:md-lib-text-darkTextColor", children: [zoom, _jsx(FiChevronDownIcon, { className: "md-lib-text-[16px]" })] }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom((prev) => `${parseInt(prev) + 5}%`), disabled: zoom === "150%", children: _jsx(AiOutlineZoomInIcon, { className: "md-lib-text-[20px]" }) }), _jsx("div", { className: "md-lib-w-[1px] md-lib-h-5 md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor" }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", children: _jsx(PiCameraRotateIcon, { className: "md-lib-text-[20px]" }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", onClick: toggleEditModal, children: _jsx(MdOutlineCropIcon, { className: "md-lib-text-[20px]" }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", onClick: toggleEditModal, children: _jsx(AiOutlineEditIcon, { className: "md-lib-text-[20px]" }) })] }), showEditModal && (_jsx(EditImageModal, { open: showEditModal, handleClose: toggleEditModal, file: file })), showFileAccess && (_jsx(ManageFile, { open: showFileAccess, onClose: toggleFileAccess, file: file }))] }));
|
|
43
|
+
};
|
|
44
|
+
export default ImageOptions;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { get } from "lodash";
|
|
3
|
+
import ImageOptions from "./ImageOptions";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { SAMPLE_IMAGE_URL } from "../../utilities/constants/imageUrls";
|
|
6
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
7
|
+
const ImageViewer = ({ file, showFilePreview }) => {
|
|
8
|
+
const damConfig = useDamConfig();
|
|
9
|
+
const { isAdmin } = damConfig;
|
|
10
|
+
const [zoom, setZoom] = useState("100");
|
|
11
|
+
const zoomOptions = ["10", "25", "50", "75", "100"];
|
|
12
|
+
const imgWidth = 750 * (parseInt(zoom) / 100);
|
|
13
|
+
// const imgHeight = 333 * (parseInt(zoom) / 100);
|
|
14
|
+
return (_jsxs("div", { className: "md-lib-relative md-lib-flex md-lib-flex-col md-lib-h-[calc(100vh-65px)] md-lib-w-full md-lib-overflow-hidden", children: [_jsx("div", { className: "md-lib-flex-1 md-lib-flex md-lib-justify-center md-lib-items-center md-lib-w-full md-lib-overflow-auto md-lib-min-h-0", children: _jsx("img", { src: get(file, "s3Url") || get(file, "downloadUrl") || get(file, "thumbnailUrl", SAMPLE_IMAGE_URL), alt: get(file, "name", ""), width: imgWidth, height: "auto", className: "md-lib-max-w-full md-lib-max-h-full md-lib-object-contain" }) }), showFilePreview && (_jsx("div", { className: "md-lib-flex md-lib-justify-center md-lib-items-center md-lib-py-4 md-lib-shrink-0", children: _jsx(ImageOptions, { zoom: zoom, setZoom: setZoom, zoomOptions: zoomOptions, file: file }) }))] }));
|
|
15
|
+
};
|
|
16
|
+
export default ImageViewer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Divider, Drawer } from "antd";
|
|
3
|
+
import { capitalize, get, slice } from "lodash";
|
|
4
|
+
import { DriveModes, EntityType, } from "../../utilities/constants/interface";
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
6
|
+
import { getReadableFileType } from "../../hocs/helpers";
|
|
7
|
+
import moment from "moment-timezone";
|
|
8
|
+
import { APP_DATE_TIME_FORMAT, LOCAL_TIMEZONE } from "../../hocs/appConstants";
|
|
9
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
10
|
+
import InviteTeamModal from "../../settings/InviteTeamModal";
|
|
11
|
+
function ManageFile({ onClose, open, file, }) {
|
|
12
|
+
const [state, setState] = useState({ showShareFile: false });
|
|
13
|
+
const { showShareFile } = state;
|
|
14
|
+
const toggleShareFile = () => {
|
|
15
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareFile: !prevState.showShareFile })));
|
|
16
|
+
};
|
|
17
|
+
const damConfig = useDamConfig();
|
|
18
|
+
const { user, isAdmin } = damConfig;
|
|
19
|
+
const userId = get(user, "_id");
|
|
20
|
+
const displayedUsers = useMemo(() => slice(get(file, "users", []), 0, 5), [file]);
|
|
21
|
+
const extraUsers = useMemo(() => get(file, "users.length") > 5 ? slice(get(file, "users", []), 5) : [], [file]);
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Drawer, { title: `${capitalize(get(file, "type", EntityType.FOLDER))} Details`, onClose: onClose, open: open, width: 440, children: [_jsxs("div", { children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Download Permission" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: "Viewers can download" })] }), _jsx(Divider, { className: "md-lib-border-secondaryHoverColor" }), _jsxs("h5", { className: "md-lib-text-base md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-mb-5", children: [capitalize(get(file, "type", EntityType.FOLDER)), " Details"] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Type" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: get(file, "type") === EntityType.FILE
|
|
23
|
+
? getReadableFileType(file)
|
|
24
|
+
: capitalize(get(file, "type", EntityType.FOLDER)) })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Id" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: get(file, "_id") })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Owner" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-truncate", title: get(file, "createdBy.name", "Unknown"), children: get(file, "createdBy.name") })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Modified" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: moment
|
|
25
|
+
.utc(get(file, "updatedAt"))
|
|
26
|
+
.tz(LOCAL_TIMEZONE)
|
|
27
|
+
.format(APP_DATE_TIME_FORMAT) })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Opened" }), _jsxs("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: [moment().format(APP_DATE_TIME_FORMAT), " by me"] })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Created" }), _jsxs("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-truncate", title: get(file, "createdBy.name", "Unknown"), children: [moment
|
|
28
|
+
.utc(get(file, "createdAt"))
|
|
29
|
+
.tz(LOCAL_TIMEZONE)
|
|
30
|
+
.format(APP_DATE_TIME_FORMAT), " ", "by", " ", get(file, "createdBy._id") === userId
|
|
31
|
+
? "me"
|
|
32
|
+
: get(file, "createdBy.name")] })] })] }), showShareFile && (_jsx(InviteTeamModal, { open: showShareFile, onClose: toggleShareFile, onFetchInvitations: () => { }, shareModal: true, fileIds: get(file, "type") === EntityType.FILE ? [get(file, "_id")] : [], folderIds: get(file, "type") !== EntityType.FILE ? [get(file, "_id")] : [], inviteType: DriveModes.FILE, file: file }))] }));
|
|
33
|
+
}
|
|
34
|
+
export default ManageFile;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FormInstance } from "antd";
|
|
2
|
+
import { BrandUserEntity, MetaDataFieldEntity } from "../../utilities/constants/interface";
|
|
3
|
+
export declare const buildInitialValues: (formData: Record<string, any>, metaFields: MetaDataFieldEntity[], isEditMode: boolean) => {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const getFormItem: (item: MetaDataFieldEntity, fromDefaultValue: boolean, userOptions?: BrandUserEntity[]) => JSX.Element | null;
|
|
7
|
+
declare const MetaForm: ({ metaFields, metaData, form, isEditMode, }: {
|
|
8
|
+
metaFields: MetaDataFieldEntity[];
|
|
9
|
+
metaData: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
form: FormInstance;
|
|
13
|
+
isEditMode: boolean;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
export default MetaForm;
|