Merge pull request #2158 from mempool/nymkappa/feature/ln-map-dashboard

Show LN map on the LN dashboard
This commit is contained in:
wiz 2022-07-23 18:30:18 +02:00 committed by GitHub
commit 33776b2b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 18 deletions

View file

@ -1,3 +1,5 @@
<app-nodes-channels-map [widget]=true></app-nodes-channels-map>
<div class="container-xl dashboard-container"> <div class="container-xl dashboard-container">
<div class="row row-cols-1 row-cols-md-2"> <div class="row row-cols-1 row-cols-md-2">

View file

@ -1,6 +1,6 @@
<div class="full-container"> <div [class]="widget ? 'widget' : 'full-container'">
<div class="card-header"> <div class="card-header" *ngIf="!widget">
<div class="d-flex d-md-block align-items-baseline" style="margin-bottom: -5px"> <div class="d-flex d-md-block align-items-baseline" style="margin-bottom: -5px">
<span i18n="lightning.nodes-channels-world-map">Lightning nodes channels world map</span> <span i18n="lightning.nodes-channels-world-map">Lightning nodes channels world map</span>
<button class="btn p-0 pl-2" style="margin: 0 0 4px 0px"> <button class="btn p-0 pl-2" style="margin: 0 0 4px 0px">

View file

@ -1,6 +1,7 @@
.card-header { .card-header {
border-bottom: 0; border-bottom: 0;
font-size: 18px; font-size: 18px;
@media (min-width: 465px) { @media (min-width: 465px) {
font-size: 20px; font-size: 20px;
} }
@ -11,30 +12,45 @@
width: 100%; width: 100%;
min-height: 500px; min-height: 500px;
height: calc(100% - 150px); height: calc(100% - 150px);
@media (max-width: 992px) { @media (max-width: 992px) {
height: 100%; height: 100%;
padding-bottom: 100px; padding-bottom: 100px;
}; }
}
.widget {
width: 99vw;
height: 250px;
-webkit-mask: linear-gradient(0deg, #11131f00 5%, #11131fff 25%);
}
.widget > .chart {
-webkit-mask: linear-gradient(180deg, #11131f00 0%, #11131fff 20%);
} }
.chart { .chart {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-bottom: 20px;
padding-right: 10px; padding-right: 10px;
@media (max-width: 992px) { @media (max-width: 992px) {
padding-bottom: 25px; padding-bottom: 25px;
} }
@media (max-width: 829px) { @media (max-width: 829px) {
padding-bottom: 50px; padding-bottom: 50px;
} }
@media (max-width: 767px) { @media (max-width: 767px) {
padding-bottom: 25px; padding-bottom: 25px;
} }
@media (max-width: 629px) { @media (max-width: 629px) {
padding-bottom: 55px; padding-bottom: 55px;
} }
@media (max-width: 567px) { @media (max-width: 567px) {
padding-bottom: 55px; padding-bottom: 55px;
} }
} }

View file

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, NgZone, OnDestroy, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, NgZone, OnDestroy, OnInit } from '@angular/core';
import { SeoService } from 'src/app/services/seo.service'; import { SeoService } from 'src/app/services/seo.service';
import { ApiService } from 'src/app/services/api.service'; import { ApiService } from 'src/app/services/api.service';
import { Observable, tap, zip } from 'rxjs'; import { Observable, tap, zip } from 'rxjs';
@ -9,7 +9,6 @@ import { RelativeUrlPipe } from 'src/app/shared/pipes/relative-url/relative-url.
import { StateService } from 'src/app/services/state.service'; import { StateService } from 'src/app/services/state.service';
import { EChartsOption, registerMap } from 'echarts'; import { EChartsOption, registerMap } from 'echarts';
import 'echarts-gl'; import 'echarts-gl';
import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
@Component({ @Component({
selector: 'app-nodes-channels-map', selector: 'app-nodes-channels-map',
@ -18,10 +17,11 @@ import { SSL_OP_SSLEAY_080_CLIENT_DH_BUG } from 'constants';
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
}) })
export class NodesChannelsMap implements OnInit, OnDestroy { export class NodesChannelsMap implements OnInit, OnDestroy {
@Input() widget = false;
observable$: Observable<any>; observable$: Observable<any>;
chartInstance = undefined; chartInstance = undefined;
chartOptions: EChartsOption = {color: 'dark'}; chartOptions: EChartsOption = {};
chartInitOptions = { chartInitOptions = {
renderer: 'canvas', renderer: 'canvas',
}; };
@ -93,18 +93,19 @@ export class NodesChannelsMap implements OnInit, OnDestroy {
} }
}, },
viewControl: { viewControl: {
minDistance: 1, center: this.widget ? [2, 0, -10] : undefined,
distance: 60, minDistance: 0.1,
alpha: 89, distance: this.widget ? 20 : 60,
alpha: 90,
panMouseButton: 'left', panMouseButton: 'left',
rotateMouseButton: 'right', rotateMouseButton: 'none',
zoomSensivity: 0.5, zoomSensivity: 0.5,
}, },
itemStyle: { itemStyle: {
color: '#FFFFFF', color: '#FFFFFF',
opacity: 0.02, opacity: 0.02,
borderWidth: 1, borderWidth: 1,
borderColor: 'black', borderColor: '#00000050',
}, },
regionHeight: 0.01, regionHeight: 0.01,
}, },
@ -136,11 +137,8 @@ export class NodesChannelsMap implements OnInit, OnDestroy {
emphasis: { emphasis: {
label: { label: {
position: 'top', position: 'top',
// @ts-ignore color: 'white',
textStyle: { fontSize: 16,
color: 'white',
fontSize: 16,
},
formatter: function(value) { formatter: function(value) {
return value.name; return value.name;
}, },