<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-back-button [text]="'core.back' | translate"></ion-back-button>
        </ion-buttons>
        <ion-title>{{ 'core.tag.tag' | translate }}: {{ tagName }}</ion-title>
    </ion-toolbar>
</ion-header>

<ion-content>
    <core-split-view>
        <ion-refresher slot="fixed" [disabled]="!loaded" (ionRefresh)="refreshData($event.target)">
            <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
        </ion-refresher>
        <core-loading [hideUntil]="loaded">
            <ion-list *ngIf="hasUnsupportedAreas || areas.length">
                <ion-item *ngIf="hasUnsupportedAreas" class="core-warning-item">
                    <ion-icon slot="start" name="fas-exclamation-triangle" color="warning" aria-hidden="true"></ion-icon>
                    <ion-label class="ion-text-wrap">{{ 'core.tag.warningareasnotsupported' | translate }}</ion-label>
                </ion-item>
                <ion-item class="ion-text-wrap" *ngFor="let area of areas" [attr.aria-label]="area.nameKey | translate"
                    (click)="openArea(area)" [attr.aria-current]="area!.id == selectedAreaId ? 'page' :  'false'" button>
                    <ion-label>
                        <h2>{{ area!.nameKey | translate }}</h2>
                    </ion-label>
                    <ion-badge slot="end" *ngIf="area!.badge">{{ area!.badge }}</ion-badge>
                </ion-item>
            </ion-list>
            <core-empty-box icon="fa-tag" *ngIf="!hasUnsupportedAreas && (!areas || !areas.length)"
                [message]="'core.tag.noresultsfor' | translate: { $a: tagName }"></core-empty-box>
        </core-loading>
    </core-split-view>
</ion-content>
