Add WhatsApp numbers/links
Some checks failed
CI / Lint (pull_request) Failing after 32s
CI / Test (pull_request) Successful in 47s

This commit is contained in:
2026-04-12 16:06:02 +04:00
parent ad3e6ea402
commit 344a3067fa
4 changed files with 71 additions and 2 deletions

View File

@@ -155,6 +155,15 @@ export default class PlaceDetails extends Component {
);
}
if (type === 'whatsapp') {
return htmlSafe(
parts.map((p) => {
const safeTel = p.replace(/[\s-]+/g, '');
return `<a href="https://wa.me/${safeTel}" target="_blank" rel="noopener noreferrer">${p}</a>`;
}).join('<br>')
);
}
if (type === 'url') {
return htmlSafe(
parts
@@ -184,6 +193,17 @@ export default class PlaceDetails extends Component {
return this.formatMultiLine(rawValues.join(';'), 'phone');
}
get whatsapp() {
const rawValues = [
this.tags.whatsapp,
this.tags['contact:whatsapp'],
].filter(Boolean);
if (rawValues.length === 0) return null;
return this.formatMultiLine(rawValues.join(';'), 'whatsapp');
}
get email() {
const val = this.tags.email || this.tags['contact:email'];
return this.formatMultiLine(val, 'email');
@@ -358,6 +378,15 @@ export default class PlaceDetails extends Component {
</p>
{{/if}}
{{#if this.whatsapp}}
<p class="content-with-icon">
<Icon @name="whatsapp" @title="WhatsApp" />
<span>
{{this.whatsapp}}
</span>
</p>
{{/if}}
{{#if this.website}}
<p class="content-with-icon">
<Icon @name="globe" @title="Website" />