<appearance-panel-meta [path]="['Menus', menus.activeMenu && menus.activeMenu.name]" (backClick)="openPreviousPanel()"></appearance-panel-meta>

<div class="appearance-panel-content">
    <div class="menus" *ngIf="!menus.activeMenu">
        <div class="menu nav-item" *ngFor="let menu of menus.getAll()" (click)="setActiveMenu(menu)">
            <span class="name">{{menu.name}}</span>
            <mat-icon svgIcon="keyboard-arrow-right" class="arrow-icon"></mat-icon>
        </div>

        <div class="action-buttons">
            <button mat-button color="accent" class="button primary" (click)="menus.create()" trans>Add a Menu</button>
        </div>
    </div>

    <div class="menu-panel" *ngIf="menus.activeMenu">
        <div class="many-inputs menu-settings">
            <div class="input-container">
                <label for="menu-name" trans>Menu Name</label>
                <input type="text" id="menu-name" [(ngModel)]="menus.activeMenu.name" (ngModelChange)="menus.commitChanges()">
            </div>

            <div class="input-container">
                <label for="menu-position" trans>Menu Position</label>
                <select id="menu-position" [(ngModel)]="menus.activeMenu.position" (ngModelChange)="menus.commitChanges()">
                    <option [value]="position" *ngFor="let position of appearance.config.menus.positions">{{position.replace('-', ' ')}}</option>
                </select>
            </div>
        </div>

        <menu-items></menu-items>

        <div class="action-buttons">
            <button mat-button color="warn" (click)="confirmMenuDeletion()" trans>Delete Menu</button>
            <button class="button flat add-item-button" mat-button color="accent" (click)="toggleNewMenuItemPanel()" trans>Add Items</button>
        </div>
    </div>

    <add-menu-item-panel *ngIf="newMenuItemPanelActive" (closeClick)="toggleNewMenuItemPanel()"></add-menu-item-panel>
</div>