datastake-daf 0.6.752 → 0.6.753
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/pages/index.js
CHANGED
|
@@ -40813,13 +40813,6 @@ const getKeyIndicatorsRowConfig = ({
|
|
|
40813
40813
|
})
|
|
40814
40814
|
}];
|
|
40815
40815
|
|
|
40816
|
-
// ============================================================================
|
|
40817
|
-
// REGION: Photo/Image Extraction
|
|
40818
|
-
// ============================================================================
|
|
40819
|
-
|
|
40820
|
-
/**
|
|
40821
|
-
* Normalize URL by removing trailing colon if present
|
|
40822
|
-
*/
|
|
40823
40816
|
const normalizeUrl = url => url?.endsWith(':') ? url.slice(0, -1) : url;
|
|
40824
40817
|
|
|
40825
40818
|
/**
|
|
@@ -40932,6 +40925,88 @@ const getGenderTooltipChildren = (item, isEmpty, genderDistributionData, t, rend
|
|
|
40932
40925
|
});
|
|
40933
40926
|
};
|
|
40934
40927
|
|
|
40928
|
+
// ============================================================================
|
|
40929
|
+
// REGION: Multiselect Options
|
|
40930
|
+
// ============================================================================
|
|
40931
|
+
|
|
40932
|
+
/**
|
|
40933
|
+
* Get filtered options for multiselect based on activityData.origin
|
|
40934
|
+
* Filters options based on whether origin contains 'kobo', 'straatos', or both
|
|
40935
|
+
*
|
|
40936
|
+
* @param {Object} activityData - Activity data object containing origin array
|
|
40937
|
+
* @param {React.Component} CustomIcon - CustomIcon component for rendering Monitor option avatar
|
|
40938
|
+
* @returns {Array} - Filtered array of option objects
|
|
40939
|
+
*/
|
|
40940
|
+
const getFilteredOptions = (activityData, CustomIcon) => {
|
|
40941
|
+
const allOptions = [{
|
|
40942
|
+
label: "Own Data",
|
|
40943
|
+
value: "own",
|
|
40944
|
+
avatar: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
40945
|
+
children: "OWN"
|
|
40946
|
+
}),
|
|
40947
|
+
background: "#016C6E",
|
|
40948
|
+
color: "white"
|
|
40949
|
+
}, {
|
|
40950
|
+
label: "Monitor",
|
|
40951
|
+
value: "other",
|
|
40952
|
+
avatar: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
40953
|
+
name: "Search02",
|
|
40954
|
+
size: 14
|
|
40955
|
+
})
|
|
40956
|
+
}];
|
|
40957
|
+
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
40958
|
+
return allOptions;
|
|
40959
|
+
}
|
|
40960
|
+
|
|
40961
|
+
// Extract origin names from the array
|
|
40962
|
+
const originNames = activityData.origin.map(item => item?.name?.toLowerCase()).filter(Boolean);
|
|
40963
|
+
const hasKobo = originNames.includes('kobo');
|
|
40964
|
+
const hasStraatos = originNames.includes('straatos');
|
|
40965
|
+
|
|
40966
|
+
// If contains kobo only, show only Monitor
|
|
40967
|
+
if (hasKobo && !hasStraatos) {
|
|
40968
|
+
return allOptions.filter(option => option.value === 'other');
|
|
40969
|
+
}
|
|
40970
|
+
|
|
40971
|
+
// If contains straatos only, show only Own Data
|
|
40972
|
+
if (hasStraatos && !hasKobo) {
|
|
40973
|
+
return allOptions.filter(option => option.value === 'own');
|
|
40974
|
+
}
|
|
40975
|
+
|
|
40976
|
+
// If contains both or neither, show both
|
|
40977
|
+
return allOptions;
|
|
40978
|
+
};
|
|
40979
|
+
|
|
40980
|
+
/**
|
|
40981
|
+
* Get default selected value for multiselect based on activityData.origin
|
|
40982
|
+
*
|
|
40983
|
+
* @param {Object} activityData - Activity data object containing origin array
|
|
40984
|
+
* @returns {Array} - Array of default selected values
|
|
40985
|
+
*/
|
|
40986
|
+
const getDefaultSelected = activityData => {
|
|
40987
|
+
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
40988
|
+
return ['own'];
|
|
40989
|
+
}
|
|
40990
|
+
|
|
40991
|
+
// Extract origin names from the array
|
|
40992
|
+
const originNames = activityData.origin.map(item => item?.name?.toLowerCase()).filter(Boolean);
|
|
40993
|
+
const hasKobo = originNames.includes('kobo');
|
|
40994
|
+
const hasStraatos = originNames.includes('straatos');
|
|
40995
|
+
|
|
40996
|
+
// If contains kobo only, default to monitor (other)
|
|
40997
|
+
if (hasKobo && !hasStraatos) {
|
|
40998
|
+
return ['other'];
|
|
40999
|
+
}
|
|
41000
|
+
|
|
41001
|
+
// If contains straatos only, default to own
|
|
41002
|
+
if (hasStraatos && !hasKobo) {
|
|
41003
|
+
return ['own'];
|
|
41004
|
+
}
|
|
41005
|
+
|
|
41006
|
+
// If contains both or neither, default to own
|
|
41007
|
+
return ['own'];
|
|
41008
|
+
};
|
|
41009
|
+
|
|
40935
41010
|
// ============================================================================
|
|
40936
41011
|
// REGION: Activity Indicators
|
|
40937
41012
|
// ============================================================================
|
|
@@ -41269,6 +41344,12 @@ const RestorationActivitySummary = ({
|
|
|
41269
41344
|
|
|
41270
41345
|
// Activity Indicators Config - mapped from activityData
|
|
41271
41346
|
const activityIndicatorsConfig = React.useMemo(() => getActivityIndicatorsConfig(activityData, t), [activityData, t]);
|
|
41347
|
+
|
|
41348
|
+
// Filter options based on activityData.origin
|
|
41349
|
+
const filteredOptions = React.useMemo(() => getFilteredOptions(activityData, CustomIcon), [activityData]);
|
|
41350
|
+
|
|
41351
|
+
// Get default selected based on activityData.origin
|
|
41352
|
+
const defaultSelected = React.useMemo(() => getDefaultSelected(activityData), [activityData]);
|
|
41272
41353
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
41273
41354
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
41274
41355
|
title: 'Restoration Activity Summary',
|
|
@@ -41278,7 +41359,25 @@ const RestorationActivitySummary = ({
|
|
|
41278
41359
|
actionButtons: actionButtons,
|
|
41279
41360
|
breadcrumbs: breadcrumbs,
|
|
41280
41361
|
goBackTo: goBackTo,
|
|
41281
|
-
loading: loading
|
|
41362
|
+
loading: loading,
|
|
41363
|
+
addedHeaderFirst: true,
|
|
41364
|
+
addedHeader: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41365
|
+
style: {
|
|
41366
|
+
marginRight: 0
|
|
41367
|
+
},
|
|
41368
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
|
|
41369
|
+
canUnselectLast: false,
|
|
41370
|
+
options: filteredOptions,
|
|
41371
|
+
isAvatarGroup: true,
|
|
41372
|
+
selectionType: "checkbox",
|
|
41373
|
+
onChange: selected => {
|
|
41374
|
+
console.log(selected);
|
|
41375
|
+
},
|
|
41376
|
+
dropDownWidth: 200,
|
|
41377
|
+
defaultSelected: defaultSelected,
|
|
41378
|
+
placeholder: "Select partners..."
|
|
41379
|
+
})
|
|
41380
|
+
})
|
|
41282
41381
|
}),
|
|
41283
41382
|
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
41284
41383
|
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
@@ -41307,50 +41406,6 @@ const RestorationActivitySummary = ({
|
|
|
41307
41406
|
app: "straatos",
|
|
41308
41407
|
showSider: false,
|
|
41309
41408
|
user: null,
|
|
41310
|
-
data: [{
|
|
41311
|
-
_id: {},
|
|
41312
|
-
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
|
|
41313
|
-
color: "#6698E4",
|
|
41314
|
-
parent: {
|
|
41315
|
-
_id: {},
|
|
41316
|
-
createdAt: "2024-06-13T14:51:55.296Z",
|
|
41317
|
-
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
41318
|
-
id: "a5340bf1-2c7d-413f-a2a5-ccd7dc8f7a7c",
|
|
41319
|
-
name: "New Mine",
|
|
41320
|
-
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
41321
|
-
collectId: "f8a2b6a9cc935ef3e5844427f49aade34e152eca",
|
|
41322
|
-
country: "AL",
|
|
41323
|
-
category: "mineSite",
|
|
41324
|
-
datastakeId: "LOC-00000000141",
|
|
41325
|
-
__v: 0
|
|
41326
|
-
},
|
|
41327
|
-
administrativeLevel1: "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
|
|
41328
|
-
administrativeLevel2: "f849835d-5640-4bee-ae98-9f1c810c1abe",
|
|
41329
|
-
// "name": "New Mine",
|
|
41330
|
-
country: "AL",
|
|
41331
|
-
category: "mineSite",
|
|
41332
|
-
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
41333
|
-
gps: {
|
|
41334
|
-
latitude: 7,
|
|
41335
|
-
longitude: 1
|
|
41336
|
-
},
|
|
41337
|
-
area: [[6, 5], [7, 1], [9, 2]],
|
|
41338
|
-
associatedSubjects: [{
|
|
41339
|
-
entity: "Event",
|
|
41340
|
-
_id: {},
|
|
41341
|
-
nature: ""
|
|
41342
|
-
}],
|
|
41343
|
-
published: false,
|
|
41344
|
-
version: 1,
|
|
41345
|
-
createdAt: "2024-06-13T14:51:55.296Z",
|
|
41346
|
-
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
41347
|
-
name: "Name",
|
|
41348
|
-
type: "Loc Type",
|
|
41349
|
-
__v: 0,
|
|
41350
|
-
datastakeId: "LOC-00000000141"
|
|
41351
|
-
}]
|
|
41352
|
-
// tooltipAsText: true,
|
|
41353
|
-
,
|
|
41354
41409
|
primaryLink: true,
|
|
41355
41410
|
renderTooltip: () => {
|
|
41356
41411
|
return [{
|
|
@@ -41358,9 +41413,10 @@ const RestorationActivitySummary = ({
|
|
|
41358
41413
|
value: "Name"
|
|
41359
41414
|
}];
|
|
41360
41415
|
},
|
|
41361
|
-
center: [13, -15],
|
|
41362
41416
|
mapConfig: {
|
|
41363
|
-
maxZoom: 18
|
|
41417
|
+
maxZoom: 18,
|
|
41418
|
+
zoom: 5,
|
|
41419
|
+
center: [14, -14]
|
|
41364
41420
|
},
|
|
41365
41421
|
type: 'territory',
|
|
41366
41422
|
link: true,
|
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
1
3
|
// ============================================================================
|
|
2
4
|
// REGION: Photo/Image Extraction
|
|
3
5
|
// ============================================================================
|
|
@@ -120,6 +122,93 @@ export const getGenderTooltipChildren = (item, isEmpty, genderDistributionData,
|
|
|
120
122
|
});
|
|
121
123
|
};
|
|
122
124
|
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// REGION: Multiselect Options
|
|
127
|
+
// ============================================================================
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get filtered options for multiselect based on activityData.origin
|
|
131
|
+
* Filters options based on whether origin contains 'kobo', 'straatos', or both
|
|
132
|
+
*
|
|
133
|
+
* @param {Object} activityData - Activity data object containing origin array
|
|
134
|
+
* @param {React.Component} CustomIcon - CustomIcon component for rendering Monitor option avatar
|
|
135
|
+
* @returns {Array} - Filtered array of option objects
|
|
136
|
+
*/
|
|
137
|
+
export const getFilteredOptions = (activityData, CustomIcon) => {
|
|
138
|
+
const allOptions = [
|
|
139
|
+
{
|
|
140
|
+
label: "Own Data",
|
|
141
|
+
value: "own",
|
|
142
|
+
avatar: <span>OWN</span>,
|
|
143
|
+
background: "#016C6E",
|
|
144
|
+
color: "white",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
label: "Monitor",
|
|
148
|
+
value: "other",
|
|
149
|
+
avatar: <CustomIcon name={"Search02"} size={14} />,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
154
|
+
return allOptions;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Extract origin names from the array
|
|
158
|
+
const originNames = activityData.origin
|
|
159
|
+
.map(item => item?.name?.toLowerCase())
|
|
160
|
+
.filter(Boolean);
|
|
161
|
+
|
|
162
|
+
const hasKobo = originNames.includes('kobo');
|
|
163
|
+
const hasStraatos = originNames.includes('straatos');
|
|
164
|
+
|
|
165
|
+
// If contains kobo only, show only Monitor
|
|
166
|
+
if (hasKobo && !hasStraatos) {
|
|
167
|
+
return allOptions.filter(option => option.value === 'other');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// If contains straatos only, show only Own Data
|
|
171
|
+
if (hasStraatos && !hasKobo) {
|
|
172
|
+
return allOptions.filter(option => option.value === 'own');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// If contains both or neither, show both
|
|
176
|
+
return allOptions;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get default selected value for multiselect based on activityData.origin
|
|
181
|
+
*
|
|
182
|
+
* @param {Object} activityData - Activity data object containing origin array
|
|
183
|
+
* @returns {Array} - Array of default selected values
|
|
184
|
+
*/
|
|
185
|
+
export const getDefaultSelected = (activityData) => {
|
|
186
|
+
if (!activityData?.origin || !Array.isArray(activityData.origin)) {
|
|
187
|
+
return ['own'];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Extract origin names from the array
|
|
191
|
+
const originNames = activityData.origin
|
|
192
|
+
.map(item => item?.name?.toLowerCase())
|
|
193
|
+
.filter(Boolean);
|
|
194
|
+
|
|
195
|
+
const hasKobo = originNames.includes('kobo');
|
|
196
|
+
const hasStraatos = originNames.includes('straatos');
|
|
197
|
+
|
|
198
|
+
// If contains kobo only, default to monitor (other)
|
|
199
|
+
if (hasKobo && !hasStraatos) {
|
|
200
|
+
return ['other'];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// If contains straatos only, default to own
|
|
204
|
+
if (hasStraatos && !hasKobo) {
|
|
205
|
+
return ['own'];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// If contains both or neither, default to own
|
|
209
|
+
return ['own'];
|
|
210
|
+
};
|
|
211
|
+
|
|
123
212
|
// ============================================================================
|
|
124
213
|
// REGION: Activity Indicators
|
|
125
214
|
// ============================================================================
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo, useCallback } from 'react';
|
|
2
|
-
import { DashboardLayout, Header, ImageCarousel, KeyIndicators, MineSiteMap, Widget, PieChart, ActivityIndicators } from '../../../../../../src/index.js'
|
|
2
|
+
import { DashboardLayout, Header, ImageCarousel, KeyIndicators, MineSiteMap, Widget, PieChart, ActivityIndicators, Multiselect, CustomIcon } from '../../../../../../src/index.js'
|
|
3
3
|
import { getKeyIndicatorsRowConfig } from './config';
|
|
4
|
-
import { getActivityImages, getGenderDistributionData, isGenderDistributionEmpty, calculateGenderPieData, getGenderTooltipChildren, getActivityIndicatorsConfig } from './helper';
|
|
4
|
+
import { getActivityImages, getGenderDistributionData, isGenderDistributionEmpty, calculateGenderPieData, getGenderTooltipChildren, getActivityIndicatorsConfig, getFilteredOptions, getDefaultSelected } from './helper';
|
|
5
5
|
import { renderTooltipJsx } from '../../../../../../src/utils';
|
|
6
6
|
import { useResizeContext } from '../../../../../../src/context';
|
|
7
7
|
|
|
@@ -24,6 +24,18 @@ const RestorationActivitySummary = ({ activityData, supportText, onDownload, dow
|
|
|
24
24
|
[activityData, t]
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
+
// Filter options based on activityData.origin
|
|
28
|
+
const filteredOptions = useMemo(() =>
|
|
29
|
+
getFilteredOptions(activityData, CustomIcon),
|
|
30
|
+
[activityData]
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Get default selected based on activityData.origin
|
|
34
|
+
const defaultSelected = useMemo(() =>
|
|
35
|
+
getDefaultSelected(activityData),
|
|
36
|
+
[activityData]
|
|
37
|
+
);
|
|
38
|
+
|
|
27
39
|
return (
|
|
28
40
|
<DashboardLayout
|
|
29
41
|
header={
|
|
@@ -36,6 +48,24 @@ const RestorationActivitySummary = ({ activityData, supportText, onDownload, dow
|
|
|
36
48
|
breadcrumbs={breadcrumbs}
|
|
37
49
|
goBackTo={goBackTo}
|
|
38
50
|
loading={loading}
|
|
51
|
+
addedHeaderFirst
|
|
52
|
+
addedHeader={
|
|
53
|
+
<div style={{ marginRight: 0 }}>
|
|
54
|
+
<Multiselect
|
|
55
|
+
canUnselectLast={false}
|
|
56
|
+
options={filteredOptions}
|
|
57
|
+
isAvatarGroup
|
|
58
|
+
selectionType="checkbox"
|
|
59
|
+
onChange={(selected) => {
|
|
60
|
+
console.log(selected);
|
|
61
|
+
}}
|
|
62
|
+
dropDownWidth={200}
|
|
63
|
+
defaultSelected={defaultSelected}
|
|
64
|
+
placeholder="Select partners..."
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
}
|
|
39
69
|
/>
|
|
40
70
|
}
|
|
41
71
|
>
|
|
@@ -57,57 +87,6 @@ const RestorationActivitySummary = ({ activityData, supportText, onDownload, dow
|
|
|
57
87
|
app={"straatos"}
|
|
58
88
|
showSider={false}
|
|
59
89
|
user={null}
|
|
60
|
-
data={[
|
|
61
|
-
{
|
|
62
|
-
_id: {},
|
|
63
|
-
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
|
|
64
|
-
color: "#6698E4",
|
|
65
|
-
parent: {
|
|
66
|
-
_id: {},
|
|
67
|
-
createdAt: "2024-06-13T14:51:55.296Z",
|
|
68
|
-
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
69
|
-
id: "a5340bf1-2c7d-413f-a2a5-ccd7dc8f7a7c",
|
|
70
|
-
name: "New Mine",
|
|
71
|
-
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
72
|
-
collectId: "f8a2b6a9cc935ef3e5844427f49aade34e152eca",
|
|
73
|
-
country: "AL",
|
|
74
|
-
category: "mineSite",
|
|
75
|
-
datastakeId: "LOC-00000000141",
|
|
76
|
-
__v: 0,
|
|
77
|
-
},
|
|
78
|
-
administrativeLevel1: "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
|
|
79
|
-
administrativeLevel2: "f849835d-5640-4bee-ae98-9f1c810c1abe",
|
|
80
|
-
// "name": "New Mine",
|
|
81
|
-
country: "AL",
|
|
82
|
-
category: "mineSite",
|
|
83
|
-
authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
|
|
84
|
-
gps: {
|
|
85
|
-
latitude: 7,
|
|
86
|
-
longitude: 1,
|
|
87
|
-
},
|
|
88
|
-
area: [
|
|
89
|
-
[6, 5],
|
|
90
|
-
[7, 1],
|
|
91
|
-
[9, 2],
|
|
92
|
-
],
|
|
93
|
-
associatedSubjects: [
|
|
94
|
-
{
|
|
95
|
-
entity: "Event",
|
|
96
|
-
_id: {},
|
|
97
|
-
nature: "",
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
published: false,
|
|
101
|
-
version: 1,
|
|
102
|
-
createdAt: "2024-06-13T14:51:55.296Z",
|
|
103
|
-
updatedAt: "2024-06-13T14:51:55.296Z",
|
|
104
|
-
name: "Name",
|
|
105
|
-
type: "Loc Type",
|
|
106
|
-
__v: 0,
|
|
107
|
-
datastakeId: "LOC-00000000141",
|
|
108
|
-
},
|
|
109
|
-
]}
|
|
110
|
-
// tooltipAsText: true,
|
|
111
90
|
primaryLink={true}
|
|
112
91
|
renderTooltip={() => {
|
|
113
92
|
return [
|
|
@@ -117,8 +96,8 @@ const RestorationActivitySummary = ({ activityData, supportText, onDownload, dow
|
|
|
117
96
|
},
|
|
118
97
|
];
|
|
119
98
|
}}
|
|
120
|
-
|
|
121
|
-
mapConfig={{ maxZoom: 18 }}
|
|
99
|
+
|
|
100
|
+
mapConfig={{ maxZoom: 18, zoom: 5, center: [14, -14] }}
|
|
122
101
|
type={'territory'}
|
|
123
102
|
link={true}
|
|
124
103
|
onClickLink={() => { }}
|