From 4c84cae42c788e9ee69dbf6803cc47a97a8fedbb Mon Sep 17 00:00:00 2001 From: Atalya Alon <20992625+atalyaalon@users.noreply.github.com> Date: Sat, 7 Sep 2024 21:41:54 +0300 Subject: [PATCH] Revert "Modify map zoom in search button" --- .env | 2 +- src/components/molecules/Header.tsx | 3 --- src/components/molecules/MapDialog.tsx | 12 ++++-------- src/components/molecules/map/Map.tsx | 11 +++-------- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.env b/.env index c428d67f..f2463eba 100644 --- a/.env +++ b/.env @@ -10,7 +10,7 @@ REACT_APP_AUTH_PROD_URL=https://www.anyway.co.il/ REACT_APP_SHOW_META_TAGS=true # Default zoom -REACT_APP_DEFAULT_MAP_ZOOM=14 +REACT_APP_DEFAULT_MAP_ZOOM=13 # Should demo card be visible REACT_APP_SHOW_DEMO_CARDS=false diff --git a/src/components/molecules/Header.tsx b/src/components/molecules/Header.tsx index 97d3253d..abae928f 100644 --- a/src/components/molecules/Header.tsx +++ b/src/components/molecules/Header.tsx @@ -36,7 +36,6 @@ const Header: FC = () => { const { userStore, settingsStore } = store; const [open, setOpen] = useState(false); - const [zoomLevel] = useState(parseInt(process.env.REACT_APP_DEFAULT_MAP_ZOOM!)); const isUserDetailsRequired: boolean = !userStore.userInfo?.meta.isCompleteRegistration; const roadSegmentLocation = store.gpsLocationData; @@ -114,8 +113,6 @@ const Header: FC = () => { }} onSearch={onLocationSearch} onStreetAndCitySearch={onStreetAndCitySearch} - zoom={zoomLevel} - /> ); diff --git a/src/components/molecules/MapDialog.tsx b/src/components/molecules/MapDialog.tsx index 76a69d1a..7040c94f 100644 --- a/src/components/molecules/MapDialog.tsx +++ b/src/components/molecules/MapDialog.tsx @@ -2,12 +2,11 @@ import { FC, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; import { Box } from '@material-ui/core'; -import { Dialog, Typography } from 'components/atoms'; +import { Dialog , Typography } from 'components/atoms'; import { IPoint } from 'models/Point'; import { useStore } from 'store/storeConfig'; import SearchCityAndStreetScreen from 'components/molecules/SearchCityAndStreetScreen'; import SearchSegmentScreen from 'components/molecules/SearchSegmentScreen'; -import Map from 'components/molecules/map/Map' interface IProps { section?: string; @@ -17,7 +16,6 @@ interface IProps { onLocationChange: (location: IPoint) => void; onSearch: () => void; onStreetAndCitySearch: (street?: string, city?: string) => void; - zoom: number; } const useStyles = makeStyles((theme: Theme) => @@ -66,7 +64,6 @@ const MapDialog: FC = ({ onLocationChange, onSearch, onStreetAndCitySearch, - zoom, }) => { const classes = useStyles(); const { t } = useTranslation(); @@ -78,8 +75,8 @@ const MapDialog: FC = ({ store.fetchCitiesList(); }, [store]); - // the code I deleted should be here... - // SearchCityAndStreetScreen() +// the code I deleted should be here... +// SearchCityAndStreetScreen() return ( @@ -98,10 +95,9 @@ const MapDialog: FC = ({ {t('mapDialog.searchStreetAndCity')} - {searchScreen === 'segment' && } + {searchScreen === 'segment' && } {searchScreen === 'cityAndStreet' && } - ); diff --git a/src/components/molecules/map/Map.tsx b/src/components/molecules/map/Map.tsx index 08b41235..30fa742f 100644 --- a/src/components/molecules/map/Map.tsx +++ b/src/components/molecules/map/Map.tsx @@ -1,7 +1,7 @@ import { FC } from 'react'; import { makeStyles } from '@material-ui/core/styles'; -import { MapContainer, TileLayer } from 'react-leaflet'; +import { MapContainer } from 'react-leaflet'; import L, { LatLng } from 'leaflet'; import { IPoint } from 'models/Point'; import { INITIAL_CENTER, INITIAL_ZOOM } from 'const/generalConst'; @@ -34,16 +34,11 @@ interface IProps { const Map: FC = ({ zoom = INITIAL_ZOOM, center = INITIAL_CENTER, data, children }) => { const classes = useStyles(); - - const bounds = data && getBounds(data); - + const bounds = getBounds(data); return ( - - {bounds && } + {children}