Skip to content

Commit 322c2dc

Browse files
committed
Refactor venue display logic and enhance popup content with venue address link
1 parent 098a27f commit 322c2dc

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

pcd-website/src/components/NodePanel.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ function getOsmUrl(node: Node): string {
6666
return `https://www.openstreetmap.org/search?query=${encodeURIComponent(query)}`;
6767
}
6868
69-
function getVenueText(node: Node): string {
70-
return node.address
71-
? `${node.venue}, ${node.address}`
72-
: `${node.venue}, ${node.city}, ${node.country}`;
73-
}
74-
7569
function getParagraphs(text: string): string[] {
7670
return text.split(/\n\n+/).filter(Boolean);
7771
}
@@ -106,10 +100,9 @@ function getParagraphs(text: string): string[] {
106100

107101
<h2 id="panel-title" class="panel-name">{{ node.name }}</h2>
108102
<p class="panel-meta">{{ formatDateRange(node.start_date, node.end_date) }}</p>
109-
110103
<p class="panel-venue">
111104
<Icon icon="bi:geo-alt-fill" class="panel-icon" width="14" height="14" aria-hidden="true" />
112-
<a :href="getOsmUrl(node)" target="_blank" rel="noopener noreferrer">{{ getVenueText(node) }}</a>
105+
<a :href="getOsmUrl(node)" target="_blank" rel="noopener noreferrer">{{ node.venue }}<br>{{ node.address || `${node.city}, ${node.country}` }}</a>
113106
</p>
114107

115108
<div class="panel-description">
@@ -244,15 +237,14 @@ function getParagraphs(text: string): string[] {
244237
245238
.panel-venue {
246239
display: flex;
247-
align-items: flex-start;
240+
align-items: center;
248241
gap: 0.375rem;
249242
margin: 0 0 1.25rem;
250243
font-size: 0.9375rem;
251244
}
252245
253246
.panel-icon {
254247
flex-shrink: 0;
255-
margin-top: 0.15em;
256248
color: var(--color-text-muted);
257249
}
258250

pcd-website/src/data/nodes.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"plus_code": "8Q7XMP53+22",
3333
"website": "https://pcd.tokyo",
3434
"short_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.",
35+
"long_description": "",
3536
"tags": [],
3637
"organizers": [],
3738
"contact_email": "hello@pcd.tokyo",
@@ -109,6 +110,7 @@
109110
"plus_code": "8FH49RMJ+4X",
110111
"website": "https://example.es/pcd",
111112
"short_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.",
113+
"long_description": "",
112114
"tags": [],
113115
"organizers": [],
114116
"contact_email": "organizer@example.es",

pcd-website/src/lib/popup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ export function makePopupContent(node: Node): string {
2626
? `<div class="popup-unconfirmed">&#8505; This event has not been confirmed yet.${node.forum_url ? ` <a href="${escapeHtml(node.forum_url)}" target="_blank" rel="noopener noreferrer">Follow the forum thread</a> for updates.` : ''}</div>`
2727
: '';
2828

29+
const addressQuery = node.address
30+
? `${node.venue}, ${node.address}`
31+
: `${node.venue}, ${node.city}, ${node.country}`;
32+
const osmUrl = `https://www.openstreetmap.org/search?query=${encodeURIComponent(addressQuery)}`;
33+
const venueHtml = `<p class="popup-venue">at <a href="${osmUrl}" target="_blank" rel="noopener noreferrer" title="${escapeHtml(addressQuery)}">${escapeHtml(node.venue)}</a></p>`;
34+
2935
return `
3036
<div class="popup-content">
3137
${placeholderBanner}
3238
<h3 class="popup-name">${escapeHtml(node.name)}</h3>
3339
<p class="popup-date"><strong>${date}</strong></p>
40+
${venueHtml}
3441
<div class="popup-body">
3542
${descriptionHtml}
3643
<button class="read-more" data-node-id="${escapeHtml(node.id)}">Read more &rarr;</button>

0 commit comments

Comments
 (0)