datastake-daf 0.6.787 → 0.6.788

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.
Files changed (62) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/components/index.js +579 -722
  7. package/dist/pages/index.js +774 -33
  8. package/dist/services/index.js +1 -10
  9. package/dist/style/datastake/mapbox-gl.css +330 -0
  10. package/dist/utils/index.js +12 -28
  11. package/package.json +1 -1
  12. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/ActivityIndicators.stories.js +24 -0
  13. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +1 -0
  14. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/style.js +34 -0
  15. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/KeyIndicators.stories.js +39 -0
  16. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/LabelWithIcon.jsx +38 -0
  17. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +16 -3
  18. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/style.js +33 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +1 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  21. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  22. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  23. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +1 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
  25. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  26. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  27. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
  28. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +5 -23
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +21 -12
  32. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +8 -13
  33. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
  34. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
  35. package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityImagery/index.jsx +29 -0
  36. package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityLocation/index.jsx +94 -0
  37. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/PlantedSpecies/index.jsx +56 -0
  38. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SeedlingsHeight/index.jsx +121 -0
  39. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SurvivalRate/index.jsx +94 -0
  40. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/index.jsx +54 -0
  41. package/src/@daf/pages/Summary/Activities/Monitoring/components/WorkersDistribution/index.jsx +49 -0
  42. package/src/@daf/pages/Summary/Activities/Monitoring/config.js +51 -0
  43. package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +236 -0
  44. package/src/@daf/pages/Summary/Activities/Monitoring/index.jsx +66 -0
  45. package/src/@daf/services/AdminService.js +3 -12
  46. package/src/@daf/services/DashboardService.js +1 -2
  47. package/src/@daf/utils/filters.js +89 -89
  48. package/src/constants/locales/en/translation.js +0 -3
  49. package/src/constants/locales/fr/translation.js +1 -1
  50. package/src/constants/locales/sp/translation.js +1 -1
  51. package/src/pages.js +1 -0
  52. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +0 -224
  53. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +0 -65
  54. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +0 -180
  55. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  56. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +0 -27
  57. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +0 -157
  58. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +0 -31
  59. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +0 -77
  60. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +0 -117
  61. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +0 -54
  62. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
@@ -8,7 +8,7 @@ export default function TopContributors({ data, loading, t }) {
8
8
  const container = useRef(null);
9
9
 
10
10
  useTopContributors({ container, data, t });
11
- console.log("topcontributorshhhh", data);
11
+
12
12
  return (
13
13
  <Widget
14
14
  title={t(`admin::top-contributors`)}
@@ -12,7 +12,7 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
12
12
  const [mainGraph, setMainGraph] = useState(null);
13
13
  const [data, setData] = useState([]);
14
14
  const { token } = useToken();
15
- console.log("mainData", mainData);
15
+
16
16
  const fetchData = () => {
17
17
  const { dates = [] } = mainData;
18
18
  const _data = [];
@@ -9,7 +9,7 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
9
9
  const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
10
10
 
11
11
  useUserGrowth({ container, data, t, translationKeys });
12
- console.log("usergrowthhhhh", data);
12
+
13
13
 
14
14
  useEffect(() => {
15
15
  if (typeof fetchUserGrowth === "function") {
@@ -24,6 +24,7 @@ export default function AddUserModal({ isOpen, defaultData = {}, userRoles = [],
24
24
  .catch(() => {});
25
25
  };
26
26
 
27
+ console.log("hellooooooooooooooooooooooooo");
27
28
 
28
29
  return (
29
30
  <Modal
@@ -1,7 +1,7 @@
1
1
  import Modal from "../../../../Modal/index.jsx";
2
2
  import { Form, Input, Select, theme } from "antd";
3
3
  import { Container } from "../CombineModalStyle.js";
4
- // import { findOptions } from "../../../../../../../helpers/StringHelper.js";
4
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
5
5
  import DAFTable from "../../../../Table/index.jsx";
6
6
  import { useMemo, useState } from "react";
7
7
  import { getColumns } from "./helper.js";
@@ -47,7 +47,7 @@ export default function NewAccount({
47
47
  return (
48
48
  <Modal
49
49
  t={t}
50
- title={t(isEdit ? "edit-account" : "add-account")}
50
+ title={t(isEdit ? "admin::edit-account" : "admin::add-account")}
51
51
  open={isOpen}
52
52
  onClose={onClose}
53
53
  onSuccess={onSubmit}
@@ -20,7 +20,7 @@ export default function AdminDashboardScreen({ config }) {
20
20
  userGrowthDataLoading,
21
21
  } = useWidgetFetch();
22
22
 
23
- // console.log({userGrowthData});
23
+ console.log({userGrowthData});
24
24
 
25
25
  const actionsWidgetsConfig = useMemo(
26
26
  () => getActionWidgetsConfig({ getRedirectLink }),
@@ -39,7 +39,7 @@ export default function AdminDashboardScreen({ config }) {
39
39
  const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
40
40
  const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
41
41
  const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
42
- console.log("safeUserGrowth", safeUserGrowth);
42
+
43
43
 
44
44
  return (
45
45
  <AdminDashboard
@@ -47,11 +47,11 @@ export default function AdminLocationScreen({ config }) {
47
47
  const handleMergeLocations = useCallback(
48
48
  async (mergeData) => {
49
49
  try {
50
- if (AdminService.mergeSubjects) {
51
- await AdminService.mergeSubjects({ subject: 'location', ...mergeData });
50
+ if (AdminService.mergeLocations) {
51
+ await AdminService.mergeLocations(mergeData);
52
52
  message.success(t("Locations merged successfully"));
53
53
  } else {
54
- console.warn("AdminService.mergeSubjects is not implemented");
54
+ console.warn("AdminService.mergeLocations is not implemented");
55
55
  message.success(t("Locations merged successfully"));
56
56
  }
57
57
  } catch (err) {
@@ -61,12 +61,12 @@ export default function AdminLocationScreen({ config }) {
61
61
  [AdminService, t, handleError]
62
62
  );
63
63
 
64
- // Use custom getData if provided, otherwise use default AdminService.getSubjects
64
+ // Use custom getData if provided, otherwise use default AdminService.getLocations
65
65
  const getLocations = useCallback((params) => {
66
66
  if (getData) {
67
67
  return getData(params);
68
68
  }
69
- return AdminService.getSubjects({ subject: 'location', params });
69
+ return AdminService.getLocations(params);
70
70
  }, [getData, AdminService]);
71
71
 
72
72
  return (
@@ -48,7 +48,7 @@ export default function AdminSubjectsScreen({ config }) {
48
48
  async (mergeData) => {
49
49
  try {
50
50
  if (AdminService.mergeSubjects) {
51
- await AdminService.mergeSubjects({ subject: 'stakeholder', ...mergeData });
51
+ await AdminService.mergeSubjects(mergeData);
52
52
  message.success(t("Subjects merged successfully"));
53
53
  } else {
54
54
  console.warn("AdminService.mergeSubjects is not implemented");
@@ -66,7 +66,7 @@ export default function AdminSubjectsScreen({ config }) {
66
66
  if (getData) {
67
67
  return getData(params);
68
68
  }
69
- return AdminService.getSubjects({ subject: 'stakeholder', params });
69
+ return AdminService.getSubjects(params);
70
70
  }, [getData, AdminService]);
71
71
 
72
72
  return (
@@ -2,7 +2,7 @@ import { useState, useMemo } from "react";
2
2
  import { useAdminTable } from "../hook";
3
3
  import AdminTable from "../components/index.jsx";
4
4
  import DAFTable from "../../../../Table/index.jsx";
5
- import { theme, Tag, message } from "antd";
5
+ import { theme, Tag } from "antd";
6
6
  import CustomIcon from "../../../../Icon/CustomIcon.jsx";
7
7
  import {
8
8
  getTabs,
@@ -11,8 +11,8 @@ import {
11
11
  defaultUrlParams,
12
12
  checkboxConfig,
13
13
  } from "../SubjectsTable/helper.js";
14
+ import { getColumns } from "../SubjectsTable/columns.js";
14
15
  import CombineLocationModal from "../../AdminModals/CombineLocation/index.jsx";
15
- import { getColumns } from "./column.js";
16
16
  const { useToken } = theme;
17
17
 
18
18
  export default function LocationTable({
@@ -37,22 +37,6 @@ export default function LocationTable({
37
37
  const { token } = useToken();
38
38
  const [combineLocationVisible, setCombineLocationVisible] = useState(false);
39
39
 
40
- // Wrapper to transform pagination params to strings and ensure tab is at root level
41
- const getDataWithStringPagination = async ({ params }) => {
42
- // Extract tab from the params (it should already be there from filterParams)
43
- const { pagination, tab, ...otherParams } = params;
44
-
45
- const transformedParams = {
46
- ...otherParams,
47
- pagination: {
48
- skip: String(pagination?.skip || 1),
49
- take: String(pagination?.take || 20),
50
- },
51
- tab: tab || "active", // Ensure tab is at root level with default value
52
- };
53
- return getData({ params: transformedParams });
54
- };
55
-
56
40
  const {
57
41
  filter,
58
42
  activeTab,
@@ -74,7 +58,7 @@ export default function LocationTable({
74
58
  defaultPageSize,
75
59
  filtersConfig,
76
60
  getRedirectLink,
77
- getData: getDataWithStringPagination,
61
+ getData,
78
62
  refetchTrigger,
79
63
  });
80
64
 
@@ -96,7 +80,7 @@ export default function LocationTable({
96
80
  setSelectedLocations,
97
81
  getRedirectLink,
98
82
  selectOptions,
99
- entity: headerTitle,
83
+ entity: headerTitle
100
84
  });
101
85
  }, [t, goTo, module, token, selectedLocations, getRedirectLink, selectOptions, headerTitle]);
102
86
 
@@ -105,7 +89,7 @@ export default function LocationTable({
105
89
  <AdminTable
106
90
  filters={filter}
107
91
  t={t}
108
- headerTitle={"test"}
92
+ headerTitle={headerTitle}
109
93
  actionButton={[
110
94
  {
111
95
  icon: "Merge",
@@ -126,7 +110,6 @@ export default function LocationTable({
126
110
  checkboxConfig={checkboxConfig}
127
111
  defaultTableFilters={{}}
128
112
  breadcrumbs={breadcrumbs}
129
-
130
113
  >
131
114
  {selectedLocations.length > 0 && (
132
115
  <div
@@ -185,7 +168,6 @@ export default function LocationTable({
185
168
  if (typeof mergeSubjectsFunction === 'function') {
186
169
  mergeSubjectsFunction(data);
187
170
  setSelectedLocations([])
188
- message.success(t("Locations successfully merged."))
189
171
  }
190
172
  }}
191
173
  selectedLocations={selectedLocations}
@@ -104,48 +104,48 @@ export const getColumns = ({
104
104
  return <Tooltip title={country}>{country}</Tooltip>;
105
105
  },
106
106
  },
107
- {
108
- title: t("Admin Level 1"),
109
- dataIndex: "administrativeLevel1",
110
- key: "administrativeLevel1",
111
- ellipsis: true,
112
- show: entity.includes("location"),
113
- render: (value, all) => {
114
- if (all.empty) {
115
- return <div className="daf-default-cell" />;
116
- }
107
+ {
108
+ title: t("Province"),
109
+ dataIndex: "administrativeLevel1",
110
+ key: "administrativeLevel1",
111
+ ellipsis: true,
112
+ show: entity.includes("locations"),
113
+ render: (value, all) => {
114
+ if (all.empty) {
115
+ return <div className="daf-default-cell" />;
116
+ }
117
117
 
118
- let label;
119
- if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
120
- label = all?.linking?.SCL?.[value]?.name
121
- } else {
122
- label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
123
- }
118
+ let label;
119
+ if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
120
+ label = all?.linking?.SCL?.[value]?.name
121
+ } else {
122
+ label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
123
+ }
124
124
 
125
- return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
125
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
126
+ },
126
127
  },
127
- },
128
- {
129
- title: t("Admin Level 2"),
130
- dataIndex: "administrativeLevel2",
131
- key: "administrativeLevel2",
132
- show: entity.includes("location"),
133
- ellipsis: true,
134
- render: (value, all) => {
135
- if (all.empty) {
136
- return <div className="daf-default-cell" />;
137
- }
128
+ {
129
+ title: t("Territory"),
130
+ dataIndex: "administrativeLevel2",
131
+ key: "administrativeLevel2",
132
+ show: entity.includes("locations"),
133
+ ellipsis: true,
134
+ render: (value, all) => {
135
+ if (all.empty) {
136
+ return <div className="daf-default-cell" />;
137
+ }
138
138
 
139
- let label;
140
- if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
141
- label = all?.linking?.SCL?.[value]?.name
142
- } else {
143
- label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
144
- }
139
+ let label;
140
+ if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
141
+ label = all?.linking?.SCL?.[value]?.name
142
+ } else {
143
+ label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
144
+ }
145
145
 
146
- return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
146
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
147
+ },
147
148
  },
148
- },
149
149
  {
150
150
  title: t("Sources"),
151
151
  dataIndex: "sources",
@@ -2,7 +2,7 @@ import { useState, useMemo } from "react";
2
2
  import { useAdminTable } from "../hook";
3
3
  import AdminTable from "../components/index.jsx";
4
4
  import DAFTable from "../../../../Table/index.jsx";
5
- import { theme, Tag, message } from "antd";
5
+ import { theme, Tag } from "antd";
6
6
  import CustomIcon from "../../../../Icon/CustomIcon.jsx";
7
7
  import {
8
8
  getTabs,
@@ -67,7 +67,7 @@ export default function SubjectsTable({
67
67
  return {
68
68
  category: config.options?.category,
69
69
  country: config.options?.countries,
70
- sources: [],
70
+ sources: [], //TODO: add sources logic and make sure you only show unique sources only once
71
71
  };
72
72
  }, [config.options]);
73
73
 
@@ -113,15 +113,25 @@ export default function SubjectsTable({
113
113
  breadcrumbs={breadcrumbs}
114
114
  >
115
115
  {selectedSubjects.length > 0 && (
116
- <div className="flex flex-row ml-6 mt-5" style={{ flexWrap: "wrap", gap: "8px" }}>
116
+ <div
117
+ className="flex flex-row ml-6 mt-5"
118
+ style={{
119
+ flexWrap: "wrap",
120
+ gap: "8px",
121
+ }}
122
+ >
117
123
  {selectedSubjects.map((account) => (
118
124
  <Tag
119
125
  key={account.userId}
120
126
  className="flex flex-row gap-2 items-center"
121
127
  onClick={() =>
122
- setSelectedSubjects((prev) => prev.filter((a) => a.datastakeId !== account.datastakeId))
128
+ setSelectedSubjects((prev) =>
129
+ prev.filter((a) => a.datastakeId !== account.datastakeId),
130
+ )
123
131
  }
124
- style={{ cursor: "pointer" }}
132
+ style={{
133
+ cursor: "pointer",
134
+ }}
125
135
  >
126
136
  <span>{account.datastakeId}</span>
127
137
  <CustomIcon name="Close" size={10} />
@@ -150,20 +160,19 @@ export default function SubjectsTable({
150
160
  <CombineSubjectsModal
151
161
  isOpen={isCombineModalOpen}
152
162
  t={t}
153
- onClose={() => setIsModalOpen(false)}
163
+ onClose={() => {
164
+ setIsModalOpen(false);
165
+ }}
154
166
  onSuccess={(data) => {
155
167
  setIsModalOpen(false);
156
168
  setLoading(true);
157
- message.success(t("Subjects successfully merged."))
158
169
  if (typeof mergeSubjectsFunction === 'function') {
159
- mergeSubjectsFunction(data).finally(() => {
160
- setSelectedSubjects([]);
161
- fetchData();
162
- });
170
+ mergeSubjectsFunction(data);
171
+ setSelectedSubjects([])
163
172
  }
164
173
  }}
165
174
  selectedSubjects={selectedSubjects}
166
- selectOptions={selectOptions}
175
+ selectOptions={selectOptions || {}}
167
176
  module={module}
168
177
  entity={headerTitle}
169
178
  />
@@ -167,7 +167,10 @@ export const getColumns = ({
167
167
  return cols.filter((v) => v.show);
168
168
  };
169
169
 
170
- export const checkboxConfig = {};
170
+ export const checkboxConfig = {
171
+ name: "Name",
172
+ datastakeId: "ID",
173
+ };
171
174
 
172
175
  export const selectFiltersConfig = {
173
176
  userRole: {
@@ -191,17 +194,9 @@ export const selectFiltersConfig = {
191
194
  };
192
195
 
193
196
  export const filtersConfig = {
194
- search: "",
195
- };
196
-
197
- export const defaultUrlParams = {
198
- search: "",
199
- userRole: null,
200
- status: null,
197
+ name: "",
198
+ datastakeId: "",
201
199
  };
202
200
 
203
- export const defaultTableFilters = {
204
- search: "",
205
- userRole: null,
206
- status: null,
207
- };
201
+ export const defaultUrlParams = {};
202
+ export const defaultTableFilters = {};
@@ -60,10 +60,10 @@ export default function Users({
60
60
  userRole: userRoles.filter((u) => !u.isForAppAdmin),
61
61
  status: accountStatuses,
62
62
  };
63
- }, [userRoles, accountStatuses]);
63
+ }, [userRoles]);
64
64
 
65
65
  const canClearSearch = useMemo(() => {
66
- return !!activeFilters.search || !!activeFilters.userRole || !!activeFilters.status;
66
+ return !!activeFilters.search;
67
67
  }, [activeFilters]);
68
68
 
69
69
  const onDeleteUserClick = useCallback(
@@ -104,7 +104,7 @@ export function getAdminRoutes(config) {
104
104
  ...(typeof useAdminLocationConfig === "function"
105
105
  ? [
106
106
  {
107
- path: "management/subjects/location",
107
+ path: "subjects/location",
108
108
  key: `${APP_PREFIX}_ADMIN_SUBJECTS_LOCATIONS`,
109
109
  exact: true,
110
110
  visible: (user) => userIsAdmin(user),
@@ -115,7 +115,7 @@ export function getAdminRoutes(config) {
115
115
  ...(typeof useAdminSubjectsConfig === "function"
116
116
  ? [
117
117
  {
118
- path: "management/subjects/stakeholder",
118
+ path: "subjects/stakeholder",
119
119
  key: `${APP_PREFIX}_ADMIN_SUBJECTS_STAKEHOLDERS`,
120
120
  exact: true,
121
121
  visible: (user) => userIsAdmin(user),
@@ -0,0 +1,29 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ImageCarousel } from '../../../../../../../../src/index.js';
3
+ import { getActivityImages } from '../../helper';
4
+ import { useResizeContext } from '../../../../../../../../src/context';
5
+
6
+ const ActivityImagery = ({
7
+ activityData,
8
+ loading = false,
9
+ t = (s) => s
10
+ }) => {
11
+ const { isCollapsed, isNestedSidebarCollapsed } = useResizeContext();
12
+ const images = useMemo(() => getActivityImages(activityData), [activityData]);
13
+
14
+ return (
15
+ <div style={{ maxWidth: "70%", width: "calc(100% - 405px)" }}>
16
+ <ImageCarousel
17
+ loading={loading}
18
+ images={images}
19
+ title={t("straatos::activity-imagery")}
20
+ key={`${isCollapsed}-${isNestedSidebarCollapsed}`}
21
+ customArrows={true}
22
+ activeDotColor="#003435"
23
+ />
24
+ </div>
25
+ );
26
+ };
27
+
28
+ export default ActivityImagery;
29
+
@@ -0,0 +1,94 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Widget, MineSiteMap } from '../../../../../../../../src/index.js';
3
+ import { getMapDataFromActivity } from '../../helper';
4
+ import { convertDMS } from '../../../../../../../../src/helpers/Map';
5
+ import CustomIcon from '../../../../../../../../src/@daf/core/components/Icon/CustomIcon.jsx';
6
+
7
+ const ActivityLocation = ({
8
+ activityData,
9
+ loading = false,
10
+ t = (s) => s
11
+ }) => {
12
+ const mapData = useMemo(() => getMapDataFromActivity(activityData, t), [activityData, t]);
13
+
14
+ return (
15
+ <section>
16
+ <Widget
17
+ title={t("Activity Location")}
18
+ className="no-px h-w-btn-header no-pt-body no-p-body no-pb-body"
19
+ style={{ height: '100%', display: 'flex', flexDirection: 'column' }}
20
+ >
21
+ <div style={{ flex: 1, minHeight: 0 }}>
22
+ <MineSiteMap
23
+ loading={loading}
24
+ t={t}
25
+ isSatellite={true}
26
+ app={"straatos"}
27
+ type={'location-territory'}
28
+ showSider={false}
29
+ user={null}
30
+ data={mapData}
31
+ maxZoom={18}
32
+ primaryLink={true}
33
+ style={{ height: '100%', width: '100%' }}
34
+ renderTooltipForLocation={(data) => {
35
+ const coordinates = data.gps?.latitude && data.gps?.longitude
36
+ ? convertDMS(data.gps.latitude, data.gps.longitude)
37
+ : null;
38
+
39
+ if (!coordinates) {
40
+ return [];
41
+ }
42
+
43
+ const isActivityEnd = data.name === t("Activity End") || data.id?.includes('-departure');
44
+ const iconColor = isActivityEnd ? "#FF7A45" : "#016C6E";
45
+
46
+ return [
47
+ {
48
+ label: t("Coordinates"),
49
+
50
+ value: (
51
+ <div style={{ display: 'flex', alignItems: 'center', gap: '6px', flexWrap: 'nowrap' }}>
52
+ {/* Latitude icon (vertical) */}
53
+ <div style={{ display: 'flex', alignItems: 'center' }}>
54
+ <CustomIcon
55
+ name="SpacingHeight"
56
+ width={14}
57
+ height={14}
58
+ color={iconColor}
59
+ />
60
+ <span style={{ fontWeight: 600, marginLeft: '4px' }}>{coordinates[0]}</span>
61
+ </div>
62
+ {/* Longitude icon (horizontal) */}
63
+ <div style={{ display: 'flex', alignItems: 'center' }}>
64
+ <CustomIcon
65
+ name="SpacingWidth"
66
+ width={14}
67
+ height={14}
68
+ color={iconColor}
69
+ />
70
+ <span style={{ fontWeight: 600, marginLeft: '4px' }}>{coordinates[1]}</span>
71
+ </div>
72
+ </div>
73
+ ),
74
+ },
75
+ ];
76
+ }}
77
+ renderTooltipForTerritory={(data) => {
78
+ return [
79
+ {
80
+ label: t("Plot Name"),
81
+ value: data.plotName || data.name || "--",
82
+ },
83
+ ];
84
+ }}
85
+ link={true}
86
+ />
87
+ </div>
88
+ </Widget>
89
+ </section>
90
+ );
91
+ };
92
+
93
+ export default ActivityLocation;
94
+
@@ -0,0 +1,56 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ActivityIndicators } from '../../../../../../../../../../src/index.js';
3
+
4
+ const PlantedSpecies = ({
5
+ activityData,
6
+ loading = false,
7
+ t = (s) => s
8
+ }) => {
9
+ const speciesConfig = useMemo(() => {
10
+ // Extract planted species from activityData
11
+ // Assuming the data structure might have plantedSpecies array or similar
12
+ const species = activityData?.plantedSpecies || activityData?.mangroveSpecies || [];
13
+
14
+ // If species is an array, map it to config format
15
+ if (Array.isArray(species)) {
16
+ return species.map((speciesItem, index) => {
17
+ const speciesName = typeof speciesItem === 'string'
18
+ ? speciesItem
19
+ : speciesItem?.name || speciesItem?.species || `Species ${index + 1}`;
20
+
21
+ // Determine if species is selected/planted (you may need to adjust this logic)
22
+ const isSelected = typeof speciesItem === 'object'
23
+ ? speciesItem?.selected !== false
24
+ : true;
25
+
26
+ return {
27
+ icon: 'Tree',
28
+ label: speciesName,
29
+ type: isSelected ? 'compliant' : 'notCompliant',
30
+ statusIcon: isSelected ? 'Check' : 'Close'
31
+ };
32
+ });
33
+ }
34
+
35
+ // Fallback: if no species data, show default species from image
36
+ return [
37
+ { icon: 'Tree', label: 'Rhyzophora sp', type: 'compliant', statusIcon: 'Check' },
38
+ { icon: 'Tree', label: 'Rhyzophora', type: 'notCompliant', statusIcon: 'Close' },
39
+ { icon: 'Tree', label: 'Rhyzophora mangle', type: 'notCompliant', statusIcon: 'Close' }
40
+ ];
41
+ }, [activityData]);
42
+
43
+ return (
44
+ <ActivityIndicators
45
+ title={t("Planted Species")}
46
+ config={speciesConfig}
47
+ loading={loading}
48
+ widgetClassName="h-w-btn-header"
49
+ t={t}
50
+ className="single-column"
51
+ />
52
+ );
53
+ };
54
+
55
+ export default PlantedSpecies;
56
+