Skip to content

Commit 7a6dc7c

Browse files
committed
list names above live map
1 parent 0b7498e commit 7a6dc7c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

_includes/livemap.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
const width = 640;
1515
const height = 400;
1616

17+
const prettyJoin = (strings) => {
18+
if (strings.length < 1) return strings;
19+
const last = strings.pop();
20+
return `${strings.join(", ")} and ${last}`;
21+
};
22+
1723
// create a new svg for d3.js to draw on
1824
const svg = d3.create("svg").attr("width", width).attr("height", height);
1925
container.append(svg.node());
@@ -41,7 +47,7 @@
4147
.filter((name) => name !== null);
4248

4349
// update map text
44-
text.innerText = `${pointData.features.length} hackers online!`;
50+
text.innerText = `${pointData.features.length} hackers online: ${prettyJoin(nameList)}`;
4551

4652
// get the bounds of locations (min & max coordinates)
4753
const bounds = d3.geoBounds(pointData);

0 commit comments

Comments
 (0)