Add WhatsApp numbers/links
This commit is contained in:
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user