<% content_for :sidebar do %>
  <%= render "settings/nav" %>
<% end %>

<section class="space-y-4">
  <header class="flex items-center justify-between">
    <h1 class="text-gray-900 text-xl font-medium"><%= t(".title") %></h1>

    <%= link_to new_merchant_path, class: "btn btn--primary flex items-center gap-1 justify-center", data: { turbo_frame: :modal } do %>
      <%= lucide_icon "plus", class: "w-5 h-5" %>
      <p><%= t(".new") %></p>
    <% end %>
  </header>

  <div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
    <% if @merchants.any? %>
      <div class="rounded-xl bg-gray-25 space-y-1 p-1">
        <div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-gray-500 uppercase">
          <p><%= t(".title") %></p>
          <span class="text-gray-400">&middot;</span>
          <p><%= @merchants.count %></p>
        </div>

        <div class="border border-alpha-black-25 rounded-md bg-white shadow-xs">
          <div class="overflow-hidden rounded-md">
            <%= render partial: @merchants, spacer_template: "merchants/ruler" %>
          </div>
        </div>
      </div>
    <% else %>
      <div class="flex justify-center items-center py-20">
        <div class="text-center flex flex-col items-center max-w-[300px]">
          <p class="text-gray-900 mb-1 font-medium text-sm"><%= t(".empty") %></p>
          <%= link_to new_merchant_path, class: "w-fit flex text-white text-sm font-medium items-center gap-1 bg-gray-900 rounded-lg p-2 pr-3", data: { turbo_frame: "modal" } do %>
            <%= lucide_icon("plus", class: "w-5 h-5") %>
            <span><%= t(".new") %></span>
          <% end %>
        </div>
      </div>
    <% end %>
  </div>

  <%= settings_nav_footer %>
</div>
