<%= render HeaderComponent.new(title: "Settings") %>

<%= render MainWithSidenavComponent.new(sidenav_partial: 'shared/admin_sidenav_settings') do %>
  <%= form_for(Setting.new, url: admin_settings_registrations_path) do |f| %>
    <section>
      <h3>Registrations</h3>

      <% if @errors && @errors.any? %>
        <%= render partial: "admin/settings/errors", locals: { errors: @errors } %>
      <% end %>

      <label class="block">
        <p class="font-bold mb-1">Reserved usernames</p>
        <p class="text-gray-500">
          These usernames cannot be registered as accounts:
        </p>
        <%= f.text_area :reserved_usernames,
          value: Setting.reserved_usernames.join("\n"),
          class: "h-44 mb-2" %>
        <p class="text-sm text-gray-500">
          One username per line
        </p>
      </label>
    </section>

    <section>
      <p class="pt-6 border-t border-gray-200 text-right">
        <%= f.submit 'Save', class: "btn-md btn-blue w-full md:w-auto" %>
      </p>
    </section>
  <% end %>
<% end %>
