<div class="flex flex-col space-y-8 justify-center items-center">
  <h1 class="title text-2xl title-primary-500">
    <%= gettext("Catalog") %>
  </h1>

  <%= if @rows |> Enum.empty?() do %>
    <h2 class="title text-xl text-primary-600">
      <%= gettext("No Ammo Types") %>
      <%= display_emoji("😔") %>
    </h2>

    <%= live_patch(dgettext("actions", "Add your first type!"),
      to: Routes.ammo_type_index_path(Endpoint, :new),
      class: "btn btn-primary"
    ) %>
  <% else %>
    <%= live_patch(dgettext("actions", "New Ammo type"),
      to: Routes.ammo_type_index_path(Endpoint, :new),
      class: "btn btn-primary"
    ) %>

    <.live_component
      module={CanneryWeb.Components.TableComponent}
      id="ammo_types_index_table"
      action={@live_action}
      columns={@columns}
      rows={@rows}
    />
  <% end %>
</div>

<%= if @live_action in [:new, :edit] do %>
  <.modal return_to={Routes.ammo_type_index_path(Endpoint, :index)}>
    <.live_component
      module={CanneryWeb.AmmoTypeLive.FormComponent}
      id={@ammo_type.id || :new}
      title={@page_title}
      action={@live_action}
      ammo_type={@ammo_type}
      return_to={Routes.ammo_type_index_path(Endpoint, :index)}
      current_user={@current_user}
      }
    />
  </.modal>
<% end %>
