<h4 mat-dialog-title i18n="Subscribe dialog title">Subscribe to playlist or channel</h4>

<mat-dialog-content>
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <mat-form-field color="accent">
                    <input [(ngModel)]="url" matInput placeholder="URL" i18n-placeholder="Subscription URL input placeholder" required aria-required="true">
                    <mat-hint><ng-container i18n="Subscription URL input hint">The playlist or channel URL</ng-container></mat-hint>
                </mat-form-field>
            </div>
            <div class="col-12">
                <mat-form-field color="accent">
                    <input [(ngModel)]="name" matInput placeholder="Custom name" i18n-placeholder="Subscription custom name placeholder">
                    <mat-hint><ng-container i18n="Custom name input hint">This is optional</ng-container></mat-hint>
                </mat-form-field>
            </div>
            <div class="col-12 mt-3">
                <mat-checkbox [(ngModel)]="download_all"><ng-container i18n="Download all uploads subscription setting">Download all uploads</ng-container></mat-checkbox>
            </div>
            <div class="col-12" *ngIf="!download_all">
                <ng-container i18n="Download time range prefix">Download videos uploaded in the last</ng-container>
                <mat-form-field color="accent" style="width: 50px; text-align: center">
                    <input type="number" matInput [(ngModel)]="timerange_amount">
                </mat-form-field>
                <mat-select color="accent" class="unit-select" [(ngModel)]="timerange_unit">
                    <mat-option *ngFor="let time_unit of time_units" [value]="time_unit + (timerange_amount === 1 ? '' : 's')">
                        {{time_unit + (timerange_amount === 1 ? '' : 's')}}
                    </mat-option>
                </mat-select>
            </div>
        </div>
    </div>
</mat-dialog-content>

<mat-dialog-actions>
    <button mat-button mat-dialog-close><ng-container i18n="Subscribe cancel button">Cancel</ng-container></button>
    <!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
    <button mat-button [disabled]="!url" type="submit" (click)="subscribeClicked()">Subscribe</button>
    <div class="mat-spinner" *ngIf="subscribing">
      <mat-spinner [diameter]="25"></mat-spinner>
    </div>
</mat-dialog-actions>