<div class="mx-auto mt-4 flex w-full max-w-2xl flex-col gap-4 pb-4">
  <section class="rounded-md border border-slate-300 bg-slate-50 p-4">
    <div class="flex items-center justify-between gap-4">
      <div class="flex min-w-0 items-center gap-2">
        <h1 class="text-lg font-medium">
          Scans for
          <%= link_to @user.name, domain_user_path(@user), class: "text-blue-600 hover:underline" %>
        </h1>
      </div>
    </div>
  </section>
  <% if @kinds.any? %>
    <section class="grid grid-cols-[1fr_auto_auto] overflow-hidden rounded-md border border-slate-300 bg-white">
      <div class="grid grid-cols-subgrid col-span-full px-3 py-2 text-sm border-b border-slate-200 bg-slate-100 rounded-t-md">
        <div class="font-medium text-slate-600">Scan Kind</div>
        <div class="font-medium text-slate-600">Last Scan</div>
        <div class="text-right font-medium text-slate-600">Total Scans</div>
      </div>
      <% @kinds.each do |kind| %>
        <% kind_count = @kind_counts[kind] || 0 %>
        <div class="grid grid-cols-subgrid col-span-full px-3 py-2 items-center border-b last:border-b-0 border-slate-200 hover:bg-slate-50">
          <div>
            <%= link_to add_tracked_object_kind_for_view(kind),
                tracked_objects_domain_user_job_events_path(@user, kind: kind),
                class: "text-blue-600 hover:text-blue-800 font-medium" %>
          </div>
          <div>
            <% most_recent_at = @kinds_most_at[kind] %>
            <% if most_recent_at %>
              <%= time_ago_in_words(most_recent_at) %> ago
            <% else %>
              <span class="text-slate-400">N/A</span>
            <% end %>
          </div>
          <div class="text-right">
            <span class="inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 text-xs font-medium text-slate-700">
              <%= kind_count %>
            </span>
          </div>
        </div>
      <% end %>
    </section>
  <% else %>
    <section class="rounded-md border border-slate-300 bg-slate-50 p-8 text-center">
      <i class="bi bi-search mb-3 block text-4xl text-slate-400"></i>
      <p class="text-slate-600">No tracked object kinds found.</p>
    </section>
  <% end %>
</div>
