datastake-daf 0.6.773 → 0.6.774
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/dist/components/index.js +272 -224
- package/dist/hooks/index.js +72 -0
- package/dist/pages/index.js +352 -1072
- package/dist/utils/index.js +13 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +8 -76
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +116 -8
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/utils.js +73 -17
- package/src/@daf/core/components/Dashboard/Map/helper.js +1 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +53 -29
- package/src/@daf/core/components/Dashboard/Map/style.js +20 -5
- package/src/@daf/hooks/useViewFormUrlParams.js +84 -0
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/AssociatedInformation/index.jsx +24 -135
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/JobsTimeline/index.jsx +1 -0
- package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +4 -3
- package/src/@daf/utils/object.js +3 -1
- package/src/hooks.js +2 -1
- package/src/utils.js +1 -1
- package/dist/style/datastake/mapbox-gl.css +0 -330
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/AssociatedInformation/config.js +0 -554
package/dist/hooks/index.js
CHANGED
|
@@ -2403,6 +2403,77 @@ const useGetQueryParams = ({
|
|
|
2403
2403
|
return params;
|
|
2404
2404
|
};
|
|
2405
2405
|
|
|
2406
|
+
const useViewFormUrlParams = ({
|
|
2407
|
+
params,
|
|
2408
|
+
pathname,
|
|
2409
|
+
search,
|
|
2410
|
+
searchParams,
|
|
2411
|
+
setSearchParams,
|
|
2412
|
+
push
|
|
2413
|
+
}) => {
|
|
2414
|
+
const [namespace, setNamespace] = React.useState(params.namespace);
|
|
2415
|
+
const [id, setId] = React.useState(params.id);
|
|
2416
|
+
const [group, setGroup] = React.useState(params.group);
|
|
2417
|
+
const [subsection, setSubsection] = React.useState(params.subsection);
|
|
2418
|
+
const [source, setSource] = React.useState(searchParams.get("source") || null);
|
|
2419
|
+
const [version, setVersion] = React.useState(searchParams.get("version") || null);
|
|
2420
|
+
React.useEffect(() => {
|
|
2421
|
+
if (id && params.id !== id || namespace && namespace !== params.namespace) {
|
|
2422
|
+
setGroup(undefined);
|
|
2423
|
+
setSubsection(undefined);
|
|
2424
|
+
} else {
|
|
2425
|
+
setGroup(params.group);
|
|
2426
|
+
setSubsection(params.subsection);
|
|
2427
|
+
}
|
|
2428
|
+
setNamespace(params.namespace);
|
|
2429
|
+
setId(params.id);
|
|
2430
|
+
}, [params, id, namespace]);
|
|
2431
|
+
React.useEffect(() => {
|
|
2432
|
+
if (source && version) {
|
|
2433
|
+
const newParams = new URLSearchParams(searchParams);
|
|
2434
|
+
newParams.set("source", source);
|
|
2435
|
+
newParams.set("version", version);
|
|
2436
|
+
setSearchParams(newParams);
|
|
2437
|
+
}
|
|
2438
|
+
}, [source, version]);
|
|
2439
|
+
const updateSourceAndVersion = (newSource, newVersion) => {
|
|
2440
|
+
const newParams = new URLSearchParams(searchParams);
|
|
2441
|
+
if (newSource && newVersion) {
|
|
2442
|
+
newParams.set("source", newSource);
|
|
2443
|
+
newParams.set("version", newVersion);
|
|
2444
|
+
} else {
|
|
2445
|
+
newParams.delete("source");
|
|
2446
|
+
newParams.delete("version");
|
|
2447
|
+
}
|
|
2448
|
+
setSearchParams(newParams);
|
|
2449
|
+
setSource(newSource);
|
|
2450
|
+
setVersion(newVersion);
|
|
2451
|
+
};
|
|
2452
|
+
const clearSourceAndVersion = () => {
|
|
2453
|
+
updateSourceAndVersion(null, null);
|
|
2454
|
+
};
|
|
2455
|
+
const match = React.useMemo(() => ({
|
|
2456
|
+
params,
|
|
2457
|
+
path: pathname
|
|
2458
|
+
}), [params, pathname]);
|
|
2459
|
+
return {
|
|
2460
|
+
namespace,
|
|
2461
|
+
id,
|
|
2462
|
+
group,
|
|
2463
|
+
subsection,
|
|
2464
|
+
source,
|
|
2465
|
+
version,
|
|
2466
|
+
params,
|
|
2467
|
+
searchParams,
|
|
2468
|
+
setSource,
|
|
2469
|
+
setVersion,
|
|
2470
|
+
updateSourceAndVersion,
|
|
2471
|
+
clearSourceAndVersion,
|
|
2472
|
+
match,
|
|
2473
|
+
search
|
|
2474
|
+
};
|
|
2475
|
+
};
|
|
2476
|
+
|
|
2406
2477
|
exports.checkPermission = checkPermission;
|
|
2407
2478
|
exports.checkPermissionList = checkPermissionList;
|
|
2408
2479
|
exports.useAdminDashboard = useAdminDashboard;
|
|
@@ -2421,4 +2492,5 @@ exports.useRadialBarChart = useRadialBarChart;
|
|
|
2421
2492
|
exports.useSource = useSource;
|
|
2422
2493
|
exports.useSources = useSources;
|
|
2423
2494
|
exports.useThemeLayout = useThemeLayout;
|
|
2495
|
+
exports.useViewFormUrlParams = useViewFormUrlParams;
|
|
2424
2496
|
exports.useWidgetFetch = useWidgetFetch;
|