<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-back-button [text]="'core.back' | translate"></ion-back-button>
        </ion-buttons>
        <ion-title>
            <h1>{{ 'core.settings.spaceusage' | translate }}</h1>
        </ion-title>
        <ion-buttons slot="end">
            <core-navbar-buttons>
            </core-navbar-buttons>
        </ion-buttons>
    </ion-toolbar>
</ion-header>
<ion-content class="limited-width">
    <ion-refresher [disabled]="!loaded" (ionRefresh)="refreshData($event.target)" slot="fixed">
        <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
    </ion-refresher>
    <core-loading [hideUntil]="loaded">
        <ion-list>
            <ion-item *ngFor="let site of sites" [class.item-current]="site.id == currentSiteId">
                <ion-label class="ion-text-wrap">
                    <p class="item-heading">
                        <core-format-text [text]="site.siteName" clean="true" [siteId]="site.id"></core-format-text>
                    </p>
                    <p class="ion-text-wrap">{{ site.fullName }}</p>
                    <p>{{ site.siteUrlWithoutProtocol }}</p>
                    <ion-badge color="light" *ngIf="site.spaceUsage !== undefined">{{ site.spaceUsage | coreBytesToSize }}</ion-badge>
                </ion-label>
                <ion-button fill="clear" color="danger" slot="end" (click)="deleteSiteStorage(site)"
                    [hidden]="site.spaceUsage! + site.cacheEntries! <= 0">
                    <ion-icon name="fas-trash" slot="icon-only"
                        [attr.aria-label]="'addon.storagemanager.deletedatafrom' | translate: { name: site.siteName }">
                    </ion-icon>
                </ion-button>
            </ion-item>
            <ion-item-divider>
                <ion-label>
                    <h2>{{ 'core.settings.total' | translate }}</h2>
                </ion-label>
                <p slot="end" class="ion-margin-end">
                    {{ totals.spaceUsage | coreBytesToSize }}
                </p>
            </ion-item-divider>
        </ion-list>
    </core-loading>
</ion-content>
