<main id="main">
  <section class="container-content page-wrapper">
    <h1 class="page-list-title"><%= @page_title %></h1>
  <%= if assigns[:feed_links] && assigns[:feed_links] != [] do %>
  <%   atom_link = Enum.find(@feed_links, fn l -> l.type == "application/atom+xml" end) %>
  <%   json_link = Enum.find(@feed_links, fn l -> l.type == "application/feed+json" end) %>
    <div class="feed-links-row">
      <svg class="feed-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M4 11a9 9 0 0 1 9 9"/><path d="M4 4a16 16 0 0 1 16 16"/><circle cx="5" cy="19" r="1" fill="currentColor" stroke="none"/></svg>
      <span>Feeds:</span>
  <%= if atom_link do %>
      <span class="feed-tooltip-wrap">
        <a href="<%= atom_link.url %>" class="feed-link">Atom</a>
        <span class="feed-tooltip"><%= @t.("subscribe_via_atom") %></span>
      </span>
  <% end %>
  <%= if atom_link && json_link do %><span class="feed-separator">·</span><% end %>
  <%= if json_link do %>
      <span class="feed-tooltip-wrap">
        <a href="<%= json_link.url %>" class="feed-link">JSON</a>
        <span class="feed-tooltip"><%= @t.("subscribe_via_json") %></span>
      </span>
  <% end %>
    </div>
  <% end %>
  <%= if @contents == [] do %>
    <p class="empty-state-text"><%= @t.("no_content_yet") %></p>
  <% else %>
  <%= cond do %>
  <% @content_type == "notes" -> %>
    <div class="notes-grid">
  <%= for item <- @contents do %>
      <a href="<%= Sayfa.Content.url(item) %>" class="content-card content-card-note">
        <h2 class="content-card-title"><%= item.title %></h2>
  <%= if item.date do %>
        <div class="content-card-date-wrap"><time datetime="<%= item.date %>" class="content-card-date"><%= @format_date.(item.date) %></time></div>
  <% end %>
      </a>
  <% end %>
    </div>
  <% @content_type == "projects" -> %>
    <div class="cards-stack">
  <%= for item <- @contents do %>
      <a href="<%= Sayfa.Content.url(item) %>" class="content-card content-card-project">
        <div class="content-card-header">
          <h2 class="content-card-title"><%= item.title %></h2>
  <%= if Map.get(item.meta, "status") do %>
          <span class="chip-status"><%= item.meta["status"] %></span>
  <% end %>
        </div>
  <%= if Map.get(item.meta, "excerpt") do %>
        <p class="content-card-excerpt"><%= item.meta["excerpt"] %></p>
  <% end %>
  <%= if item.categories != [] do %>
        <div class="content-card-meta">
  <%= for cat <- item.categories do %>
          <span class="chip-category"><svg class="icon-2_5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg><%= cat %></span>
  <% end %>
        </div>
  <% end %>
  <%= if item.tags != [] do %>
        <div class="content-card-meta">
  <%= for tag <- item.tags do %>
          <span class="chip-tag"><svg class="icon-2_5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true"><line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/></svg><%= tag %></span>
  <% end %>
        </div>
  <% end %>
      </a>
  <% end %>
    </div>
  <% true -> %>
    <div class="list-stack">
  <%= for item <- @contents do %>
      <a href="<%= Sayfa.Content.url(item) %>" class="list-entry">
        <h2 class="list-entry-title"><%= item.title %></h2>
  <%= if Map.get(item.meta, "excerpt") do %>
        <p class="list-entry-excerpt"><%= item.meta["excerpt"] %></p>
  <% end %>
        <div class="list-entry-meta">
  <%= if item.date do %>
          <time datetime="<%= item.date %>" class="content-card-date"><%= @format_date.(item.date) %></time>
  <% end %>
  <%= if item.categories != [] do %>
          <div class="list-chip-group">
  <%= for cat <- item.categories do %>
            <span class="chip-category"><svg class="icon-2_5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg><%= cat %></span>
  <% end %>
          </div>
  <% end %>
  <%= if item.tags != [] do %>
          <div class="list-chip-group">
  <%= for tag <- item.tags do %>
            <span class="chip-tag"><svg class="icon-2_5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24" aria-hidden="true"><line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/></svg><%= tag %></span>
  <% end %>
          </div>
  <% end %>
        </div>
      </a>
  <% end %>
    </div>
  <% end %>
  <% end %>
  <%= if assigns[:pagination] && @pagination do %>
    <nav class="pagination-nav" aria-label="Pagination">
  <%= if @pagination.has_prev do %>
      <a href="<%= @pagination.prev_url %>" rel="prev" class="btn-primary-sm">
        <svg class="icon-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg>
        <%= @t.("previous") %>
      </a>
  <% else %>
      <span class="btn-primary-sm btn-disabled" aria-disabled="true" tabindex="-1">
        <svg class="icon-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" aria-hidden="true"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg>
        <%= @t.("previous") %>
      </span>
  <% end %>
      <span class="pagination-label"><%= @pagination.page_number %> / <%= @pagination.total_pages %></span>
  <%= if @pagination.has_next do %>
      <a href="<%= @pagination.next_url %>" rel="next" class="btn-primary-sm">
        <%= @t.("next") %>
        <svg class="icon-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
      </a>
  <% else %>
      <span class="btn-primary-sm btn-disabled" aria-disabled="true" tabindex="-1">
        <%= @t.("next") %>
        <svg class="icon-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h14"/><path d="m12 5 7 7-7 7"/></svg>
      </span>
  <% end %>
    </nav>
  <% end %>
  </section>
</main>
