Skip to content

Commit 97c4577

Browse files
authored
Merge pull request #16 from CIAT-DAPA/develop
Develop
2 parents e1e5897 + e60a60c commit 97c4577

File tree

8 files changed

+48
-13
lines changed

8 files changed

+48
-13
lines changed

src/src/assets/icons/black.png

108 KB
Loading

src/src/assets/icons/cenchrus.png

4.7 KB
Loading

src/src/assets/icons/cucurbita.png

95.3 KB
Loading

src/src/assets/icons/eleusine.png

5.53 KB
Loading
File renamed without changes.
File renamed without changes.

src/src/components/filterLeft/config.json

+26-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,35 @@
66
"Uganda"
77
],
88
"PROJECT_CROPS": {
9-
"bolder": ["Amaranth (Red)",
9+
"bolder": [
10+
"Amaranth caudatus",
11+
"Amaranth dubius",
12+
"Amaranth hypochondriacus",
13+
"Amaranth (Red)",
1014
"Bambara groundnut",
15+
"Baobab",
16+
"Black Fonio",
17+
"Cenchrus caudatus (CWR)",
18+
"Cenchrus mezianus (CWR)",
19+
"Cenchrus procerus (CWR)",
20+
"Cenchrus ramosus (CWR)",
21+
"Cenchrus unisetus (CWR)",
22+
"Cucurbita moschata",
23+
"Cucurbita pepo",
24+
"Cowpea",
25+
"Eleusine indica (CWR)",
26+
"Finger millet",
27+
"Jackfruit",
28+
"Jutemallow",
29+
"Moringa oleifera",
30+
"Pearl millet",
1131
"Pumpkin",
32+
"Sesame",
33+
"Sweetberry",
34+
"Sweetpotato",
35+
"Turkeyberry",
1236
"White Fonio"
13-
14-
],
37+
],
1538
"lga": [
1639
"Maize (Africa)",
1740
"Banana",

src/src/components/map/Map.js

+22-10
Original file line numberDiff line numberDiff line change
@@ -390,18 +390,30 @@ function Map({
390390

391391

392392
const mapRef = useRef(null);
393-
useEffect(() => {
394-
if (accessions.length > 0) {
395-
const latLngs = accessions.map((coordenada) => [
396-
coordenada.latitude,
397-
coordenada.longitude + 5,
398-
]);
399-
const bounds = L.latLngBounds(latLngs);
400-
if (mapRef.current) {
393+
394+
useEffect(() => {
395+
if (accessions.length > 0) {
396+
const latLngs = accessions.map((coordenada) => [
397+
coordenada.latitude,
398+
coordenada.longitude + 5,
399+
]);
400+
401+
if (mapRef.current) {
402+
if (latLngs.length === 1) {
403+
404+
const singlePoint = [
405+
accessions[0].latitude,
406+
accessions[0].longitude,
407+
];
408+
mapRef.current.setView(singlePoint, 6);
409+
} else {
410+
411+
const bounds = L.latLngBounds(latLngs);
401412
mapRef.current.flyToBounds(bounds, { padding: [250, 250] });
402413
}
403414
}
404-
}, [accessions]);
415+
}
416+
}, [accessions]);
405417

406418
useEffect(() => {
407419
if (accesionsInput?.length > 0) {
@@ -577,7 +589,7 @@ function Map({
577589
<LayersControl.BaseLayer name="Satellite">
578590
<TileLayer url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}" />
579591
</LayersControl.BaseLayer>
580-
{accessions.length > 1 && (
592+
{accessions.length > 0 && (
581593
<>
582594
<LayersControl.Overlay name="Accessions" checked={true}>
583595
<TileLayer

0 commit comments

Comments
 (0)