<main>
  <div class="activity row margin-top">
    <div class="small-12 column">

      <% if @user != current_user && @user.email_on_direct_message? %>
        <%= link_to t("users.show.send_private_message"),
                    new_user_direct_message_path(@user),
                    class: "button hollow float-right" %>
      <% else %>
        <div class="callout primary float-right">
          <%= t("users.show.no_private_messages") %>
        </div>
      <% end %>

      <h2 class="inline-block">
        <%= avatar_image(@user, seed: @user.id, size: 60) %>
        <%= @user.name %>
        <% if current_administrator? %>
          <small><%= @user.email %></small>
        <% end %>
      </h2>

      <% if @user.public_activity || @authorized_current_user %>
        <ul class="menu simple margin-top">
          <% @valid_filters.each do |filter| %>
            <% if @activity_counts[filter] > 0 %>
              <% if authorized_for_filter?(filter) %>
                <% if @current_filter == filter %>
                  <li class="active">
                    <%= t("users.show.filters.#{filter}", count: @activity_counts[filter]) %>
                  </li>
                <% else %>
                  <li>
                    <%= link_to t("users.show.filters.#{filter}", count: @activity_counts[filter]),
                                current_path_with_query_params(filter: filter, page: 1) %>
                  </li>
                <% end %>
              <% end %>
            <% end %>
          <% end %>
          <%= t("users.show.no_activity") if @activity_counts.values.inject(&:+) == 0 %>
        </ul>

        <%= render "activity_page" %>
      <% else %>
        <p><%= t('users.show.private_activity') %></p>
      <% end %>

    </div>
  </div>
</main>
