<nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-900 text-primary-400">
  <div class="flex flex-col sm:flex-row justify-between items-center">
    <div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
      <.link navigate={~p"/"} class="mx-2 my-1 leading-5 text-xl text-primary-400 hover:underline">
        {gettext("memEx")}
      </.link>

      <%= if @title_content do %>
        <span class="mx-2 my-1">
          |
        </span>
        {@title_content}
      <% end %>
    </div>

    <hr class="mb-2 sm:hidden hr-light" />

    <ul class="flex flex-row flex-wrap justify-center items-center
      text-lg text-primary-400 text-ellipsis">
      <li class="mx-2 my-1">
        <.link navigate={~p"/notes"} class="text-primary-400 hover:underline truncate">
          {gettext("notes")}
        </.link>
      </li>

      <li class="mx-2 my-1">
        <.link navigate={~p"/contexts"} class="text-primary-400 hover:underline truncate">
          {gettext("contexts")}
        </.link>
      </li>

      <li class="mx-2 my-1">
        <.link navigate={~p"/pipelines"} class="text-primary-400 hover:underline truncate">
          {gettext("pipelines")}
        </.link>
      </li>

      <li class="mx-2 my-1 border-left border border-primary-700">​</li>

      <%= if @current_user do %>
        <li :if={@current_user |> Accounts.already_admin?()} class="mx-2 my-1">
          <.link navigate={~p"/invites"} class="text-primary-400 hover:underline">
            {gettext("invites")}
          </.link>
        </li>

        <li class="mx-2 my-1">
          <.link navigate={~p"/users/settings"} class="text-primary-400 hover:underline truncate">
            {@current_user.email}
          </.link>
        </li>
        <li class="mx-2 my-1">
          <.link
            href={~p"/users/log_out"}
            method="delete"
            data-confirm={dgettext("prompts", "are you sure you want to log out?")}
            aria-label={gettext("log out")}
          >
            <i class="fas fa-sign-out-alt"></i>
          </.link>
        </li>
        <li
          :if={
            @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2)
          }
          class="mx-2 my-1"
        >
          <.link
            navigate={~p"/dashboard"}
            class="text-primary-400 hover:underline"
            aria-label={gettext("live dashboard")}
          >
            <i class="fas fa-gauge"></i>
          </.link>
        </li>
      <% else %>
        <li :if={Accounts.allow_registration?()} class="mx-2 my-1">
          <.link href={~p"/users/register"} class="text-primary-400 hover:underline truncate">
            {dgettext("actions", "register")}
          </.link>
        </li>

        <li class="mx-2 my-1">
          <.link href={~p"/users/log_in"} class="text-primary-400 hover:underline truncate">
            {dgettext("actions", "log in")}
          </.link>
        </li>
      <% end %>
    </ul>
  </div>
</nav>
