@bindu-dashing/dam-solution-v2 5.8.39 → 5.8.40
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.
|
@@ -18,11 +18,14 @@ import { getFormattedValue } from "../hocs/helpers";
|
|
|
18
18
|
import { createApiClient } from "../hocs/configureAxios";
|
|
19
19
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
20
20
|
import { FETCH_ASSET_URL, FETCH_SHARED_FILE_URL, } from "../utilities/constants/apiUrls";
|
|
21
|
+
import { FoldersProvider } from "../utilities/FoldersContext";
|
|
21
22
|
function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile, }) {
|
|
22
23
|
const [state, setState] = useState({
|
|
23
24
|
parentFolderId: get(imagePicker, "folderId"),
|
|
24
25
|
fileForConfirmation: {},
|
|
25
26
|
});
|
|
27
|
+
const [folders, setFolders] = useState([]);
|
|
28
|
+
const [globalSearch, setGlobalSearch] = useState("");
|
|
26
29
|
const damConfig = useDamConfig();
|
|
27
30
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
28
31
|
const { parentFolderId, fileForConfirmation } = state;
|
|
@@ -50,12 +53,12 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
50
53
|
onSelectFile();
|
|
51
54
|
} }, "confirm")) : null, children: get(imagePicker, "assetId") ? (_jsx(TestImageFromMetalData, { imagePicker: imagePicker, selectedPickerFile: fileForConfirmation, setSelectedFile: (file) => {
|
|
52
55
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|
|
53
|
-
} })) : (_jsx(DriveContainer, { setSelectedFile: (file, localFile = false) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
} })) : (_jsx(FoldersProvider, { value: { folders, setFolders, globalSearch }, children: _jsx(DriveContainer, { setSelectedFile: (file, localFile = false) => {
|
|
57
|
+
console.log("local file", file);
|
|
58
|
+
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|
|
59
|
+
if (localFile) {
|
|
60
|
+
setSelectedFile(get(file, "s3Url", ""), get(file, "thumbnailUrl", ""));
|
|
61
|
+
}
|
|
62
|
+
}, parentFolderId: parentFolderId, setParentFolderId: (id) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { parentFolderId: id, fileForConfirmation: {} }))), pickerFolderId: get(imagePicker, "folderId"), selectedPickerFile: fileForConfirmation, imagePicker: imagePicker, globalSearch: globalSearch, setGlobalSearch: setGlobalSearch }) })) }));
|
|
60
63
|
}
|
|
61
64
|
export default TestImagePickerModal;
|
|
@@ -62,8 +62,6 @@ function BreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolde
|
|
|
62
62
|
setParentFolderId(treeId);
|
|
63
63
|
}
|
|
64
64
|
if (!pickerFolderId && !isLast && setSelectedKeys) {
|
|
65
|
-
// Use state-based navigation for all folders including root
|
|
66
|
-
// This works regardless of whether Router context is available
|
|
67
65
|
setSelectedKeys(treeId);
|
|
68
66
|
}
|
|
69
67
|
};
|
package/build/MyDrive/routes.js
CHANGED
|
@@ -5,14 +5,8 @@ import useAppParams from "../utilities/useAppParams";
|
|
|
5
5
|
export default function AppRoutes({ folders, setFolders, routerVersion, }) {
|
|
6
6
|
const params = useAppParams();
|
|
7
7
|
const { type, id } = params;
|
|
8
|
-
// Determine which component to render based on params
|
|
9
|
-
// If type and id are present, it's likely an image picker or entity view
|
|
10
8
|
if (type && id) {
|
|
11
|
-
// This matches FETCH_ENTITY_SCREEN pattern
|
|
12
9
|
return _jsx(ImagePickerDrive, {});
|
|
13
10
|
}
|
|
14
|
-
// Otherwise, render the main drive container
|
|
15
|
-
// This handles both MY_DRIVE_SCREEN and SUBFOLDERS_SCREEN
|
|
16
|
-
// The folderId param will be handled by MyDriveMainContainer
|
|
17
11
|
return (_jsx(MyDriveMainContainer, { folders: folders, setFolders: setFolders }));
|
|
18
12
|
}
|
|
@@ -5,12 +5,7 @@ if (rrd.useNavigate) {
|
|
|
5
5
|
// ✅ v6+
|
|
6
6
|
const { useNavigate } = rrd;
|
|
7
7
|
useAppNavigate = () => {
|
|
8
|
-
// We need to call useNavigate unconditionally (hook rules)
|
|
9
|
-
// But we'll wrap it in an error boundary pattern
|
|
10
|
-
// If Router context is not available, this will throw
|
|
11
|
-
// The component using this should handle the error gracefully
|
|
12
8
|
let navigateFn = null;
|
|
13
|
-
// Use a ref to track if we've successfully initialized
|
|
14
9
|
const hasRouterContext = React.useRef(false);
|
|
15
10
|
try {
|
|
16
11
|
const navigate = useNavigate();
|
|
@@ -18,8 +13,6 @@ if (rrd.useNavigate) {
|
|
|
18
13
|
navigateFn = (to) => navigate(to);
|
|
19
14
|
}
|
|
20
15
|
catch (e) {
|
|
21
|
-
// Router context not available - this will throw synchronously
|
|
22
|
-
// Return null so caller can use fallback
|
|
23
16
|
hasRouterContext.current = false;
|
|
24
17
|
navigateFn = null;
|
|
25
18
|
}
|