@@ -241,7 +241,7 @@ const PropertyMap: FC<PropertyMapProps> = ({
241241
242242 const features = map . queryRenderedFeatures ( bbox , { layers } ) ;
243243
244- //Get count of features if they are clustered
244+ // Get count of features if they are clustered
245245 const clusteredFeatureCount = features . reduce (
246246 ( acc : number , feature : MapGeoJSONFeature ) => {
247247 if ( feature . properties ?. clustered ) {
@@ -361,14 +361,20 @@ const PropertyMap: FC<PropertyMapProps> = ({
361361 const updateFilter = ( ) => {
362362 if ( ! map ) return ;
363363
364+ // If no filters are applied (appFilter is empty), show all properties
365+ if ( Object . keys ( appFilter ) . length === 0 ) {
366+ map . setFilter ( 'vacant_properties_tiles_points' , null ) ;
367+ map . setFilter ( 'vacant_properties_tiles_polygons' , null ) ;
368+ return ;
369+ }
370+
364371 const isAnyFilterEmpty = Object . values ( appFilter ) . some ( ( filterItem ) => {
365372 return filterItem . values . length === 0 ;
366373 } ) ;
367374
368375 if ( isAnyFilterEmpty ) {
369376 map . setFilter ( 'vacant_properties_tiles_points' , [ '==' , [ 'id' ] , '' ] ) ;
370377 map . setFilter ( 'vacant_properties_tiles_polygons' , [ '==' , [ 'id' ] , '' ] ) ;
371-
372378 return ;
373379 }
374380
@@ -384,7 +390,24 @@ const PropertyMap: FC<PropertyMapProps> = ({
384390 0 ,
385391 ] ) ;
386392 } else {
387- thisFilterGroup . push ( [ 'in' , [ 'get' , property ] , item ] ) ;
393+ // Handle Boolean fields that might be mixed format
394+ if (
395+ [
396+ 'tactical_urbanism' ,
397+ 'conservatorship' ,
398+ 'side_yard_eligible' ,
399+ ] . includes ( property )
400+ ) {
401+ // For Boolean fields, check Boolean true, string 'Yes', and string 'True'
402+ thisFilterGroup . push ( [
403+ 'any' ,
404+ [ '==' , [ 'get' , property ] , true ] ,
405+ [ '==' , [ 'get' , property ] , 'Yes' ] ,
406+ [ '==' , [ 'get' , property ] , 'True' ] ,
407+ ] ) ;
408+ } else {
409+ thisFilterGroup . push ( [ 'in' , [ 'get' , property ] , item ] ) ;
410+ }
388411 }
389412 if ( Object . keys ( subZoning ) . includes ( item ) ) {
390413 subZoning [ item ] . forEach ( ( subZone : string ) => {
@@ -408,8 +431,49 @@ const PropertyMap: FC<PropertyMapProps> = ({
408431 [ ] as any [ ]
409432 ) ;
410433
411- map . setFilter ( 'vacant_properties_tiles_points' , [ 'all' , ...mapFilter ] ) ;
412- map . setFilter ( 'vacant_properties_tiles_polygons' , [ 'all' , ...mapFilter ] ) ;
434+ // Check if we have access-related filters
435+ const accessProperties = [
436+ 'tactical_urbanism' ,
437+ 'conservatorship' ,
438+ 'side_yard_eligible' ,
439+ 'access_process' ,
440+ ] ;
441+ const hasAccessFilters = Object . keys ( appFilter ) . some (
442+ ( property ) =>
443+ accessProperties . includes ( property ) &&
444+ appFilter [ property ] . values . length > 0
445+ ) ;
446+
447+ let finalFilter : any ;
448+ if ( hasAccessFilters && mapFilter . length > 1 ) {
449+ // If we have access filters and other filters, use OR for access filters
450+ const accessFilterIndices = Object . keys ( appFilter )
451+ . map ( ( property , index ) => ( { property, index } ) )
452+ . filter (
453+ ( { property } ) =>
454+ accessProperties . includes ( property ) &&
455+ appFilter [ property ] . values . length > 0
456+ )
457+ . map ( ( { index } ) => index ) ;
458+
459+ const accessFilters = accessFilterIndices . map ( ( i ) => mapFilter [ i ] ) ;
460+ const otherFilters = mapFilter . filter (
461+ ( _ , i ) => ! accessFilterIndices . includes ( i )
462+ ) ;
463+
464+ if ( otherFilters . length > 0 ) {
465+ finalFilter = [ 'all' , [ 'any' , ...accessFilters ] , ...otherFilters ] ;
466+ } else {
467+ finalFilter = [ 'any' , ...accessFilters ] ;
468+ }
469+ } else {
470+ // Use original logic for all other cases
471+ finalFilter =
472+ mapFilter . length > 0 ? [ 'all' , ...mapFilter ] : [ '==' , [ 'id' ] , '' ] ;
473+ }
474+
475+ map . setFilter ( 'vacant_properties_tiles_points' , finalFilter ) ;
476+ map . setFilter ( 'vacant_properties_tiles_polygons' , finalFilter ) ;
413477 } ;
414478
415479 if ( map ) {
@@ -528,7 +592,10 @@ const PropertyMap: FC<PropertyMapProps> = ({
528592 onClose = { handlePopupClose }
529593 >
530594 < div className = "flex flex-row items-center nowrap space-x-1" >
531- < span > { toTitleCase ( popupInfo . feature . address ) } </ span >
595+ < span >
596+ { toTitleCase ( popupInfo . feature . standardized_street_address ) ??
597+ 'Address not available' }
598+ </ span >
532599 { /* keeping invisible to maintain spacing for built-in close button */ }
533600 < X size = { 16 } className = "invisible" />
534601 </ div >
0 commit comments