<!--
~ Copyright (C) 2023 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/>.
-->

@if (items | async; as items) {
  <ion-list>
    @if (!listHeader) {
    } @else {
      <ion-list-header lines="inset">
        <ion-text color="dark">
          <h3>{{ listHeader }}</h3>
        </ion-text>
      </ion-list-header>
    }
    @for (item of items; track item) {
      <ng-container
        *ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
      ></ng-container>
    }
  </ion-list>
  @if (emptyListMessage && items.length === 0) {
    <ion-label class="empty-list-message">{{ emptyListMessage }}</ion-label>
  }
} @else {
  <ion-list>
    @for (skeleton of [].constructor(skeletonItems); track skeleton) {
      <stapps-skeleton-list-item [hideThumbnail]="singleType"> </stapps-skeleton-list-item>
    }
  </ion-list>
}
<ng-template let-item #defaultListItem>
  <stapps-data-list-item [item]="item" [hideThumbnail]="singleType"></stapps-data-list-item>
</ng-template>
