<ng-template #modal>
  <div class="modal-header">
    <h4 class="modal-title">{{ action() }}</h4>

    <button class="border-0 p-0" title="Close this modal" i18n-title (click)="hide()">
      <my-global-icon iconName="cross"></my-global-icon>
    </button>
  </div>

  <div class="modal-body">
    <form novalidate [formGroup]="form" (ngSubmit)="submit()">
      <div class="form-group">
        <label i18n for="hosts">1 host (without "http://") per line</label>

        <textarea
          [placeholder]="placeholder()" formControlName="hosts" type="text" id="hosts" name="hosts"
          class="form-control" [ngClass]="{ 'input-error': formErrors['hosts'] }" ngbAutofocus
        ></textarea>

        @if (formErrors.hosts) {
          <div class="form-error" role="alert">
            {{ formErrors.hosts }}

            @if (form.controls['hosts'].errors.validHosts) {
              <div>{{ form.controls['hosts'].errors.validHosts.value }}</div>
            }
          </div>
        }
      </div>

      <ng-content select="warning"></ng-content>

      <div class="form-group inputs">
        <input
          type="button" role="button" i18n-value value="Cancel" class="peertube-button secondary-button"
          (click)="hide()" (key.enter)="hide()"
          >

        <input type="submit" [value]="action()" class="peertube-button primary-button" [disabled]="!form.valid" />
      </div>
    </form>
  </div>

</ng-template>
