@bindu-dashing/dam-solution-v2 5.8.6
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 +9 -0
- package/build/AssetType/AddFieldProperties.js +197 -0
- package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
- package/build/AssetType/AssetTemplatesTable.js +153 -0
- package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
- package/build/AssetType/CreateAssetTemplate.js +68 -0
- package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
- package/build/AssetType/CreateOrEditAssetTemplate.js +77 -0
- package/build/AssetType/DraggedField.d.ts +14 -0
- package/build/AssetType/DraggedField.js +40 -0
- package/build/AssetType/EditAssetTemplate.d.ts +5 -0
- package/build/AssetType/EditAssetTemplate.js +179 -0
- package/build/AssetType/FieldsSection.d.ts +14 -0
- package/build/AssetType/FieldsSection.js +239 -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 +24 -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 +8 -0
- package/build/CreateClient/CreateClientBtn.js +12 -0
- package/build/CreateClient/CreateClientForm.d.ts +9 -0
- package/build/CreateClient/CreateClientForm.js +165 -0
- package/build/CreateClient/index.d.ts +14 -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 +61 -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 +6 -0
- package/build/MyDrive/ActionBar.js +165 -0
- package/build/MyDrive/AddDrive.d.ts +3 -0
- package/build/MyDrive/AddDrive.js +169 -0
- package/build/MyDrive/AddFolder.d.ts +10 -0
- package/build/MyDrive/AddFolder.js +150 -0
- package/build/MyDrive/BreadCrumbList.d.ts +9 -0
- package/build/MyDrive/BreadCrumbList.js +86 -0
- package/build/MyDrive/BulkUploadModal.d.ts +2 -0
- package/build/MyDrive/BulkUploadModal.js +279 -0
- package/build/MyDrive/DriveContainer.d.ts +13 -0
- package/build/MyDrive/DriveContainer.js +276 -0
- package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
- package/build/MyDrive/FileDownloadHistory.js +94 -0
- package/build/MyDrive/FileMenuOptions.d.ts +11 -0
- package/build/MyDrive/FileMenuOptions.js +397 -0
- package/build/MyDrive/FilesGridView.d.ts +9 -0
- package/build/MyDrive/FilesGridView.js +25 -0
- package/build/MyDrive/FolderGridView.d.ts +19 -0
- package/build/MyDrive/FolderGridView.js +91 -0
- package/build/MyDrive/FolderListView.d.ts +25 -0
- package/build/MyDrive/FolderListView.js +188 -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 +342 -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 +1 -0
- package/build/MyDrive/MyDriveMainContainer.js +32 -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 +40 -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 +10 -0
- package/build/MyDrive/fileDetails/FileDetails.js +78 -0
- package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
- package/build/MyDrive/fileDetails/FileHeader.js +25 -0
- package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
- package/build/MyDrive/fileDetails/FileViewer.js +31 -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 +5 -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 +195 -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 +9 -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 +83 -0
- package/build/MyDrive/files/MapFile.d.ts +8 -0
- package/build/MyDrive/files/MapFile.js +217 -0
- package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
- package/build/MyDrive/files/MoveToAnotherFolder.js +53 -0
- package/build/MyDrive/filesListView.d.ts +2 -0
- package/build/MyDrive/filesListView.js +57 -0
- package/build/MyDrive/index.d.ts +10 -0
- package/build/MyDrive/index.js +35 -0
- package/build/MyDrive/routes.d.ts +7 -0
- package/build/MyDrive/routes.js +17 -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 +10 -0
- package/build/common/folders/TypeAndDateFilters.js +59 -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 +108 -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 +15 -0
- package/build/hocs/helpers.js +177 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +11 -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 +3 -0
- package/build/react-query/services/brand-services.js +30 -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 +44 -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 +48 -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 +14 -0
- package/build/utilities/FoldersContext.js +10 -0
- package/build/utilities/NavigatorProvider.d.ts +2 -0
- package/build/utilities/NavigatorProvider.js +10 -0
- package/build/utilities/constants/apiUrls.d.ts +95 -0
- package/build/utilities/constants/apiUrls.js +115 -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 +54 -0
- package/build/utilities/constants/messages.js +54 -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 +19 -0
- package/build/utilities/useAppParams.d.ts +6 -0
- package/build/utilities/useAppParams.js +27 -0
- package/package.json +93 -0
|
@@ -0,0 +1,41 @@
|
|
|
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 { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { DriveModes } from "../utilities/constants/interface";
|
|
12
|
+
import { createApiClient } from "../hocs/configureAxios";
|
|
13
|
+
import { useEffect, useMemo } from "react";
|
|
14
|
+
import { FETCH_SHARED_FILE_URL } from "../utilities/constants/apiUrls";
|
|
15
|
+
import { get } from "lodash";
|
|
16
|
+
import useConfig from "antd/es/config-provider/hooks/useConfig";
|
|
17
|
+
import useAppParams from "../utilities/useAppParams";
|
|
18
|
+
export default function ImagePickerDrive() {
|
|
19
|
+
const params = useAppParams();
|
|
20
|
+
const damConfig = useConfig();
|
|
21
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (get(params, "type") === DriveModes.FILE) {
|
|
24
|
+
fetchFileData();
|
|
25
|
+
}
|
|
26
|
+
}, []);
|
|
27
|
+
const fetchFileData = () => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const response = yield api.get(FETCH_SHARED_FILE_URL.replace(":fileId", get(params, "id")));
|
|
29
|
+
});
|
|
30
|
+
// const renderContent = () => {
|
|
31
|
+
// switch (get(params, "type")) {
|
|
32
|
+
// case DriveModes.FILE:
|
|
33
|
+
// return <FileDetails open={true} file={get(fileData, "data")} />;
|
|
34
|
+
// case DriveModes.FOLDERS:
|
|
35
|
+
// return <DriveContainer />;
|
|
36
|
+
// default:
|
|
37
|
+
// redirect("/not-found");
|
|
38
|
+
// }
|
|
39
|
+
// };
|
|
40
|
+
return _jsx(_Fragment, {});
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MyDriveMainContainer({ folders, setFolders }: any): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import FolderTree from "./FolderTree";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
5
|
+
import { isArray, map } from "lodash";
|
|
6
|
+
import DriveContainer from "./DriveContainer";
|
|
7
|
+
import useAppParams from "../utilities/useAppParams";
|
|
8
|
+
import { FoldersProvider } from "../utilities/FoldersContext";
|
|
9
|
+
export default function MyDriveMainContainer({ folders, setFolders }) {
|
|
10
|
+
const damConfig = useDamConfig();
|
|
11
|
+
const { rootFolderId, brand, isAdmin } = damConfig;
|
|
12
|
+
const params = useAppParams();
|
|
13
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
14
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
15
|
+
const [globalSearch, setGlobalSearch] = useState("");
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (params === null || params === void 0 ? void 0 : params.folderId) {
|
|
18
|
+
setSelectedKeys(params.folderId);
|
|
19
|
+
}
|
|
20
|
+
}, [params === null || params === void 0 ? void 0 : params.folderId]);
|
|
21
|
+
const currentRootId = isArray(selectedKeys)
|
|
22
|
+
? selectedKeys.length
|
|
23
|
+
? selectedKeys[selectedKeys.length - 1]
|
|
24
|
+
: rootFolderId
|
|
25
|
+
: selectedKeys
|
|
26
|
+
? selectedKeys
|
|
27
|
+
: rootFolderId;
|
|
28
|
+
const handleExpand = (keys) => {
|
|
29
|
+
setExpandedKeys(map(keys, (k) => k.toString()));
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs(FoldersProvider, { value: { setFolders, folders, globalSearch }, children: [_jsx(FolderTree, { currentRootId: currentRootId, handleExpand: handleExpand, setSelectedKeys: setSelectedKeys, expandedKeys: expandedKeys, selectedKeys: selectedKeys, folders: folders, setExpandedKeys: setExpandedKeys, setFolders: setFolders, setGlobalSearch: setGlobalSearch, globalSearch: globalSearch }), _jsx("div", { className: "md-lib-h-[inherit] md-lib-overflow-x-auto", children: _jsx(DriveContainer, { globalSearch: globalSearch, setGlobalSearch: setGlobalSearch }) })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function SearchFilter({ type, onSearch, name, isMetadata, isSelected, searchValue, }: {
|
|
2
|
+
type: string;
|
|
3
|
+
onSearch: (filters: Record<string, any>) => void;
|
|
4
|
+
isMetadata: boolean;
|
|
5
|
+
name: string;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
searchValue: string | [string | string] | null;
|
|
8
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, DatePicker, Input, Popover, Radio } from "antd";
|
|
3
|
+
import { CiSearch } from "react-icons/ci";
|
|
4
|
+
import { InputTypes } from "../utilities/constants/interface";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../hocs/appConstants";
|
|
8
|
+
const CiSearchIcon = CiSearch;
|
|
9
|
+
export default function SearchFilter({ type, onSearch, name, isMetadata, isSelected, searchValue, }) {
|
|
10
|
+
const [open, setOpen] = useState(false);
|
|
11
|
+
const [value, setValue] = useState(null);
|
|
12
|
+
const [withTime, setWithTime] = useState(false); // toggle mode
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (type === InputTypes.DATE || type === InputTypes.DATE_RANGE) {
|
|
15
|
+
setValue(isSelected && typeof searchValue === "string"
|
|
16
|
+
? dayjs(searchValue)
|
|
17
|
+
: null);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
setValue(isSelected ? searchValue : null);
|
|
21
|
+
}
|
|
22
|
+
}, [type, isSelected, searchValue]);
|
|
23
|
+
const getInputField = (type) => {
|
|
24
|
+
switch (type) {
|
|
25
|
+
case InputTypes.DATE_RANGE:
|
|
26
|
+
case InputTypes.DATE:
|
|
27
|
+
return (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-2", children: [_jsxs(Radio.Group, { value: withTime ? "withTime" : "dateOnly", onChange: (e) => setWithTime(e.target.value === "withTime"), children: [_jsx(Radio, { value: "dateOnly", children: "Date only" }), _jsx(Radio, { value: "withTime", children: "With time" })] }), _jsx(DatePicker, { style: { width: "100%" }, onChange: (val) => setValue(val), value: value, placeholder: withTime ? "Select date & time" : "Select date", showTime: withTime })] }));
|
|
28
|
+
default:
|
|
29
|
+
return (_jsx(Input, { value: value, onChange: (e) => setValue(e.target.value), placeholder: "Search (min. 2 characters required)" }));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const handleCancel = () => {
|
|
33
|
+
onSearch({
|
|
34
|
+
searchKey: "",
|
|
35
|
+
searchValue: "",
|
|
36
|
+
metadataKey: "",
|
|
37
|
+
metadataValue: "",
|
|
38
|
+
});
|
|
39
|
+
setValue(null);
|
|
40
|
+
setWithTime(false);
|
|
41
|
+
setOpen(false);
|
|
42
|
+
};
|
|
43
|
+
const handleSearch = () => {
|
|
44
|
+
let formattedValue = value;
|
|
45
|
+
if ((type === InputTypes.DATE || type === InputTypes.DATE_RANGE) && value) {
|
|
46
|
+
formattedValue = withTime
|
|
47
|
+
? value.format(DATE_WITH_TIME_FORMAT) // includes time
|
|
48
|
+
: value.format(DATE_FORMAT); // date only
|
|
49
|
+
}
|
|
50
|
+
if (type === InputTypes.TEXT
|
|
51
|
+
? formattedValue.length >= 2 || !formattedValue
|
|
52
|
+
: true) {
|
|
53
|
+
onSearch(isMetadata
|
|
54
|
+
? {
|
|
55
|
+
searchKey: "",
|
|
56
|
+
searchValue: "",
|
|
57
|
+
metadataKey: name,
|
|
58
|
+
metadataValue: formattedValue,
|
|
59
|
+
searchData: true,
|
|
60
|
+
}
|
|
61
|
+
: {
|
|
62
|
+
searchKey: name,
|
|
63
|
+
searchValue: formattedValue,
|
|
64
|
+
metadataKey: "",
|
|
65
|
+
metadataValue: "",
|
|
66
|
+
searchData: true,
|
|
67
|
+
});
|
|
68
|
+
setOpen(false);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const content = (_jsxs("div", { children: [getInputField(type), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-mt-2 md-lib-gap-2", children: [_jsx(Button, { onClick: handleCancel, children: "Reset" }), _jsx(Button, { onClick: handleSearch, type: "primary", children: "Search" })] })] }));
|
|
72
|
+
return (_jsx(Popover, { content: content, title: "Search", trigger: "click", placement: "bottom", open: open, onOpenChange: (newOpen) => setOpen(newOpen), children: _jsx(CiSearchIcon, { onClick: () => setOpen(!open), className: "md-lib-mt-1" }) }));
|
|
73
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { GoShareAndroid } from "react-icons/go";
|
|
4
|
+
import { DriveModes } from "../utilities/constants/interface";
|
|
5
|
+
import CustomButton from "../common/Button";
|
|
6
|
+
import InviteTeamModal from "../settings/InviteTeamModal";
|
|
7
|
+
import { get } from "lodash";
|
|
8
|
+
const GoShareAndroidIcon = GoShareAndroid;
|
|
9
|
+
const Sharebtn = ({ file }) => {
|
|
10
|
+
const [state, setState] = useState({
|
|
11
|
+
showShareModal: false,
|
|
12
|
+
});
|
|
13
|
+
const { showShareModal } = state;
|
|
14
|
+
const toggleShareModal = () => {
|
|
15
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareModal: !prevState.showShareModal })));
|
|
16
|
+
};
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(CustomButton, { icon: _jsx(GoShareAndroidIcon, { size: 16 }), type: "primary", size: "large", label: "Share", onClick: toggleShareModal }), showShareModal && (_jsx(InviteTeamModal, { open: showShareModal, onClose: toggleShareModal, onFetchInvitations: () => { }, shareModal: true, fileIds: [get(file, "_id")], folderIds: [], inviteType: DriveModes.FILE, file: file }))] }));
|
|
18
|
+
};
|
|
19
|
+
export default Sharebtn;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio } from "antd";
|
|
3
|
+
import { BsGrid, BsList } from "react-icons/bs";
|
|
4
|
+
const BsListIcon = BsList;
|
|
5
|
+
const BsGridIcon = BsGrid;
|
|
6
|
+
export default function ToggleView({ showGrid, toggleView, }) {
|
|
7
|
+
const options = [
|
|
8
|
+
{ label: _jsx(BsListIcon, {}), value: false },
|
|
9
|
+
{ label: _jsx(BsGridIcon, {}), value: true },
|
|
10
|
+
];
|
|
11
|
+
return (_jsx(Radio.Group, { options: options, onChange: (e) => toggleView(e.target.value), optionType: "button", buttonStyle: "solid", value: showGrid, size: "large", className: "grid-radio-btns md-lib-hidden md:md-lib-block" }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileUploadStatus } from "../utilities/constants/interface";
|
|
3
|
+
interface Props {
|
|
4
|
+
open: boolean;
|
|
5
|
+
statusList: {
|
|
6
|
+
name: string;
|
|
7
|
+
status: FileUploadStatus;
|
|
8
|
+
}[];
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const UploadStatusModal: React.FC<Props>;
|
|
12
|
+
export default UploadStatusModal;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from "antd";
|
|
3
|
+
import { CheckCircleOutlined, CloseCircleOutlined, LoadingOutlined, } from "@ant-design/icons";
|
|
4
|
+
import { FileUploadStatus } from "../utilities/constants/interface";
|
|
5
|
+
import { map } from "lodash";
|
|
6
|
+
var ThemeModes;
|
|
7
|
+
(function (ThemeModes) {
|
|
8
|
+
ThemeModes["SUCCESS"] = "#016A1C";
|
|
9
|
+
ThemeModes["ERROR"] = "#E42131";
|
|
10
|
+
ThemeModes["PENDING"] = "#FB8951";
|
|
11
|
+
})(ThemeModes || (ThemeModes = {}));
|
|
12
|
+
const getStatusProps = (status) => {
|
|
13
|
+
switch (status) {
|
|
14
|
+
case FileUploadStatus.PENDING:
|
|
15
|
+
return {
|
|
16
|
+
percent: 25,
|
|
17
|
+
status: "active",
|
|
18
|
+
icon: _jsx(LoadingOutlined, { spin: true, className: " md-lib-text-imagesColor" }),
|
|
19
|
+
};
|
|
20
|
+
case FileUploadStatus.SUCCESS:
|
|
21
|
+
return {
|
|
22
|
+
percent: 100,
|
|
23
|
+
status: "success",
|
|
24
|
+
icon: _jsx(CheckCircleOutlined, { className: "md-lib-text-themeGreen" }),
|
|
25
|
+
};
|
|
26
|
+
case FileUploadStatus.ERROR:
|
|
27
|
+
return {
|
|
28
|
+
percent: 100,
|
|
29
|
+
status: "exception",
|
|
30
|
+
icon: _jsx(CloseCircleOutlined, { className: "md-lib-text-dangerColor" }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const UploadStatusModal = ({ open, statusList, onClose }) => {
|
|
35
|
+
return (_jsx(Modal, { open: open, onCancel: onClose, footer: null, maskClosable: false, title: "Uploading File", children: _jsx("div", { className: "md-lib-space-y-4 md-lib-max-h-[400px] md-lib-overflow-y-auto md-lib-pr-2", children: map(statusList, ({ name, status }) => {
|
|
36
|
+
const { percent, status: progressStatus, icon, } = getStatusProps(status);
|
|
37
|
+
return (_jsx("div", { children: _jsxs("div", { className: "md-lib-flex md-lib-justify-between md-lib-items-center md-lib-mb-1", children: [_jsx("span", { className: "md-lib-truncate md-lib-w-4/5 md-lib-text-sm", children: name }), icon] }) }, name));
|
|
38
|
+
}) }) }));
|
|
39
|
+
};
|
|
40
|
+
export default UploadStatusModal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommentEntityType, FileEntity } from "../../utilities/constants/interface";
|
|
2
|
+
declare function CommentEntity({ comment, refreshData, parentId, file, }: {
|
|
3
|
+
comment: CommentEntityType;
|
|
4
|
+
refreshData: (params: any) => void;
|
|
5
|
+
parentId?: string;
|
|
6
|
+
file: FileEntity;
|
|
7
|
+
}): JSX.Element;
|
|
8
|
+
export default CommentEntity;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { getProfile, getRelativeTime } from "../../hocs/helpers";
|
|
12
|
+
import { NotificationStatus, } from "../../utilities/constants/interface";
|
|
13
|
+
import { Avatar, Dropdown } from "antd";
|
|
14
|
+
import { filter, get, includes } from "lodash";
|
|
15
|
+
import { PiArrowBendDownRight, PiThumbsUp, PiThumbsUpFill, } from "react-icons/pi";
|
|
16
|
+
import CustomButton from "../../common/Button";
|
|
17
|
+
import { MoreOutlined } from "@ant-design/icons";
|
|
18
|
+
import { useMemo, useState } from "react";
|
|
19
|
+
import { DeleteConfirmationModal } from "../../common/CustomElements";
|
|
20
|
+
import { DELETE_CONFIRMATION_MESSAGE, DELETE_MESSAGE_DESCRIPTION, DELETE_OK_TEXT, DELETE_SUCCESS, SOMETHING_WENT_WRONG, UPDATE_SUCCESS, } from "../../utilities/constants/messages";
|
|
21
|
+
import { FETCH_COMMENT_URL } from "../../utilities/constants/apiUrls";
|
|
22
|
+
import { showNotification } from "../../common/notifications";
|
|
23
|
+
import Editor from "./Editor";
|
|
24
|
+
import Comments from "./Comments";
|
|
25
|
+
import { useDamConfig } from "../../hocs/DamConfigContext";
|
|
26
|
+
import { createApiClient } from "../../hocs/configureAxios";
|
|
27
|
+
const PiArrowBendDownRightIcon = PiArrowBendDownRight;
|
|
28
|
+
const PiThumbsUpFillIcon = PiThumbsUpFill;
|
|
29
|
+
const PiThumbsUpIcon = PiThumbsUp;
|
|
30
|
+
function CommentEntity({ comment, refreshData, parentId, file, }) {
|
|
31
|
+
const damConfig = useDamConfig();
|
|
32
|
+
const { user } = damConfig;
|
|
33
|
+
const userId = get(user, "_id");
|
|
34
|
+
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
35
|
+
const [state, setState] = useState({
|
|
36
|
+
loadingType: "",
|
|
37
|
+
showConfimation: false,
|
|
38
|
+
showEdit: false,
|
|
39
|
+
editorState: get(comment, "text", ""),
|
|
40
|
+
commentData: comment,
|
|
41
|
+
showReplies: false,
|
|
42
|
+
});
|
|
43
|
+
const { loadingType, showConfimation, showEdit, editorState, commentData, showReplies, } = state;
|
|
44
|
+
const toggleShowEdit = () => {
|
|
45
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showEdit: !prevState.showEdit, loadingType: "" })));
|
|
46
|
+
};
|
|
47
|
+
const toggleConfirmation = () => {
|
|
48
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showConfimation: !prevState.showConfimation, loadingType: "" })));
|
|
49
|
+
};
|
|
50
|
+
const toggleShowReplies = () => {
|
|
51
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { showReplies: !prevState.showReplies })));
|
|
52
|
+
};
|
|
53
|
+
const name = useMemo(() => get(commentData, "createdBy.name", "Unknown User"), [commentData]);
|
|
54
|
+
const text = useMemo(() => get(commentData, "text", ""), [commentData]);
|
|
55
|
+
const createdAt = useMemo(() => get(commentData, "createdAt"), [commentData]);
|
|
56
|
+
const likes = useMemo(() => get(commentData, "likes.length", 0), [commentData]);
|
|
57
|
+
const likesArray = useMemo(() => get(commentData, "likes", []), [commentData]);
|
|
58
|
+
const items = [
|
|
59
|
+
{
|
|
60
|
+
key: "edit",
|
|
61
|
+
label: "Edit",
|
|
62
|
+
onClick: toggleShowEdit,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "delete",
|
|
66
|
+
label: "Delete",
|
|
67
|
+
danger: true,
|
|
68
|
+
onClick: toggleConfirmation,
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
const onDeleteComment = () => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "delete" })));
|
|
73
|
+
try {
|
|
74
|
+
const response = yield api.delete(FETCH_COMMENT_URL.replace(":commentId", get(commentData, "_id")));
|
|
75
|
+
refreshData({});
|
|
76
|
+
toggleConfirmation();
|
|
77
|
+
showNotification(get(response, "data.message", DELETE_SUCCESS), NotificationStatus.SUCCESS);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "" })));
|
|
81
|
+
showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const handleUpdateComment = (payload, loadingType) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType })));
|
|
86
|
+
try {
|
|
87
|
+
const response = yield api.put(FETCH_COMMENT_URL.replace(":commentId", get(commentData, "_id")), payload);
|
|
88
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { commentData: get(response, "data.comment", commentData), loadingType: "", editorState: get(response, "data.comment.text", ""), showEdit: false })));
|
|
89
|
+
showNotification(get(response, "data.message", UPDATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "" })));
|
|
93
|
+
showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return (_jsxs(_Fragment, { children: [showEdit ? (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-2 md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out md-lib-opacity-100 md-lib-animate-fade-in", children: [_jsx(Editor, { setEditorState: (state) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { editorState: state }))), editorState: editorState }), _jsxs("div", { className: "md-lib-flex md-lib-justify-end md-lib-pt-2 md-lib-gap-2", children: [_jsx(CustomButton, { label: "Cancel", onClick: toggleShowEdit }), _jsx(CustomButton, { type: "primary", label: "Update", onClick: () => handleUpdateComment({ text: editorState }, "text"), loading: loadingType === "text" })] })] }, get(commentData, "_id"))) : (_jsxs("div", { className: `md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out md-lib-animate-fade-in ${parentId ? "md-lib-bg-borderColor md-lib-dark:bg-darkBorderColor" : ""}`, children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx(Avatar, { className: "md-lib-bg-secondaryTextColor dark:md-lib-bg-darkSecondaryTextColor md-lib-cursor-default", size: 36, children: getProfile(name) }), _jsx("p", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base", children: name })] }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor", children: getRelativeTime(createdAt) }), userId === get(commentData, "createdBy._id") && (_jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsx(MoreOutlined, {}) }))] })] }), _jsx("div", { className: "md-lib-py-4 md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-pr-[10px] md-lib-text-base", dangerouslySetInnerHTML: { __html: text } }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between md-lib-pr-[10px]", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsxs("p", { className: "md-lib-p-2 md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-font-medium", children: [likes, " ", likes === 1 ? "like" : "likes"] }), _jsx(CustomButton, { type: "text", icon: _jsx(PiArrowBendDownRightIcon, { size: 24 }), size: "large", className: "md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-font-medium", label: "Reply", onClick: toggleShowReplies })] }), _jsx(CustomButton, { type: "text", loading: loadingType === "like", icon: loadingType === "like" ? (_jsx(_Fragment, {})) : includes(likesArray, userId) ? (_jsx(PiThumbsUpFillIcon, { size: 24 })) : (_jsx(PiThumbsUpIcon, { size: 24 })), size: "large", className: "md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor", label: "", onClick: () => handleUpdateComment({
|
|
97
|
+
likes: includes(likesArray, userId)
|
|
98
|
+
? filter(likesArray, (id) => id !== userId)
|
|
99
|
+
: [...likesArray, userId],
|
|
100
|
+
}, "like") })] })] }, get(commentData, "_id"))), showConfimation && (_jsx(DeleteConfirmationModal, { showDeleteModal: showConfimation, toggleDeleteModal: toggleConfirmation, okText: DELETE_OK_TEXT, onOk: onDeleteComment, loading: loadingType === "delete", description: DELETE_CONFIRMATION_MESSAGE.replace(":action", "Delete").replace(" :entity", ""), subHeading: DELETE_MESSAGE_DESCRIPTION })), showReplies && (_jsxs("div", { className: "md-lib-mt-3 md-lib-ml-12 md-lib-flex md-lib-flex-col md-lib-gap-3 md-lib-animate-fade-in md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out", children: [_jsx("p", { className: "md-lib-text-sm md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor md-lib-font-semibold", children: "Replies" }), _jsx(Comments, { parentId: get(comment, "_id"), file: file })] }))] }));
|
|
101
|
+
}
|
|
102
|
+
export default CommentEntity;
|
|
@@ -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,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileEntity } from "../../utilities/constants/interface";
|
|
3
|
+
declare const FileDetails: ({ open, handleClose, file, files, onCloseSelection, }: {
|
|
4
|
+
handleClose?: () => void;
|
|
5
|
+
open: boolean;
|
|
6
|
+
file?: FileEntity;
|
|
7
|
+
files?: FileEntity[] | undefined;
|
|
8
|
+
onCloseSelection?: () => void;
|
|
9
|
+
}) => React.ReactPortal | null;
|
|
10
|
+
export default FileDetails;
|