<div class="gallery">
    <div
        class="card"
        *ngFor="let asset of assets"
        (click)="toggleSelection(asset, $event)"
        [class.selected]="isSelected(asset)"
    >
        <div class="card-img">
            <vdr-select-toggle
                [selected]="isSelected(asset)"
                [disabled]="true"
                [hiddenWhenOff]="true"
            ></vdr-select-toggle>
            <img class="asset-thumb" [src]="asset | assetPreview: 'thumb'" />
        </div>
        <div class="detail">
            <vdr-entity-info
                [entity]="asset"
                [small]="true"
                (click)="entityInfoClick($event)"
            ></vdr-entity-info>
            <span [title]="asset.name">{{ asset.name }}</span>
        </div>
    </div>
</div>
<div class="info-bar">
    <div class="card">
        <div class="card-img">
            <div class="placeholder" *ngIf="selectionManager.selection.length === 0">
                <clr-icon shape="image" size="128"></clr-icon>
                <div>{{ 'catalog.no-selection' | translate }}</div>
            </div>
            <img
                class="preview"
                *ngIf="selectionManager.selection.length >= 1"
                [src]="lastSelected().preview + '?preset=medium'"
            />
        </div>
        <div class="card-block details" *ngIf="selectionManager.selection.length >= 1">
            <div class="name">{{ lastSelected().name }}</div>
            <div>{{ 'asset.original-asset-size' | translate }}: {{ lastSelected().fileSize | filesize }}</div>

            <ng-container *ngIf="selectionManager.selection.length === 1">
                <vdr-chip *ngFor="let tag of lastSelected().tags" [colorFrom]="tag.value"
                    ><clr-icon shape="tag" class="mr2"></clr-icon> {{ tag.value }}</vdr-chip
                >
                <div>
                    <button (click)="previewAsset(lastSelected())" class="btn btn-link">
                        <clr-icon shape="eye"></clr-icon> {{ 'asset.preview' | translate }}
                    </button>
                </div>
                <div>
                    <vdr-asset-preview-links class="" [asset]="lastSelected()"></vdr-asset-preview-links>
                </div>
                <div>
                    <a [routerLink]="['./', lastSelected().id]" class="btn btn-link">
                        <clr-icon shape="pencil"></clr-icon> {{ 'common.edit' | translate }}
                    </a>
                </div>
            </ng-container>
            <div *ngIf="canDelete">
                <button (click)="deleteAssets.emit(selectionManager.selection)" class="btn btn-link">
                    <clr-icon shape="trash" class="is-danger"></clr-icon> {{ 'common.delete' | translate }}
                </button>
            </div>
        </div>
    </div>
    <div class="card stack" [class.visible]="selectionManager.selection.length > 1"></div>
    <div class="selection-count" [class.visible]="selectionManager.selection.length > 1">
        {{ 'asset.assets-selected-count' | translate: { count: selectionManager.selection.length } }}
        <ul>
            <li *ngFor="let asset of selectionManager.selection">{{ asset.name }}</li>
        </ul>
    </div>
</div>
