<!--
~ 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/>.
-->

<stapps-section [title]="'name' | translateSimple: item()">
  @if (item().authProvider) {
    <ion-button slot="button-end" fill="clear" color="dark" (click)="toggleLogIn()">
      @if (loggedIn()) {
        <ion-icon slot="end" name="logout"></ion-icon>
      } @else {
        <ion-icon slot="end" name="login"></ion-icon>
      }
      <ion-label>{{ 'profile.buttons.default.log_' + (loggedIn() ? 'out' : 'in') | translate }}</ion-label>
    </ion-button>
  }

  <simple-swiper>
    @for (link of item().links; track link) {
      <ion-item
        lines="none"
        [routerLink]="link.link"
        [disabled]="link.needsAuth && !loggedIn()"
        [detail]="false"
      >
        <div>
          @if (link.icon) {
            <ion-icon [name]="$any(link.icon)" [size]="36" color="dark"></ion-icon>
          }
          <ion-label>{{ 'name' | translateSimple: link }}</ion-label>
        </div>
      </ion-item>
    }
  </simple-swiper>
</stapps-section>
