<!--
~ 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 (itemStream | async; as items) {
  <ng-content select="[header]"></ng-content>
  <ion-list [style.display]="items && items.length ? 'block' : 'none'">
    @for (item of items; track item) {
      <ng-container
        *ngTemplateOutlet="listItemTemplateRef || defaultListItem; context: {$implicit: item}"
      ></ng-container>
    }
    <ion-infinite-scroll (ionInfinite)="notifyLoadMore()">
      <ion-infinite-scroll-content></ion-infinite-scroll-content>
    </ion-infinite-scroll>
  </ion-list>
}
<div [style.display]="!loading && items && items.length === 0 ? 'block' : 'none'">
  <ion-label class="centered-message-container">
    {{ 'search.nothing_found' | translate | titlecase }}
  </ion-label>
</div>
<skeleton-list [style.display]="loading ? 'block' : 'none'"></skeleton-list>

<ng-template let-item #defaultListItem>
  <stapps-data-list-item [item]="item" [hideThumbnail]="singleType"></stapps-data-list-item>
</ng-template>
