Create geolocation component to format geolocation data
This commit is contained in:
@@ -3,9 +3,9 @@ import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError, map, switchMap } from 'rxjs/operators';
|
||||
import { SeoService } from 'src/app/services/seo.service';
|
||||
import { getFlagEmoji } from 'src/app/shared/graphs.utils';
|
||||
import { LightningApiService } from '../lightning-api.service';
|
||||
import { isMobile } from '../../shared/common.utils';
|
||||
import { GeolocationData } from 'src/app/shared/components/geolocation/geolocation.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-node',
|
||||
@@ -58,7 +58,6 @@ export class NodeComponent implements OnInit {
|
||||
} else if (socket.indexOf('onion') > -1) {
|
||||
label = 'Tor';
|
||||
}
|
||||
node.flag = getFlagEmoji(node.iso_code);
|
||||
socketsObject.push({
|
||||
label: label,
|
||||
socket: node.public_key + '@' + socket,
|
||||
@@ -66,6 +65,19 @@ export class NodeComponent implements OnInit {
|
||||
}
|
||||
node.socketsObject = socketsObject;
|
||||
node.avgCapacity = node.capacity / Math.max(1, node.active_channel_count);
|
||||
|
||||
if (!node?.country && !node?.city &&
|
||||
!node?.subdivision && !node?.iso) {
|
||||
node.geolocation = null;
|
||||
} else {
|
||||
node.geolocation = <GeolocationData>{
|
||||
country: node.country?.en,
|
||||
city: node.city?.en,
|
||||
subdivision: node.subdivision?.en,
|
||||
iso: node.iso_code,
|
||||
};
|
||||
}
|
||||
|
||||
return node;
|
||||
}),
|
||||
catchError(err => {
|
||||
|
||||
Reference in New Issue
Block a user