Skip to content

Commit 9a981bc

Browse files
committed
FEATURE: Set an item as a wide shot to be on the building map in priority.
By default, the first item corresponding to a window is placed on the building map. However, items described as `plan: large` ("wide shot" in French) are displayed in priority.
1 parent 4e7b55d commit 9a981bc

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/components/portfolioPage/VisitMap.jsx

+14-11
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ class VisitMap extends Component {
66
render() {
77
let { items } = this.props;
88
let map = items.find(x => /^[A-Z]+$/.test(x.name[0]));
9-
let valid_items = items
10-
.filter(x =>
11-
!!x.thumbnail
12-
&& /^[A-Z]+ \d{3}$/.test(x.name[0])
13-
);
14-
// Get the first item of each window
15-
let window_items = valid_items
16-
.map(x => x.name[0])
17-
.map((x, i, arr) => arr.indexOf(x) === i && i)
18-
.filter(x => x !== false)
19-
.map(x => valid_items[x]);
9+
let window_items = Object.values(
10+
items
11+
.filter(x =>
12+
!!x.thumbnail
13+
&& /^[A-Z]+ \d{3}$/.test(x.name[0])
14+
)
15+
.reduce((result, x) => {
16+
let key = x.name[0];
17+
if (!result[key] || (x.plan && x.plan[0] === 'large')) {
18+
result[key] = x;
19+
}
20+
return result;
21+
}, {})
22+
);
2023
let two_dimensional_locations = window_items.map(x => x.name[0].match(/\d{3}/)[0])
2124
.map(x => ({
2225
elevation: Math.floor(x / 100),

0 commit comments

Comments
 (0)