<!--
  ~ Copyright (C) 2021 StApps
  ~ This program is free software: you can redistribute it and/or modify it
  ~ under the terms of the GNU General Public License as published by the Free
  ~ Software Foundation, version 3.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT
  ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  ~ more details.
  ~
  ~ You should have received a copy of the GNU General Public License along with
  ~ this program. If not, see <https://www.gnu.org/licenses/>.
  -->

<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-menu-button></ion-menu-button>
      <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title>Licenses</ion-title>
    <!-- TODO: translation -->
  </ion-toolbar>
</ion-header>
<cdk-virtual-scroll-viewport
  itemSize="130"
  minBufferPx="1500"
  maxBufferPx="2000"
>
  <ion-card
    *cdkVirtualFor="let license of licenses"
    [href]="license.url || license.repository"
    rel="external"
    target="_blank"
  >
    <ion-card-header>
      <ion-card-title>
        {{ license.name }}
        <ion-icon class="supertext-icon" name="open-outline"></ion-icon>
      </ion-card-title>

      <ion-card-subtitle *ngIf="license.authors || license.publisher">
        {{ license.authors || license.publisher }}
      </ion-card-subtitle>
    </ion-card-header>
    <ion-card-content>
      <ion-chip (click)="$event.preventDefault(); viewLicense(license)">
        <ion-icon name="document"></ion-icon>
        <ion-label>{{ license.licenses }} License</ion-label>
      </ion-chip>
    </ion-card-content>
  </ion-card>
</cdk-virtual-scroll-viewport>
