diff --git a/app/components/place-details.gjs b/app/components/place-details.gjs
index bbffd6b..727fcd7 100644
--- a/app/components/place-details.gjs
+++ b/app/components/place-details.gjs
@@ -1,6 +1,7 @@
import Component from '@glimmer/component';
import { fn } from '@ember/helper';
import { on } from '@ember/modifier';
+import { htmlSafe } from '@ember/template';
import { humanizeOsmTag } from '../utils/format-text';
import { getLocalizedName, getPlaceType } from '../utils/osm';
import Icon from '../components/icon';
@@ -95,21 +96,55 @@ export default class PlaceDetails extends Component {
return parts.join(', ');
}
+ formatMultiLine(val, type) {
+ if (!val) return null;
+ const parts = val.split(';').map((s) => s.trim()).filter(Boolean);
+ if (parts.length === 0) return null;
+
+ if (type === 'phone') {
+ return htmlSafe(
+ parts.map((p) => `${p}`).join('
')
+ );
+ }
+
+ if (type === 'url') {
+ return htmlSafe(
+ parts
+ .map(
+ (url) =>
+ `${this.getDomain(
+ url
+ )}`
+ )
+ .join('
')
+ );
+ }
+
+ return htmlSafe(parts.join('
'));
+ }
+
get phone() {
- return this.tags.phone || this.tags['contact:phone'];
+ const val = this.tags.phone || this.tags['contact:phone'];
+ return this.formatMultiLine(val, 'phone');
}
get website() {
- return this.place.url || this.tags.website || this.tags['contact:website'];
+ const val = this.place.url || this.tags.website || this.tags['contact:website'];
+ return this.formatMultiLine(val, 'url');
}
- get websiteDomain() {
- const url = new URL(this.website);
- return url.hostname;
+ getDomain(urlStr) {
+ try {
+ const url = new URL(urlStr);
+ return url.hostname;
+ } catch {
+ return urlStr;
+ }
}
get openingHours() {
- return this.tags.opening_hours;
+ const val = this.tags.opening_hours;
+ return this.formatMultiLine(val);
}
get cuisine() {
@@ -121,7 +156,9 @@ export default class PlaceDetails extends Component {
}
get wikipedia() {
- return this.tags.wikipedia;
+ const val = this.tags.wikipedia;
+ if (!val) return null;
+ return val.split(';').map((s) => s.trim()).filter(Boolean)[0];
}
get geoLink() {
@@ -215,7 +252,7 @@ export default class PlaceDetails extends Component {