datastake-daf 0.6.795 → 0.6.796

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 (43) hide show
  1. package/dist/components/index.js +248 -77
  2. package/dist/pages/index.js +788 -173
  3. package/dist/style/datastake/mapbox-gl.css +330 -0
  4. package/package.json +1 -1
  5. package/public/Vegetation/black-default.svg +23 -0
  6. package/public/Vegetation/black.svg +12 -0
  7. package/public/Vegetation/damage-from-insects-default.svg +14 -0
  8. package/public/Vegetation/damage-from-insects.svg +8 -0
  9. package/public/Vegetation/dry-or-dead-default.svg +16 -0
  10. package/public/Vegetation/dry-or-dead.svg +7 -0
  11. package/public/Vegetation/healthy-default.svg +14 -0
  12. package/public/Vegetation/healthy.svg +34 -0
  13. package/public/Vegetation/mosaic-default.svg +17 -0
  14. package/public/Vegetation/mosaic.svg +9 -0
  15. package/public/Vegetation/no-leaves-default.svg +6 -0
  16. package/public/Vegetation/no-leaves.svg +5 -0
  17. package/public/Vegetation/reddish-default.svg +23 -0
  18. package/public/Vegetation/reddish.svg +79 -0
  19. package/public/Vegetation/spider-webs-default.svg +10 -0
  20. package/public/Vegetation/spider-webs.svg +10 -0
  21. package/public/Vegetation/white-default.svg +25 -0
  22. package/public/Vegetation/white.svg +12 -0
  23. package/public/Vegetation/yellowing-default.svg +7 -0
  24. package/public/Vegetation/yellowing.svg +8 -0
  25. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +24 -6
  26. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/style.js +2 -6
  27. package/src/@daf/core/components/Dashboard/Widget/VegetationWidget/VegetationWidget.stories.jsx +76 -0
  28. package/src/@daf/core/components/Dashboard/Widget/VegetationWidget/config.js +31 -0
  29. package/src/@daf/core/components/Dashboard/Widget/VegetationWidget/index.jsx +137 -0
  30. package/src/@daf/core/components/ViewForm/components/Records/config.js +3 -0
  31. package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityImagery/index.jsx +12 -10
  32. package/src/@daf/pages/Summary/Activities/Monitoring/components/BiodiversityAndHabitat/helper.js +86 -0
  33. package/src/@daf/pages/Summary/Activities/Monitoring/components/BiodiversityAndHabitat/index.jsx +65 -0
  34. package/src/@daf/pages/Summary/Activities/Monitoring/components/EnvironmentalMetrics/index.jsx +30 -0
  35. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/PlantedSpecies/index.jsx +15 -28
  36. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SeedlingsHeight/index.jsx +17 -30
  37. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SurvivalRate/index.jsx +38 -45
  38. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/index.jsx +87 -8
  39. package/src/@daf/pages/Summary/Activities/Monitoring/config.js +21 -4
  40. package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +7 -1
  41. package/src/@daf/pages/Summary/Activities/Monitoring/index.jsx +31 -8
  42. package/src/constants/Vegetation.js +15 -0
  43. package/src/index.js +1 -0
@@ -12,16 +12,18 @@ const ActivityImagery = ({
12
12
  const images = useMemo(() => getActivityImages(activityData), [activityData]);
13
13
 
14
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>
15
+ <div style={{ maxWidth: "50%", 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
+ height={245}
24
+ />
25
+ </div>
26
+
25
27
  );
26
28
  };
27
29
 
@@ -0,0 +1,86 @@
1
+ export const FAUNA_KEYS = [
2
+ 'birds',
3
+ 'juveniles',
4
+ 'crabs',
5
+ 'cymbium',
6
+ 'fish',
7
+ 'mongooses',
8
+ 'mollusks',
9
+ 'monkeys',
10
+ 'oysters',
11
+ 'snails',
12
+ 'caterpillars',
13
+ 'animal_tracks',
14
+ 'other'
15
+ ];
16
+
17
+ export const INVASIVE_SPECIES_KEYS = [
18
+ 'spiders',
19
+ 'scaleInsects',
20
+ 'caterpillars',
21
+ 'unidentifiedPests',
22
+ 'other',
23
+ ];
24
+
25
+ export const formatFaunaLabel = (key) => {
26
+ return key
27
+ .split('_')
28
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
29
+ .join(' ');
30
+ };
31
+
32
+ export const formatInvasiveSpeciesLabel = (key) => {
33
+ return key
34
+ .replace(/([A-Z])/g, ' $1')
35
+ .split(' ')
36
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
37
+ .join(' ');
38
+ };
39
+
40
+ export const createFaunaIndicatorConfig = (key, faunaPresent, t) => {
41
+ const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(key);
42
+ const label = formatFaunaLabel(key);
43
+
44
+ return {
45
+ label: t(label),
46
+ type: isPresent ? 'compliant' : 'notCompliant',
47
+ statusIcon: isPresent ? 'Check' : 'Close',
48
+ statusIconColor: isPresent ? '#12B76A' : '#6C737F',
49
+ statusBadgeBackgroundColor: isPresent ? undefined : '#F9FAFB',
50
+ statusBadgeBorderColor: isPresent ? undefined : '#E5E7EB'
51
+ };
52
+ };
53
+
54
+ export const createInvasiveSpeciesIndicatorConfig = (key, invasiveSpecies, hasInvasiveSpecies, t) => {
55
+ const shouldShowAllAsNotPresent = hasInvasiveSpecies === 'no';
56
+ const shouldShowRedForPresent = hasInvasiveSpecies === 'yes';
57
+
58
+ const isPresent = !shouldShowAllAsNotPresent &&
59
+ Array.isArray(invasiveSpecies) &&
60
+ invasiveSpecies.includes(key);
61
+
62
+ const isRedBadge = isPresent && shouldShowRedForPresent;
63
+ const label = formatInvasiveSpeciesLabel(key);
64
+
65
+ return {
66
+ label: t(label),
67
+ type: isPresent ? 'compliant' : 'notCompliant',
68
+ statusIcon: isPresent ? 'Check' : 'Close',
69
+ statusIconColor: isRedBadge ? '#D92D20' : (isPresent ? '#12B76A' : '#6C737F'),
70
+ statusBadgeBackgroundColor: isRedBadge ? '#FEE4E2' : (isPresent ? undefined : '#F9FAFB'),
71
+ statusBadgeBorderColor: isRedBadge ? '#FDA29B' : (isPresent ? undefined : '#E5E7EB')
72
+ };
73
+ };
74
+
75
+ export const generateFaunaConfig = (faunaPresent, t) => {
76
+ return FAUNA_KEYS.map(key =>
77
+ createFaunaIndicatorConfig(key, faunaPresent, t)
78
+ );
79
+ };
80
+
81
+ export const generateInvasiveSpeciesConfig = (invasiveSpecies, hasInvasiveSpecies, t) => {
82
+ return INVASIVE_SPECIES_KEYS.map(key =>
83
+ createInvasiveSpeciesIndicatorConfig(key, invasiveSpecies, hasInvasiveSpecies, t)
84
+ );
85
+ };
86
+
@@ -0,0 +1,65 @@
1
+ import React, { useMemo } from 'react';
2
+ import { ActivityIndicators, Widget } from '../../../../../../../../src/index.js';
3
+ import styled from 'styled-components';
4
+ import {
5
+ generateFaunaConfig,
6
+ generateInvasiveSpeciesConfig
7
+ } from './helper';
8
+
9
+ const Container = styled.div`
10
+ display: grid;
11
+ grid-template-columns: 70% 28.5%;
12
+ gap: 24px;
13
+ width: 100%;
14
+ @media (max-width: 768px) {
15
+ grid-template-columns: 1fr;
16
+ }
17
+ `;
18
+
19
+ const BiodiversityAndHabitat = ({
20
+ faunaPresent = [],
21
+ invasiveSpecies = [],
22
+ hasInvasiveSpecies,
23
+ loading = false,
24
+ t = (s) => s
25
+ }) => {
26
+ const observedFaunaConfig = useMemo(() =>
27
+ generateFaunaConfig(faunaPresent, t),
28
+ [faunaPresent, t]
29
+ );
30
+
31
+ const invasiveSpeciesConfig = useMemo(() =>
32
+ generateInvasiveSpeciesConfig(invasiveSpecies, hasInvasiveSpecies, t),
33
+ [invasiveSpecies, hasInvasiveSpecies, t]
34
+ );
35
+
36
+ return (
37
+ <Widget
38
+ title={t("Biodiversity & Habitat")}
39
+ className="with-border-header h-w-btn-header"
40
+ >
41
+ <section>
42
+ <Container>
43
+ <ActivityIndicators
44
+ title={t("Observed Fauna")}
45
+ config={observedFaunaConfig}
46
+ loading={loading}
47
+ widgetClassName="h-w-btn-header"
48
+ t={t}
49
+ />
50
+ <ActivityIndicators
51
+ title={t("Invasive Species")}
52
+ config={invasiveSpeciesConfig}
53
+ loading={loading}
54
+ className="single-column"
55
+ widgetClassName="h-w-btn-header"
56
+ t={t}
57
+ />
58
+ </Container>
59
+ </section>
60
+ </Widget>
61
+ );
62
+ };
63
+
64
+ export default BiodiversityAndHabitat;
65
+
@@ -0,0 +1,30 @@
1
+ import React, { useMemo } from 'react';
2
+ import { KeyIndicators } from '../../../../../../../../src/index.js';
3
+ import { getEnvironmentalMetricsConfig } from '../../config';
4
+
5
+ const EnvironmentalMetrics = ({
6
+ activityData,
7
+ loading = false,
8
+ t = (s) => s,
9
+ options
10
+ }) => {
11
+ const environmentalMetricsConfig = useMemo(() =>
12
+ getEnvironmentalMetricsConfig({ t, data: activityData, options }),
13
+ [t, activityData]
14
+ );
15
+
16
+ return (
17
+ <div style={{ flex: 1, }}>
18
+ <KeyIndicators
19
+ loading={loading}
20
+ config={environmentalMetricsConfig}
21
+ title={t("straatos::environmental-metrics")}
22
+ className="small-content row-content"
23
+ widgetClassName="h-w-btn-header"
24
+ />
25
+ </div>
26
+ );
27
+ };
28
+
29
+ export default EnvironmentalMetrics;
30
+
@@ -2,43 +2,30 @@ import React, { useMemo } from 'react';
2
2
  import { ActivityIndicators } from '../../../../../../../../../../src/index.js';
3
3
 
4
4
  const PlantedSpecies = ({
5
- activityData,
5
+ plantedSpecies,
6
+ mangroveSpecies,
6
7
  loading = false,
7
8
  t = (s) => s
8
9
  }) => {
10
+
9
11
  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
-
12
+ if (Array.isArray(mangroveSpecies) && mangroveSpecies.length > 0) {
13
+ return mangroveSpecies.map((species) => {
14
+ const isPlanted = species.value === plantedSpecies;
26
15
  return {
27
- icon: 'Tree',
28
- label: speciesName,
29
- type: isSelected ? 'compliant' : 'notCompliant',
30
- statusIcon: isSelected ? 'Check' : 'Close'
16
+ label: species.label,
17
+ type: isPlanted ? 'compliant' : 'notCompliant',
18
+ statusIcon: isPlanted ? 'Check' : 'Close',
19
+ statusIconColor: isPlanted ? '#12B76A' : '#6C737F',
20
+ statusBadgeBackgroundColor: isPlanted ? undefined : '#F9FAFB',
21
+ statusBadgeBorderColor: isPlanted ? undefined : '#E5E7EB'
31
22
  };
32
23
  });
33
24
  }
34
25
 
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]);
26
+ return []
27
+
28
+ }, [plantedSpecies, mangroveSpecies]);
42
29
 
43
30
  return (
44
31
  <ActivityIndicators
@@ -2,29 +2,26 @@ import React, { useMemo } from 'react';
2
2
  import { Widget, ColumnChart } from '../../../../../../../../../../src/index.js';
3
3
 
4
4
  const SeedlingsHeight = ({
5
- activityData,
5
+ averageHeight,
6
+ averageHeightUnit,
6
7
  loading = false,
7
8
  t = (s) => s
8
9
  }) => {
9
10
  const heightData = useMemo(() => {
10
11
  // Extract seedlings height from activityData
11
12
  // Assuming the data might have averageHeight, seedlingsHeight, or similar
12
- const averageHeight = activityData?.averageHeight ||
13
- activityData?.seedlingsHeight ||
14
- activityData?.mangroveAverageHeight ||
15
- 28; // Default from image
16
-
17
13
  const heightValue = typeof averageHeight === 'number'
18
14
  ? averageHeight
19
- : parseFloat(averageHeight) || 28;
15
+ : parseFloat(averageHeight) || 0;
20
16
 
21
17
  return [
22
18
  {
23
19
  label: t("Average Height"),
24
- value: heightValue
20
+ value: heightValue,
21
+ unit: averageHeightUnit
25
22
  }
26
23
  ];
27
- }, [activityData, t]);
24
+ }, [averageHeight, averageHeightUnit,t]);
28
25
 
29
26
  const renderTooltipContent = useMemo(() => {
30
27
  return (title, data) => {
@@ -41,26 +38,26 @@ const SeedlingsHeight = ({
41
38
  }
42
39
 
43
40
  const item = data[0];
44
- const value = item?.value || item?.data?.value || 0;
41
+ const rawValue = item?.value || item?.data?.value || 0;
42
+ const value = Number(rawValue) || 0;
43
+ const formattedValue = Number(value).toLocaleString('en-us');
45
44
 
46
45
  return {
47
46
  title: t("Average Height"),
48
47
  items: [
49
48
  {
50
49
  label: t("Average Height"),
51
- value: `${value.toFixed(1)}cm`,
52
- color: '#00AEB1'
50
+ value: `${formattedValue} ${averageHeightUnit || 'cm'}`,
51
+ color: '#00AEB1',
53
52
  }
54
53
  ]
55
54
  };
56
55
  };
57
- }, [t]);
56
+ }, [t, averageHeightUnit]);
58
57
 
59
58
  const isEmpty = useMemo(() => {
60
- return !activityData?.averageHeight &&
61
- !activityData?.seedlingsHeight &&
62
- !activityData?.mangroveAverageHeight;
63
- }, [activityData]);
59
+ return !averageHeight && averageHeight !== 0;
60
+ }, [averageHeight]);
64
61
 
65
62
  return (
66
63
  <Widget
@@ -68,20 +65,11 @@ const SeedlingsHeight = ({
68
65
  title={t("Seedlings Height")}
69
66
  className="with-border-header h-w-btn-header"
70
67
  >
71
- <div
72
- style={{
73
- display: 'flex',
74
- flexDirection: 'column',
75
- minHeight: '250px',
76
- padding: '20px 0'
77
- }}
78
- >
79
68
  <ColumnChart
80
69
  data={isEmpty ? [] : heightData}
81
70
  xFieldKey="label"
82
71
  yFieldKey="value"
83
72
  color="#00AEB1"
84
- height={250}
85
73
  animated={true}
86
74
  renderTooltipContent={renderTooltipContent}
87
75
  yAxis={{
@@ -89,7 +77,7 @@ const SeedlingsHeight = ({
89
77
  max: 35,
90
78
  tickMethod: () => [0, 5, 10, 15, 20, 25, 30, 35],
91
79
  label: {
92
- formatter: (v) => `${v}cm`
80
+ formatter: (v) => `${v} ${averageHeightUnit || 'cm'}`
93
81
  }
94
82
  }}
95
83
  xAxis={{
@@ -103,16 +91,15 @@ const SeedlingsHeight = ({
103
91
  />
104
92
  {!isEmpty && (
105
93
  <div style={{
106
- marginTop: '16px',
94
+ marginTop: '16px',
107
95
  textAlign: 'center',
108
96
  fontSize: '14px',
109
97
  color: '#475467',
110
98
  fontWeight: 500
111
99
  }}>
112
- {t("Average Height")}: {heightData[0]?.value.toFixed(0)}cm
113
100
  </div>
114
101
  )}
115
- </div>
102
+
116
103
  </Widget>
117
104
  );
118
105
  };
@@ -2,65 +2,62 @@ import React, { useMemo } from 'react';
2
2
  import { Widget, DonutPie } from '../../../../../../../../../../src/index.js';
3
3
 
4
4
  const SurvivalRate = ({
5
- activityData,
5
+ survivalRate,
6
6
  loading = false,
7
7
  t = (s) => s
8
8
  }) => {
9
9
  const survivalData = useMemo(() => {
10
- // Extract survival rate from activityData
11
- // Assuming the data might have survivalRate as a percentage (0-100)
12
- const survivalRate = activityData?.survivalRate || activityData?.mangroveSurvivalRate || 78;
13
- const survivalPercent = typeof survivalRate === 'number' ? survivalRate : parseFloat(survivalRate) || 78;
10
+ if (!survivalRate && survivalRate !== 0) {
11
+ return [];
12
+ }
14
13
 
15
14
  return [
16
15
  {
17
16
  type: t("Survival Rate"),
18
- value: survivalPercent
17
+ value: Math.round(survivalRate || 0)
19
18
  },
20
19
  {
21
20
  type: t("Non-survival"),
22
- value: 100 - survivalPercent
21
+ value: 100 - Math.round(survivalRate || 0)
23
22
  }
24
23
  ];
25
- }, [activityData, t]);
24
+ }, [survivalRate, t]);
26
25
 
27
26
  const renderTooltipContent = useMemo(() => {
28
27
  return (title, data) => {
29
- if (!data || data.length === 0) {
28
+ if (!survivalData || survivalData.length === 0 || !data || data.length === 0) {
30
29
  return {
31
30
  title: t("Survival Rate"),
32
31
  items: [
33
32
  {
34
- label: t("No Data"),
33
+ label: t("Not answered"),
35
34
  value: '-'
36
35
  }
37
36
  ]
38
37
  };
39
38
  }
40
39
 
41
- const item = data[0];
42
- const value = item?.value || item?.data?.value || 0;
43
- const itemType = item?.type || item?.data?.type || t("Survival Rate");
44
-
45
- // Determine color based on item type
46
- const itemColor = itemType === t("Survival Rate") ? '#00AEB1' : '#E8EDF3';
47
-
48
40
  return {
49
41
  title: t("Survival Rate"),
50
- items: [
51
- {
52
- label: itemType,
53
- value: `${value.toFixed(1)}%`,
54
- color: itemColor
55
- }
56
- ]
42
+ items: survivalData.map((item) => ({
43
+ label: item.type,
44
+ value: item.value + '%',
45
+ color: item.type === t("Survival Rate") ? '#00AEB1' : '#E8EDF3'
46
+ })),
57
47
  };
58
48
  };
59
- }, [t]);
49
+ }, [survivalData, t]);
60
50
 
61
51
  const isEmpty = useMemo(() => {
62
- return !activityData?.survivalRate && !activityData?.mangroveSurvivalRate;
63
- }, [activityData]);
52
+ return !survivalRate && survivalRate !== 0;
53
+ }, [survivalRate]);
54
+
55
+ const chartColors = useMemo(() => {
56
+ if (isEmpty) {
57
+ return ['#E5E7EB', '#F9FAFB'];
58
+ }
59
+ return ['#00AEB1', '#E8EDF3'];
60
+ }, [isEmpty]);
64
61
 
65
62
  return (
66
63
  <Widget
@@ -68,24 +65,20 @@ const SurvivalRate = ({
68
65
  title={t("Survival Rate")}
69
66
  className="with-border-header h-w-btn-header"
70
67
  >
71
-
72
- {/* <DonutPie
73
- angleField="value"
74
- color={[
75
- '#E8EDF3'
76
- ]}
77
- colorField="type"
78
- data={[]}
79
- height={200}
80
- innerRadius={0.78}
81
- radius={1}
82
- renderTooltipContent={() => { }}
83
- tooltip
84
- tooltipConfig={{
85
- showTitle: false
86
- }}
87
- /> */}
88
-
68
+ <DonutPie
69
+ angleField="value"
70
+ color={chartColors}
71
+ colorField="type"
72
+ data={isEmpty ? [] : survivalData}
73
+ height={250}
74
+ innerRadius={0.78}
75
+ radius={1}
76
+ renderTooltipContent={renderTooltipContent}
77
+ tooltip
78
+ tooltipConfig={{
79
+ showTitle: false
80
+ }}
81
+ />
89
82
  </Widget>
90
83
  );
91
84
  };
@@ -3,48 +3,127 @@ import PlantedSpecies from './components/PlantedSpecies/index.jsx';
3
3
  import SurvivalRate from './components/SurvivalRate/index.jsx';
4
4
  import SeedlingsHeight from './components/SeedlingsHeight/index.jsx';
5
5
  import styled from 'styled-components';
6
- import { Widget } from '../../../../../../../../src/index.js';
6
+ import { Widget, VegetationHealth } from '../../../../../../../../src/index.js';
7
+ import { VEGETATION_KEYS } from '../../../../../../../../src/constants/Vegetation.js';
7
8
 
8
9
  const Container = styled.div`
9
10
  display: grid;
10
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
11
+ grid-template-columns: repeat(3, 1fr);
12
+ gap: 24px;
13
+ width: 100%;
14
+ overflow-x: auto;
15
+
16
+ > * {
17
+ min-width: 0;
18
+ }
19
+
20
+ @media (max-width: 768px) {
21
+ grid-template-columns: repeat(3, minmax(200px, 1fr));
22
+ }
23
+ `;
24
+
25
+ const VegetationHealthContainer = styled.div`
26
+ display: flex;
11
27
  gap: 24px;
12
28
  width: 100%;
13
29
 
14
30
  @media (max-width: 768px) {
15
- grid-template-columns: 1fr;
31
+ flex-direction: column;
16
32
  }
17
33
  `;
18
34
 
35
+ const VegetationHealthSection = styled.section`
36
+ width: 66%;
37
+ `;
38
+
19
39
  const MangroveGrowthAndSurvival = ({
20
40
  activityData,
21
41
  loading = false,
22
- t = (s) => s
42
+ t = (s) => s,
43
+ options
23
44
  }) => {
45
+
24
46
  return (
25
47
 
26
48
  <Widget
27
- title={t("Mangrove Growth & Survival")}
49
+ title={t("Mangrove Growth and Survival")}
28
50
  className="with-border-header h-w-btn-header"
29
51
  >
30
52
  <section>
53
+
54
+
31
55
  <Container>
32
56
  <PlantedSpecies
33
- activityData={activityData}
57
+ plantedSpecies={activityData?.plantedSpecies}
58
+ mangroveSpecies={options?.mangroveSpecies}
34
59
  loading={loading}
35
60
  t={t}
36
61
  />
37
62
  <SurvivalRate
38
- activityData={activityData}
63
+ survivalRate={activityData?.survivalRate}
39
64
  loading={loading}
40
65
  t={t}
41
66
  />
42
67
  <SeedlingsHeight
43
- activityData={activityData}
68
+ averageHeight={activityData?.averageHeightValue}
69
+ averageHeightUnit={activityData?.averageHeightUnit}
44
70
  loading={loading}
45
71
  t={t}
46
72
  />
47
73
  </Container>
74
+
75
+ <VegetationHealthContainer>
76
+ <VegetationHealthSection>
77
+ <VegetationHealth
78
+ title={t("Vegetation Health")}
79
+ vegetationHealthChart={activityData?.growthObservations}
80
+ growthObservations={activityData?.growthObservations}
81
+ filterKeys={[
82
+ VEGETATION_KEYS.HEALTHY,
83
+ VEGETATION_KEYS.WHITE_SPOTS,
84
+ VEGETATION_KEYS.BLACK_SPOTS,
85
+ VEGETATION_KEYS.REDDISH_SPOTS,
86
+ VEGETATION_KEYS.YELLOWING,
87
+ VEGETATION_KEYS.MOSAIC,
88
+ VEGETATION_KEYS.DRY_OR_DEAD,
89
+ VEGETATION_KEYS.NO_LEAVES
90
+ ]}
91
+ columnsPerRow={4}
92
+ itemWidth={80}
93
+ itemHeight={80}
94
+ activeVegetationConditions={
95
+ activityData?.vegetationHealthChart
96
+ ?.filter(item =>
97
+ item?.type !== VEGETATION_KEYS.SPIDER_WEBS &&
98
+ item?.type !== VEGETATION_KEYS.DAMAGE_FROM_INSECTS
99
+ )
100
+ ?.map(item => item?.type) || []
101
+ }
102
+ loading={loading}
103
+ t={t}
104
+ />
105
+ </VegetationHealthSection>
106
+
107
+ <VegetationHealth
108
+ title={t("Vegetation Health")}
109
+ growthObservations={activityData?.growthObservations}
110
+ activeVegetationConditions={
111
+ activityData?.vegetationHealthChart
112
+ ?.filter(item =>
113
+ item?.type === VEGETATION_KEYS.SPIDER_WEBS ||
114
+ item?.type === VEGETATION_KEYS.DAMAGE_FROM_INSECTS
115
+ )
116
+ ?.map(item => item?.type) || []
117
+ }
118
+ filterKeys={[VEGETATION_KEYS.SPIDER_WEBS, VEGETATION_KEYS.DAMAGE_FROM_INSECTS]}
119
+ columnsPerRow={1}
120
+ itemWidth={210}
121
+ itemHeight={105}
122
+ loading={loading}
123
+ t={t}
124
+ />
125
+
126
+ </VegetationHealthContainer>
48
127
  </section>
49
128
  </Widget>
50
129
  );