Skip to content

Commit

Permalink
Merge pull request #1073 from CodeForPhilly/revert-1064-donovan/prope…
Browse files Browse the repository at this point in the history
…rty-zone-filtering

Revert "Filtering for only main zones"
  • Loading branch information
CodeWritingCow authored Jan 10, 2025
2 parents 61c15b3 + a36ae02 commit a5876ef
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 36 deletions.
56 changes: 33 additions & 23 deletions src/components/Filters/filterOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,29 +414,39 @@ export const rcos: string[] = [
];

export const zoning: string[] = [
'CA',
'CMX',
'I',
'CA-1',
'CA-2',
'CMX-1',
'CMX-2',
'CMX-2.5',
'CMX-3',
'CMX-4',
'CMX-5',
'I-1',
'I-2',
'I-3',
'I-P',
'ICMX',
'IRMX',
'RM',
'RMX',
'RSA',
'RSD',
'RTA',
'SP',
'RM-1',
'RM-2',
'RM-3',
'RM-4',
'RMX-1',
'RMX-2',
'RMX-3',
'RSA-1',
'RSA-2',
'RSA-3',
'RSA-4',
'RSA-5',
'RSA-6',
'RSD-1',
'RSD-2',
'RSD-3',
'RTA-1',
'SP-AIR',
'SP-INS',
'SP-PO-A',
'SP-STA',
];

export const subZoning: Record<string, string[]> = {
CA: ['CA-1', 'CA-2'],
RSD: ['RSD-1', 'RSD-2', 'RSD-3'],
RTA: ['RTA-1'],
RM: ['RM-1', 'RM-2', 'RM-3', 'RM-4'],
RMX: ['RMX-1', 'RMX-2', 'RMX-3'],
CAX: ['CAX'],
CMX: ['CMX-1', 'CMX-2', 'CMX-2.5', 'CMX-3', 'CMX-4', 'CMX-5'],
IRMX: ['IRMX'],
ICMX: ['ICMX'],
I: ['I-1', 'I-2', 'I-3', 'I-P'],
SP: ['SP-AIR', 'SP-INS', 'SP-PO-A', 'SP-STA'],
};
21 changes: 8 additions & 13 deletions src/components/PropertyMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
useStagingTiles,
googleCloudBucketName,
} from '../config/config';
import { subZoning } from './Filters/filterOptions';
import { useFilter } from '@/context/FilterContext';
import Map, {
Source,
Expand Down Expand Up @@ -349,18 +348,14 @@ const PropertyMap: FC<PropertyMapProps> = ({
if (filterItem.values.length) {
const thisFilterGroup: any = ['any'];
filterItem.values.forEach((item) => {
if (Object.keys(subZoning).includes(item)) {
subZoning[item].forEach((subZone: string) => {
if (filterItem) {
thisFilterGroup.push([
'>=',
['index-of', subZone, ['get', property]],
0,
]);
} else {
thisFilterGroup.push(['in', ['get', property], subZone]);
}
});
if (filterItem.useIndexOfFilter) {
thisFilterGroup.push([
'>=',
['index-of', item, ['get', property]],
0,
]);
} else {
thisFilterGroup.push(['in', ['get', property], item]);
}
});

Expand Down

0 comments on commit a5876ef

Please sign in to comment.