Add lightning node link previews

This commit is contained in:
Mononaut
2022-08-11 17:19:12 +00:00
parent 9881f9d748
commit f7e93a950e
15 changed files with 322 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
<div [class]="'full-container ' + style">
<div [class]="'full-container ' + style + (fitContainer ? ' fit-container' : '')">
<div *ngIf="style === 'graph'" class="card-header">
<div class="d-flex d-md-block align-items-baseline" style="margin-bottom: -5px">
@@ -8,7 +8,7 @@
</div>
<div *ngIf="observable$ | async" class="chart" echarts [initOpts]="chartInitOptions" [options]="chartOptions"
(chartInit)="onChartInit($event)">
(chartInit)="onChartInit($event)" (chartFinished)="onChartFinished($event)">
</div>
</div>

View File

@@ -29,6 +29,18 @@
min-height: 250px;
}
.full-container.fit-container {
margin: 0;
padding: 0;
height: 100%;
min-height: 100px;
.chart {
padding: 0;
min-height: 100px;
}
}
.widget {
width: 90vw;
margin-left: auto;

View File

@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, HostListener, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ChangeDetectionStrategy, Component, HostListener, Input, Output, EventEmitter, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { SeoService } from 'src/app/services/seo.service';
import { ApiService } from 'src/app/services/api.service';
import { Observable, switchMap, tap, zip } from 'rxjs';
@@ -20,9 +20,11 @@ export class NodesChannelsMap implements OnInit, OnDestroy {
@Input() style: 'graph' | 'nodepage' | 'widget' | 'channelpage' = 'graph';
@Input() publicKey: string | undefined;
@Input() channel: any[] = [];
@Input() fitContainer = false;
@Output() readyEvent = new EventEmitter();
observable$: Observable<any>;
center: number[] | undefined;
zoom: number | undefined;
channelWidth = 0.6;
@@ -313,4 +315,8 @@ export class NodesChannelsMap implements OnInit, OnDestroy {
this.chartInstance.setOption(chartOptions);
});
}
onChartFinished(e) {
this.readyEvent.emit();
}
}