Skip to content

Commit 406042f

Browse files
filtering now only uses main zones
1 parent a1064f4 commit 406042f

File tree

3 files changed

+37
-41
lines changed

3 files changed

+37
-41
lines changed

src/components/Filters/MultiSelect.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const MultiSelect: FC<MultiSelectProps> = ({
3333
<SelectFilter
3434
aria-describedby={aria_describedby_label}
3535
items={options}
36+
searchable
3637
variant="flat"
3738
size="md"
3839
radius="md"

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
@@ -16,6 +16,7 @@ import {
1616
useStagingTiles,
1717
googleCloudBucketName,
1818
} from '../config/config';
19+
import { subZoning } from './Filters/filterOptions';
1920
import { useFilter } from '@/context/FilterContext';
2021
import Map, {
2122
Source,
@@ -396,14 +397,18 @@ const PropertyMap: FC<PropertyMapProps> = ({
396397
if (filterItem.values.length) {
397398
const thisFilterGroup: any = ['any'];
398399
filterItem.values.forEach((item) => {
399-
if (filterItem.useIndexOfFilter) {
400-
thisFilterGroup.push([
401-
'>=',
402-
['index-of', item, ['get', property]],
403-
0,
404-
]);
405-
} else {
406-
thisFilterGroup.push(['in', ['get', property], item]);
400+
if (Object.keys(subZoning).includes(item)) {
401+
subZoning[item].forEach((subZone: string) => {
402+
if (filterItem) {
403+
thisFilterGroup.push([
404+
'>=',
405+
['index-of', subZone, ['get', property]],
406+
0,
407+
]);
408+
} else {
409+
thisFilterGroup.push(['in', ['get', property], subZone]);
410+
}
411+
});
407412
}
408413
});
409414

0 commit comments

Comments
 (0)