<h1 class="visually-hidden" i18n>Video channels</h1>

<div class="margin-content">

  @if (channelPagination.totalItems === 0) {
    <div class="no-results" i18n>This account does not have channels.</div>
  }

  <div class="channels" myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onChannelDataSubject.asObservable()">
    @for (videoChannel of videoChannels; track videoChannel) {
      <div class="channel">
        <div class="channel-avatar-row">
          <my-actor-avatar
            [actor]="videoChannel" actorType="channel"
            [internalHref]="getVideoChannelLink(videoChannel)"
            i18n-title
            title="See this video channel"
            size="75"
          ></my-actor-avatar>

          <h2 class="fs-5 lh-1 fw-bold m-0">
            <a class="text-decoration-none" [routerLink]="getVideoChannelLink(videoChannel)" i18n-title title="See this video channel">
              {{ videoChannel.displayName }}
            </a>
          </h2>

          <div class="actor-counters">
            <div class="followers" i18n>{videoChannel.followersCount, plural, =0 {No subscribers} =1 {1 subscriber} other {{{ videoChannel.followersCount }} subscribers}}</div>

            @if (getTotalVideosOf(videoChannel) !== undefined) {
              <span class="videos-count" i18n>
                {getTotalVideosOf(videoChannel), plural, =0 {No videos} =1 {1 video} other {{{ getTotalVideosOf(videoChannel) }} videos}}
              </span>
            }
          </div>
          <div class="description-html" [innerHTML]="getChannelDescription(videoChannel)"></div>
        </div>

        <my-subscribe-button [videoChannels]="[videoChannel]"></my-subscribe-button>

        <a i18n class="button-show-channel peertube-button-link primary-button" [routerLink]="getVideoChannelLink(videoChannel)">Show this channel</a>

        <div class="videos-overflow-workaround">
          <div class="videos">
            @if (getTotalVideosOf(videoChannel) === 0) {
              <div class="no-results h-auto" i18n>This channel doesn't have any videos.</div>
            }

            @for (video of getVideosOf(videoChannel); track video) {
              <my-video-miniature
                [video]="video" [user]="userMiniature" [displayVideoActions]="true" [displayOptions]="miniatureDisplayOptions"
              ></my-video-miniature>
            }

            @if (getTotalVideosOf(videoChannel)) {
              <div class="miniature-show-channel">
                <a class="link-primary" i18n [routerLink]="getVideoChannelLink(videoChannel)">SHOW THIS CHANNEL ></a>
              </div>
            }
          </div>
        </div>
      </div>
    }
  </div>
</div>
