Skip to content

Commit 61c15b3

Browse files
Merge pull request #1064 from DonovanAndrews300/donovan/property-zone-filtering
Filtering for only main zones
2 parents 7b6c1ab + c76d429 commit 61c15b3

File tree

2 files changed

+36
-41
lines changed

2 files changed

+36
-41
lines changed

src/components/Filters/filterOptions.ts

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -414,39 +414,29 @@ export const rcos: string[] = [
414414
];
415415

416416
export const zoning: string[] = [
417-
'CA-1',
418-
'CA-2',
419-
'CMX-1',
420-
'CMX-2',
421-
'CMX-2.5',
422-
'CMX-3',
423-
'CMX-4',
424-
'CMX-5',
425-
'I-1',
426-
'I-2',
427-
'I-3',
428-
'I-P',
417+
'CA',
418+
'CMX',
419+
'I',
429420
'ICMX',
430421
'IRMX',
431-
'RM-1',
432-
'RM-2',
433-
'RM-3',
434-
'RM-4',
435-
'RMX-1',
436-
'RMX-2',
437-
'RMX-3',
438-
'RSA-1',
439-
'RSA-2',
440-
'RSA-3',
441-
'RSA-4',
442-
'RSA-5',
443-
'RSA-6',
444-
'RSD-1',
445-
'RSD-2',
446-
'RSD-3',
447-
'RTA-1',
448-
'SP-AIR',
449-
'SP-INS',
450-
'SP-PO-A',
451-
'SP-STA',
422+
'RM',
423+
'RMX',
424+
'RSA',
425+
'RSD',
426+
'RTA',
427+
'SP',
452428
];
429+
430+
export const subZoning: Record<string, string[]> = {
431+
CA: ['CA-1', 'CA-2'],
432+
RSD: ['RSD-1', 'RSD-2', 'RSD-3'],
433+
RTA: ['RTA-1'],
434+
RM: ['RM-1', 'RM-2', 'RM-3', 'RM-4'],
435+
RMX: ['RMX-1', 'RMX-2', 'RMX-3'],
436+
CAX: ['CAX'],
437+
CMX: ['CMX-1', 'CMX-2', 'CMX-2.5', 'CMX-3', 'CMX-4', 'CMX-5'],
438+
IRMX: ['IRMX'],
439+
ICMX: ['ICMX'],
440+
I: ['I-1', 'I-2', 'I-3', 'I-P'],
441+
SP: ['SP-AIR', 'SP-INS', 'SP-PO-A', 'SP-STA'],
442+
};

src/components/PropertyMap.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
useStagingTiles,
1515
googleCloudBucketName,
1616
} from '../config/config';
17+
import { subZoning } from './Filters/filterOptions';
1718
import { useFilter } from '@/context/FilterContext';
1819
import Map, {
1920
Source,
@@ -348,14 +349,18 @@ const PropertyMap: FC<PropertyMapProps> = ({
348349
if (filterItem.values.length) {
349350
const thisFilterGroup: any = ['any'];
350351
filterItem.values.forEach((item) => {
351-
if (filterItem.useIndexOfFilter) {
352-
thisFilterGroup.push([
353-
'>=',
354-
['index-of', item, ['get', property]],
355-
0,
356-
]);
357-
} else {
358-
thisFilterGroup.push(['in', ['get', property], item]);
352+
if (Object.keys(subZoning).includes(item)) {
353+
subZoning[item].forEach((subZone: string) => {
354+
if (filterItem) {
355+
thisFilterGroup.push([
356+
'>=',
357+
['index-of', subZone, ['get', property]],
358+
0,
359+
]);
360+
} else {
361+
thisFilterGroup.push(['in', ['get', property], subZone]);
362+
}
363+
});
359364
}
360365
});
361366

0 commit comments

Comments
 (0)