<% if policy(post).view_file? %>
  <section>
    <% if (log_entry = post.primary_file_for_view&.log_entry) %>
      <% if log_entry.status_code == 200 %>
        <%= render partial: "log_entries/content_container",
                   locals: {
                     log_entry: log_entry,
                   } %>
      <% else %>
        <section class="flex grow justify-center text-slate-500">
          <div>
            <i class="fa-solid fa-exclamation-triangle"></i>
            File error
            <% if log_entry.status_code == 404 %>
              (404 not found)
            <% else %>
              (<%= log_entry.status_code %>)
            <% end %>
          </div>
        </section>
      <% end %>
    <% else %>
      <section class="flex grow justify-center overflow-clip">
        <div class="text-slate-500">
          <i class="fa-solid fa-file-arrow-down"></i>
          No file
        </div>
      </section>
    <% end %>
  </section>
  <%= render partial: "log_entries/file_details_sky_section",
               locals: {
                 log_entry: post.primary_file_for_view&.log_entry,
               } %>
<% else %>
  <section class="sky-section">
    <%= link_to post.external_url_for_view.to_s,
                  target: "_blank",
                  rel: "noopener noreferrer",
                  class: "section-header flex items-center gap-2 hover:text-slate-600" do %>
      <span>View Post on <%= domain_name_for_model(post) %></span>
      <i class="fa-solid fa-arrow-up-right-from-square"></i>
    <% end %>
  </section>
<% end %>
