Skip to content

Commit 8cd1058

Browse files
committed
feat(293): sort features by priority of high, medium, low
1 parent 9180fbd commit 8cd1058

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/app/components/PropertyMap.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,23 @@ const PropertyMap: FC<PropertyMapProps> = ({
153153

154154
setFeatureCount(features.length);
155155

156+
const priorities: { [key: string]: number } = {
157+
High: 1,
158+
Medium: 2,
159+
Low: 3,
160+
};
161+
162+
const sortedFeatures = features
163+
.sort((a, b) => {
164+
return (
165+
priorities[a?.properties?.priority_level || ""] -
166+
priorities[b?.properties?.priority_level || ""]
167+
);
168+
})
169+
.slice(0, 100);
170+
156171
// only set the first 100 properties in state
157-
setFeaturesInView(features.slice(0, 100));
172+
setFeaturesInView(sortedFeatures);
158173
setLoading(false);
159174
};
160175

0 commit comments

Comments
 (0)