<!--

    Copyright © 2016-2026 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<div class="tb-card-content flex flex-col gap-2">
  <div class="tb-card-header">
    <div class="tb-title">{{ 'widgets.quick-links.title' | translate }}</div>
    <button class="tb-title-icon"
            matTooltip="{{ 'action.edit' | translate }}"
            matTooltipPosition="above"
            mat-icon-button
            (click)="edit()">
      <tb-icon>edit</tb-icon>
    </button>
  </div>
  <mat-grid-list class="tb-links-list flex-1" [cols]="columns" [rowHeight]="rowHeight" [gutterSize]="gutterSize">
    @for (quickLink of menuLinks$() | async; track quickLink) {
      <mat-grid-tile class="tb-links-tile">
        <a class="tb-link-button flex-1"
           [routerLink]="quickLink.path">
          <div class="tb-link-container">
            <div class="tb-link-icon-container">
              <tb-icon color="primary">{{ quickLink.icon }}</tb-icon>
            </div>
            <div class="tb-link-text">{{ (quickLink.fullName || quickLink.name) | translate }}</div>
          </div>
        </a>
      </mat-grid-tile>
    }
    <mat-grid-tile class="tb-links-tile">
      <div class="tb-add-link-button flex-1"
           matTooltip="{{ 'widgets.quick-links.add-link' | translate }}"
           matTooltipPosition="above"
           (click)="addLink()">
        <tb-icon class="tb-add-icon">add</tb-icon>
      </div>
    </mat-grid-tile>
  </mat-grid-list>
</div>
