From 4ca87e730c3e24b166bbbf7f636feee5215adbbc Mon Sep 17 00:00:00 2001 From: Mononaut Date: Sat, 27 Aug 2022 19:02:22 +0000 Subject: [PATCH] Fix unfurls for lightning pages with no geodata --- .../channel/channel-preview.component.html | 2 +- .../lightning/node/node-preview.component.html | 2 +- .../nodes-channels-map.component.ts | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/lightning/channel/channel-preview.component.html b/frontend/src/app/lightning/channel/channel-preview.component.html index c98929931..a847975c2 100644 --- a/frontend/src/app/lightning/channel/channel-preview.component.html +++ b/frontend/src/app/lightning/channel/channel-preview.component.html @@ -58,7 +58,7 @@
- +
diff --git a/frontend/src/app/lightning/node/node-preview.component.html b/frontend/src/app/lightning/node/node-preview.component.html index 0bb7255a6..a94882161 100644 --- a/frontend/src/app/lightning/node/node-preview.component.html +++ b/frontend/src/app/lightning/node/node-preview.component.html @@ -52,7 +52,7 @@
- +
diff --git a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts index 91de48186..c6a2f8f5c 100644 --- a/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts +++ b/frontend/src/app/lightning/nodes-channels-map/nodes-channels-map.component.ts @@ -22,6 +22,7 @@ export class NodesChannelsMap implements OnInit { @Input() channel: any[] = []; @Input() fitContainer = false; @Input() hasLocation = true; + @Input() placeholder = false; @Output() readyEvent = new EventEmitter(); channelsObservable: Observable; @@ -201,11 +202,26 @@ export class NodesChannelsMap implements OnInit { prepareChartOptions(nodes, channels) { let title: object; - if (channels.length === 0) { + if (channels.length === 0 && !this.placeholder) { this.chartOptions = null; return; } + // empty map fallback + if (channels.length === 0 && this.placeholder) { + title = { + textStyle: { + color: 'white', + fontSize: 18 + }, + text: $localize`No geolocation data available`, + left: 'center', + top: 'center' + }; + this.zoom = 1.5; + this.center = [0, 20]; + } + this.chartOptions = { silent: this.style === 'widget', title: title ?? undefined,