From e9b60df7a8f56354f8d97134fd050b7abc9f534e Mon Sep 17 00:00:00 2001 From: wadhawh <130486914+wadhawh@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:24:11 +0530 Subject: [PATCH] resolved locate me icon issue when unauth simulation is exited and route box border issue (#277) Co-authored-by: Ahmad Azizi <91204996+its-aazizi@users.noreply.github.com> --- .../ResponsiveBottomSheet.tsx | 16 ++++++---- src/atomicui/organisms/RouteBox/RouteBox.tsx | 29 ++++++++++++++----- src/atomicui/pages/DemoPage/DemoPage.tsx | 5 +--- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/atomicui/organisms/ResponsiveBottomSheet/ResponsiveBottomSheet.tsx b/src/atomicui/organisms/ResponsiveBottomSheet/ResponsiveBottomSheet.tsx index 826eb94f..9603ccca 100644 --- a/src/atomicui/organisms/ResponsiveBottomSheet/ResponsiveBottomSheet.tsx +++ b/src/atomicui/organisms/ResponsiveBottomSheet/ResponsiveBottomSheet.tsx @@ -84,6 +84,7 @@ interface IProps { isExpandRouteOptionsMobile: boolean; setExpandRouteOptionsMobile: (b: boolean) => void; setSearchBoxValue: Dispatch>; + setShowUnauthSimulationBounds: (b: boolean) => void; } const ResponsiveBottomSheet: FC = ({ @@ -124,7 +125,8 @@ const ResponsiveBottomSheet: FC = ({ setShowRouteBox, isExpandRouteOptionsMobile, setExpandRouteOptionsMobile, - setSearchBoxValue + setSearchBoxValue, + setShowUnauthSimulationBounds }) => { const { isDesktop, isMobile, isTablet, isMax556, isDesktopBrowser } = useDeviceMediaQuery(); const { unauthNotifications, isAddingGeofence } = useGeofence(); @@ -542,17 +544,21 @@ const ResponsiveBottomSheet: FC = ({ const footerHeight = useCallback((maxHeight: number) => calculatePixelValue(maxHeight, 50), [calculatePixelValue]); const onCloseHandler = useCallback(() => { + setShowUnauthSimulationBounds(false); setShowStartUnauthSimulation(false); from === MenuItemEnum.GEOFENCE ? setShowUnauthGeofenceBox(false) : setShowUnauthTrackerBox(false); setConfirmCloseSimulation(false); resetToExplore(); + geolocateControlRef.current?.trigger(); }, [ - from, - resetToExplore, - setConfirmCloseSimulation, + setShowUnauthSimulationBounds, setShowStartUnauthSimulation, + from, setShowUnauthGeofenceBox, - setShowUnauthTrackerBox + setShowUnauthTrackerBox, + setConfirmCloseSimulation, + resetToExplore, + geolocateControlRef ]); const ExitSimulation = () => ( diff --git a/src/atomicui/organisms/RouteBox/RouteBox.tsx b/src/atomicui/organisms/RouteBox/RouteBox.tsx index 124f305a..c6306274 100644 --- a/src/atomicui/organisms/RouteBox/RouteBox.tsx +++ b/src/atomicui/organisms/RouteBox/RouteBox.tsx @@ -356,9 +356,8 @@ const RouteBox: FC = ({ const handleSearch = useCallback( async (value: string, exact = false, type: InputType, action: string, isQueryId = false) => { - setIsSearching(true); - if (value.length >= 3) { + setIsSearching(true); const { lng: longitude, lat: latitude } = mapRef.current?.getCenter() as LngLat; if (timeoutIdRef.current) { @@ -380,9 +379,9 @@ const RouteBox: FC = ({ false, isQueryId ); + setIsSearching(false); }, 200); } - setIsSearching(false); }, [mapRef, search, suggestions] ); @@ -549,7 +548,11 @@ const RouteBox: FC = ({ () => ( = ({ {expandRouteOptions && } ), - [inputFocused.from, inputFocused.to, routeData, expandRouteOptions, onClickRouteOptions, t, MoreOptionsUI] + [ + inputFocused, + isCurrentLocationSelected, + suggestions.from?.length, + suggestions.to?.length, + isSearching, + routeData, + expandRouteOptions, + onClickRouteOptions, + t, + MoreOptionsUI + ] ); const onSelectCurrentLocation = (type: InputType) => { @@ -1057,17 +1071,16 @@ const RouteBox: FC = ({ {t("route_box__current_location.text")} )} - {!!suggestions.from?.length ? renderSuggestions(suggestions.from, InputType.FROM) - : !isSearching && + : isSearching && value.from?.length > 2 && value.from !== t("route_box__my_location.text") && !placeData.from && inputFocused.from && } {!!suggestions.to?.length ? renderSuggestions(suggestions.to, InputType.TO) - : !isSearching && + : isSearching && value.to?.length > 2 && value.to !== t("route_box__my_location.text") && !placeData.to && diff --git a/src/atomicui/pages/DemoPage/DemoPage.tsx b/src/atomicui/pages/DemoPage/DemoPage.tsx index abdf8537..1a1e6bce 100644 --- a/src/atomicui/pages/DemoPage/DemoPage.tsx +++ b/src/atomicui/pages/DemoPage/DemoPage.tsx @@ -537,6 +537,7 @@ const DemoPage: FC = () => { setSearchBoxValue={setSearchBoxValue} onOpenFeedbackModal={() => setShow(s => ({ ...s, openFeedbackModal: true }))} geolocateControlRef={geolocateControlRef} + setShowUnauthSimulationBounds={b => setShow(s => ({ ...s, unauthSimulationBounds: b }))} /> )} {isDesktop && ( @@ -621,10 +622,6 @@ const DemoPage: FC = () => { unauthGeofenceBox: false, unauthTrackerBox: false })); - // setTimeout(() => { - // handleGrabMapChange(tempMapStyle as GrabMapEnum); - // window.location.reload(); - // }, 0); }} cancelationText={t("start_unauth_simulation__stay_in_simulation.text")} />