Skip to content

Commit 45c133e

Browse files
committed
Merge remote-tracking branch 'upstream/staging' into unvendor-awkde
2 parents 0e282eb + d3facce commit 45c133e

17 files changed

+603
-835
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ updates:
1818
directory: '/'
1919
schedule:
2020
interval: 'weekly'
21+
ignore:
22+
-depedency-name: 'next'
23+
-dependency-name: 'react'
24+
-dependency-name: 'react-dom'
25+
-dependency-name: 'tailwindcss'
2126
target-branch: 'staging'
2227
commit-message:
2328
prefix: 'deps'

data/pyproject.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
[tool.pylint]
2-
output-format = "colorized,parseable"
3-
4-
[tool.pylint.'MESSAGES CONTROL']
5-
disable = ["all"]
6-
enable = ["duplicate-code"]
7-
81
[tool.vulture]
92
make_whitelist = true
103
# min_confidence = 80

data/src/Pipfile

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,37 @@ name = "pypi"
55

66
[packages]
77
awkde = { git = 'https://github.com/mennthor/awkde.git', ref = '5b601fe4d92229d5deb8737fd121dce193bac552' }
8-
jupyter = "*"
9-
requests = "*"
10-
pandas = "==2.2.2"
8+
esridump = "~=1.13.0"
9+
fiona = "~=1.10.1"
10+
future = "~=1.0.0"
11+
geoalchemy2 = "~=0.16.0"
1112
geopandas = "==1.0.1"
12-
shapely = "*"
13-
matplotlib = "*"
14-
rasterio = "*"
15-
scikit-learn = "*"
16-
mapclassify = "*"
17-
fiona = "*"
18-
esridump = "*"
19-
sqlalchemy = "*"
20-
psycopg2-binary = "*"
21-
mapbox = "*"
22-
google-cloud-storage = "*"
13+
google-cloud-storage = "~=2.19.0"
14+
jenkspy = "~=0.4.1"
15+
jupyter = "~=1.1.1"
16+
libpysal = "~=4.12.1"
17+
mapbox = "~=0.18.1"
18+
mapclassify = "~=2.8.1"
19+
matplotlib = "~=3.9.3"
20+
networkx = "~=3.4.2"
21+
pandas = "==2.2.2"
22+
psycopg2-binary = "~=2.9.10"
23+
pyarrow = "~=18.1.0"
2324
pydantic = "==2.8.2"
24-
future = "*"
25-
slack-sdk = "*"
26-
networkx = "*"
27-
libpysal = "*"
28-
jenkspy = "*"
29-
pyarrow = "*"
30-
tqdm = "*"
31-
geoalchemy2 ="*"
25+
rasterio = "~=1.4.3"
26+
requests = "~=2.32.3"
27+
scikit-learn = "~=1.6.0"
28+
shapely = "~=2.0.6"
29+
slack-sdk = "~=3.33.5"
30+
sqlalchemy = "~=2.0.36"
31+
tqdm = "~=4.67.1"
32+
3233

3334
[dev-packages]
34-
black = "*"
35-
pytest = "*"
36-
vulture = "*"
37-
pylint = "*"
38-
radon = "*"
39-
ruff = "*"
35+
pytest = "~=8.3.4"
36+
vulture = "~=2.14"
37+
radon = "~=6.0.1"
38+
ruff = "~=0.8.2"
4039

4140
[requires]
4241
python_version = "3.11"

data/src/Pipfile.lock

Lines changed: 259 additions & 367 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

package-lock.json

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/FilterView.tsx

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,10 @@ import { PiX } from 'react-icons/pi';
55
import { ThemeButton } from './ThemeButton';
66
import { BarClickOptions } from '@/app/find-properties/[[...opa_id]]/page';
77
import { rcos, neighborhoods, zoning } from './Filters/filterOptions';
8-
import DimensionFilter from './Filters/DimensionFilter';
9-
10-
const filters = [
11-
{
12-
property: 'priority_level',
13-
display: 'Suggested Priority',
14-
options: ['Low', 'Medium', 'High'],
15-
type: 'buttonGroup',
16-
},
17-
{
18-
property: 'get_access',
19-
display: 'Get Access',
20-
options: [
21-
'TACTICAL_URBANISM',
22-
'PRIVATE_LAND_USE',
23-
'BUY_FROM_OWNER',
24-
'SIDE_YARD',
25-
'LAND_BANK',
26-
'CONSERVATORSHIP',
27-
],
28-
type: 'panels',
29-
},
30-
{
31-
property: 'neighborhood',
32-
display: 'Neighborhoods',
33-
options: neighborhoods,
34-
type: 'multiSelect',
35-
},
36-
{
37-
property: 'rco_names',
38-
display: 'Community Organizations',
39-
options: rcos,
40-
type: 'multiSelect',
41-
useIndexOfFilter: true,
42-
},
43-
{
44-
property: 'zoning_base_district',
45-
display: 'Zoning',
46-
options: zoning,
47-
type: 'multiSelect',
48-
},
49-
{
50-
property: 'parcel_type',
51-
display: 'Property Type',
52-
options: ['Land', 'Building'],
53-
type: 'buttonGroup',
54-
},
55-
];
8+
import FilterDescription from './Filters/FilterDescription';
9+
import ButtonGroup from './Filters/ButtonGroup';
10+
import MultiSelect from './Filters/MultiSelect';
11+
import Panels from './Filters/Panels';
5612

5713
interface FilterViewProps {
5814
updateCurrentView: (view: BarClickOptions) => void;
@@ -72,9 +28,62 @@ const FilterView: FC<FilterViewProps> = ({ updateCurrentView }) => {
7228
updateCurrentView('filter');
7329
}}
7430
/>
75-
{filters.map((attr) => (
76-
<DimensionFilter key={attr.property} {...attr} />
77-
))}
31+
<div className="pt-3 pb-6">
32+
<FilterDescription
33+
title="Suggested Priority"
34+
description="Find properties based on how much they can reduce gun violence considering the gun violence, cleanliness, and tree canopy nearby. "
35+
link="/methodology/#priority-method"
36+
/>
37+
<ButtonGroup
38+
property="priority_level"
39+
options={['Low', 'Medium', 'High']}
40+
aria_describedby_label="Suggested Priority"
41+
/>
42+
</div>
43+
<div className="pt-3 pb-6">
44+
<FilterDescription
45+
title="Get Access"
46+
description="Find properties based on what we think the easiest method to get legal access to them is, based on the data available to us."
47+
link="/methodology/#access-method"
48+
/>
49+
<Panels />
50+
</div>
51+
<div className="pt-3 pb-6">
52+
<FilterDescription title="Neighborhoods" />
53+
<MultiSelect
54+
property="neighborhood"
55+
options={neighborhoods}
56+
aria_describedby_label="Neighborhoods"
57+
useIndexOfFilter={false}
58+
/>
59+
</div>
60+
<div className="pt-3 pb-6">
61+
<FilterDescription title="Community Organizations" />
62+
<MultiSelect
63+
property="rco_names"
64+
options={rcos}
65+
aria_describedby_label="Community_Organizations"
66+
useIndexOfFilter={true}
67+
/>
68+
</div>
69+
70+
<div className="pt-3 pb-6">
71+
<FilterDescription title="Zoning" />
72+
<MultiSelect
73+
property="zoning_base_district"
74+
options={zoning}
75+
aria_describedby_label="Zoning"
76+
useIndexOfFilter={false}
77+
/>
78+
</div>
79+
<div className="pt-3 pb-6">
80+
<FilterDescription title="Property Type" />
81+
<ButtonGroup
82+
property="parcel_type"
83+
options={['Land', 'Building']}
84+
aria_describedby_label="Property_Type"
85+
/>
86+
</div>
7887
</div>
7988
);
8089
};

src/components/Filters/ButtonGroup.tsx

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
'use client';
22

3-
import React, { FC } from 'react';
3+
import React, { FC, useState } from 'react';
44
import { Button } from '@nextui-org/react';
55
import { Check } from '@phosphor-icons/react';
6+
import { useFilter } from '@/context/FilterContext';
67

78
type ButtonGroupProps = {
9+
property: string;
810
options: string[];
9-
selectedKeys: string[];
1011
aria_describedby_label?: string;
11-
toggleDimension: (dimension: string) => void;
12-
displayOptions?: { [key: string]: string };
1312
};
1413

15-
const ButtonGroup: FC<ButtonGroupProps> = ({
14+
const ButtonGroup = ({
15+
property,
1616
options,
17-
selectedKeys,
18-
toggleDimension,
1917
aria_describedby_label,
20-
displayOptions = {},
21-
}) => {
18+
}: ButtonGroupProps): JSX.Element => {
19+
const { dispatch, appFilter } = useFilter();
20+
const currentFilterKeys = appFilter[property]?.values || [];
21+
22+
const toggleDimension = (dimension: string) => {
23+
const updatedKeys = currentFilterKeys.includes(dimension)
24+
? currentFilterKeys.filter((item) => item !== dimension)
25+
: [...currentFilterKeys, dimension];
26+
27+
dispatch({
28+
type: 'SET_DIMENSIONS',
29+
property,
30+
dimensions: updatedKeys,
31+
});
32+
};
33+
2234
return (
2335
<div className="flex flex-wrap gap-x-2 min-h-[33.5px]">
2436
{options.map((option, index) => (
@@ -28,23 +40,25 @@ const ButtonGroup: FC<ButtonGroupProps> = ({
2840
role="checkbox"
2941
onPress={() => toggleDimension(option)}
3042
size="sm"
31-
color={selectedKeys.includes(option) ? 'success' : 'default'}
43+
color={currentFilterKeys.includes(option) ? 'success' : 'default'}
3244
className={
33-
(selectedKeys.includes(option) ? 'tagSelected' : 'tagDefault') +
45+
(currentFilterKeys.includes(option)
46+
? 'tagSelected'
47+
: 'tagDefault') +
3448
(option === 'Private Land Use Agreement'
3549
? ' max-[475px]:mt-2 sm:max-[1103px]:mt-2'
3650
: '')
3751
}
3852
radius="full"
39-
aria-checked={selectedKeys.includes(option)}
53+
aria-checked={currentFilterKeys.includes(option)}
4054
aria-describedby={aria_describedby_label}
4155
startContent={
42-
selectedKeys.includes(option) ? (
43-
<Check className="w-3 w-3.5 max-h-6" />
56+
currentFilterKeys.includes(option) ? (
57+
<Check className="w-3 max-h-6" />
4458
) : undefined
4559
}
4660
>
47-
{displayOptions[option] || option}
61+
{option}
4862
</Button>
4963
))}
5064
</div>

0 commit comments

Comments
 (0)