

<div class="container-xl" style="min-height: 335px" [ngClass]="{'widget': widget, 'full-height': !widget}">
  <h1 *ngIf="!widget" class="float-left" i18n="lightning.connectivity-ranking">Connectivity Ranking</h1>

  <div class="clearfix"></div>

  <div style="min-height: 295px">
    <table class="table table-borderless">
      <thead>
        <th class="pool text-left" i18n="nodes.alias" [ngClass]="{'widget': widget}">Alias</th>
        <th class="liquidity text-right" i18n="node.channels">Channels</th>
        <th *ngIf="!widget" class="d-none d-md-table-cell channels text-right" i18n="lightning.channels">Capacity</th>
        <th *ngIf="!widget" class="d-none d-md-table-cell text-right">{{ currency$ | async }}</th>
        <th *ngIf="!widget" class="d-none d-md-table-cell timestamp text-right" i18n="transaction.first-seen|Transaction first seen">First seen</th>
        <th *ngIf="!widget" class="d-none d-md-table-cell timestamp text-right" i18n="lightning.last_update">Last update</th>
        <th class="geolocation d-table-cell text-right" i18n="lightning.location">Location</th>
      </thead>
      <tbody *ngIf="topNodesPerChannels$ | async as data">
        <tr *ngFor="let node of data.nodes;">
          <td class="pool text-left">
            <div class="tooltip-custom d-block w-100">
              <a class="link d-block w-100" [routerLink]="['/lightning/node' | relativeUrl, node.publicKey]">
                <span class="pool-name w-100">{{ node.alias }}</span>
              </a>
            </div>
          </td>
          <td class="text-right">
            {{ node.channels ? (node.channels | number) : '~' }}
            <span class="capacity-ratio">&nbsp;({{ (node?.channels / data.statistics.totalChannels * 100) | number:'1.1-1' }}%)</span>
          </td>
          <td *ngIf="!widget" class="d-none d-md-table-cell capacity text-right">
            <app-amount [satoshis]="node.capacity" [digitsInfo]="'1.2-2'" [noFiat]="true"></app-amount>
            <span class="capacity-ratio">&nbsp;({{ (node.capacity / data.statistics.totalCapacity * 100) | number:'1.1-1' }}%)</span>
          </td>
          <td *ngIf="!widget" class="fiat d-none d-md-table-cell text-right">
            <app-fiat [value]="node.capacity"></app-fiat>
          </td>
          <td *ngIf="!widget" class="d-none d-md-table-cell text-right">
            <app-timestamp [customFormat]="'yyyy-MM-dd'" [unixTime]="node.firstSeen" [hideTimeSince]="true"></app-timestamp>
          </td>
          <td *ngIf="!widget" class="d-none d-md-table-cell text-right">
            <app-timestamp [customFormat]="'yyyy-MM-dd'" [unixTime]="node.updatedAt" [hideTimeSince]="true"></app-timestamp>
          </td>
          <td class="geolocation d-table-cell text-right text-truncate">
            <app-geolocation [data]="node.geolocation" [type]="'list-isp'"></app-geolocation>
          </td>
        </tr>
      </tbody>
    </table>

    <ng-template [ngIf]="!widget">
      <div class="clearfix"></div>
      <br>
    </ng-template>
  </div>
  
</div>
