@@ -65,12 +65,16 @@ const ButterflyMap = (props: ButterflyMapProps) => {
65
65
setPaginationPage ( 1 ) ;
66
66
}
67
67
68
- setSortedPointsOfInterest (
69
- newPoints . sort ( ( a : PointOfInterest , b : PointOfInterest ) : number => {
70
- return calculateDistance ( position , a . position ) - calculateDistance ( position , b . position ) ;
71
- } ) ,
72
- ) ;
73
- setClosestPointOfInterest ( newPoints [ 0 ] ) ;
68
+ if ( props . disableCards ) {
69
+ setSortedPointsOfInterest ( newPoints ) ;
70
+ } else {
71
+ setSortedPointsOfInterest (
72
+ newPoints . sort ( ( a : PointOfInterest , b : PointOfInterest ) : number => {
73
+ return calculateDistance ( position , a . position ) - calculateDistance ( position , b . position ) ;
74
+ } ) ,
75
+ ) ;
76
+ setClosestPointOfInterest ( newPoints [ 0 ] ) ;
77
+ }
74
78
} , [ props . pointsOfInterest , position ] ) ;
75
79
76
80
const theme = completeTheme ( reduceMotion , props . theme ) ;
@@ -152,11 +156,12 @@ const ButterflyMap = (props: ButterflyMapProps) => {
152
156
setHideMap = { setHideMap }
153
157
/>
154
158
{ ! hideMap && < MapAndBarContainer >
155
- < MapSidebar data-showing = { sidebarShowing } height = { props . height } >
156
- { closestPointOfInterest && < closestPointOfInterest . SidebarComponent closeSidebar = { ( ) => setSidebarShowing ( false ) }
157
- handlePoiClick = { handlePoiClick }
158
- userPosition = { userPosition } /> }
159
- </ MapSidebar >
159
+ { ! props . disableCards &&
160
+ < MapSidebar data-showing = { sidebarShowing } height = { props . height } >
161
+ { closestPointOfInterest && < closestPointOfInterest . SidebarComponent closeSidebar = { ( ) => setSidebarShowing ( false ) }
162
+ handlePoiClick = { handlePoiClick }
163
+ userPosition = { userPosition } /> }
164
+ </ MapSidebar > }
160
165
< MapContainer >
161
166
< Map mapStyle = { props . tileServer }
162
167
{ ...viewState }
@@ -176,7 +181,7 @@ const ButterflyMap = (props: ButterflyMapProps) => {
176
181
</ CenterMapButton >
177
182
</ MapContainer >
178
183
</ MapAndBarContainer > }
179
- { sortedPointsOfInterest . length > 0 &&
184
+ { ( ! props . disableCards && sortedPointsOfInterest . length > 0 ) &&
180
185
< PointBar userPosition = { userPosition }
181
186
localStrings = { localStrings }
182
187
page = { props . paginationPage ?? paginationPage }
@@ -203,6 +208,7 @@ type ButterflyMapProps = {
203
208
paginationPage ?: number ,
204
209
setPaginationPage ?: React . Dispatch < React . SetStateAction < number > > ,
205
210
totalCount ?: number ,
211
+ disableCards ?: boolean ,
206
212
}
207
213
208
214
export default ButterflyMap ;
0 commit comments