diff --git a/src/Components/Map/Subcomponents/Controls/Control.tsx b/src/Components/Map/Subcomponents/Controls/Control.tsx index 63ab78b8..4adf3005 100644 --- a/src/Components/Map/Subcomponents/Controls/Control.tsx +++ b/src/Components/Map/Subcomponents/Controls/Control.tsx @@ -3,7 +3,7 @@ import * as React from 'react' -export const Control = ({ position, children }: { position: "topLeft" | "topRight" | "bottomLeft" | "bottomRight", children: React.ReactNode }) => { +export const Control = ({ position, children, zIndex }: { position: "topLeft" | "topRight" | "bottomLeft" | "bottomRight", children: React.ReactNode, zIndex: string }) => { const controlContainerRef = React.createRef() @@ -17,7 +17,7 @@ export const Control = ({ position, children }: { position: "topLeft" | "topRigh }, [controlContainerRef]) return ( -
+
{children}
diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx index 93a8ed5f..060631d1 100644 --- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx @@ -58,19 +58,21 @@ export const SearchControl = ({ clusterRef }) => { return (<> {!(windowDimensions.height < 500) &&
- setValue(e.target.value)} onFocus={() => setHideSuggestions(false)} onBlur={async () => { setTimeout(() => { setHideSuggestions(true); + window.history.pushState({}, "", `/`) }, 200); }} /> + {value.length > 0 && } {hideSuggestions || Array.from(geoResults).length == 0 && itemsResults.length == 0 && tagsResults.length == 0 || value.length == 0 ? "" : -
+
{tagsResults.length > 0 && -
+
{tagsResults.map(tag => (
{ addFilterTag(tag) @@ -81,8 +83,8 @@ export const SearchControl = ({ clusterRef }) => {
} - {itemsResults.length > 0 && tagsResults.length > 0 &&
} - {itemsResults.slice(0, 10).map(item => ( + {itemsResults.length > 0 && tagsResults.length > 0 &&
} + {itemsResults.slice(0, 5).map(item => (
{ const marker = Object.entries(leafletRefs).find(r => r[1].item == item)?.[1].marker; @@ -96,19 +98,34 @@ export const SearchControl = ({ clusterRef }) => { }); } } - }>{item.name}
- ))} - {Array.from(geoResults).length > 0 && (itemsResults.length > 0 || tagsResults.length > 0) &&
} - {Array.from(geoResults).map((geo) => ( -
{ - searchInput.current?.blur(); - if (geo.properties.extent) map.fitBounds(new LatLngBounds(new LatLng(geo.properties.extent[1], geo.properties.extent[0]), new LatLng(geo.properties.extent[3], geo.properties.extent[2]))); - else map.setView(new LatLng(geo.geometry.coordinates[1], geo.geometry.coordinates[0]), 15, { duration: 1 }) - }}> - {geo?.properties.name} + }>
+ +
+
{item.name}
+
{item.text}
+
+
))} + {Array.from(geoResults).length > 0 && (itemsResults.length > 0 || tagsResults.length > 0) &&
} + {Array.from(geoResults).map((geo) => ( +
+ + + + +
{ + searchInput.current?.blur(); + if (geo.properties.extent) map.fitBounds(new LatLngBounds(new LatLng(geo.properties.extent[1], geo.properties.extent[0]), new LatLng(geo.properties.extent[3], geo.properties.extent[2]))); + else map.setView(new LatLng(geo.geometry.coordinates[1], geo.geometry.coordinates[0]), 15, { duration: 1 }) + }}> +
{geo?.properties.name ? geo?.properties.name : value}
+
{geo?.properties?.city && `${capitalizeFirstLetter(geo?.properties?.city)}, `} {geo?.properties?.osm_value && geo?.properties?.osm_value !== "primary" && geo?.properties?.osm_value !== "path" && geo?.properties?.osm_value !== "secondary" && geo?.properties?.osm_value !== "residential" && geo?.properties?.osm_value !== "unclassified" && `${capitalizeFirstLetter(geo?.properties?.osm_value)}, `} {geo.properties.state && `${geo.properties.state}, `} {geo.properties.country && geo.properties.country}
+
+
+ + ))}
}
} diff --git a/src/Components/Map/UtopiaMap.css b/src/Components/Map/UtopiaMap.css index b0669a73..e071945e 100644 --- a/src/Components/Map/UtopiaMap.css +++ b/src/Components/Map/UtopiaMap.css @@ -1,5 +1,9 @@ .leaflet-container { text-align: left; + background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' stroke='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.spinner_V8m1%7Btransform-origin:center;animation:spinner_zKoa 2s linear infinite%7D.spinner_V8m1 circle%7Bstroke-linecap:round;animation:spinner_YpZS 1.5s ease-out infinite%7D%40keyframes spinner_zKoa%7B100%25%7Btransform:rotate(360deg)%7D%7D%40keyframes spinner_YpZS%7B0%25%7Bstroke-dasharray:0 150;stroke-dashoffset:0%7D47.5%25%7Bstroke-dasharray:42 150;stroke-dashoffset:-16%7D95%25%2C100%25%7Bstroke-dasharray:42 150;stroke-dashoffset:-59%7D%7D%3C%2Fstyle%3E%3Cg class='spinner_V8m1'%3E%3Ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3'%3E%3C%2Fcircle%3E%3C%2Fg%3E%3C%2Fsvg%3E"); + background-repeat: no-repeat; + background-attachment: fixed; + background-position: 50% 80%; } diff --git a/src/Components/Map/UtopiaMap.tsx b/src/Components/Map/UtopiaMap.tsx index 3cb121d9..4e28abb5 100644 --- a/src/Components/Map/UtopiaMap.tsx +++ b/src/Components/Map/UtopiaMap.tsx @@ -70,6 +70,7 @@ function UtopiaMap({ return ( <> + @@ -78,11 +79,11 @@ function UtopiaMap({
- - - + + + - + @@ -116,7 +117,6 @@ function UtopiaMap({ - ); }