Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

3.0 KB
Raw Blame
<!-- Compact User Menu for Sidebar -->
<% if current_organisation.blank? %>
  <!-- Account context: simplified menu (profile/settings are already in main nav) -->
  <div class="flex items-center gap-3 py-2 px-4">
    <i class="bi bi-person-fill"></i>
    <span class="flex-1 truncate">
      <%= current_user.email.split('@').first if current_user %>
    </span>
    <%= link_to destroy_user_session_path, class: 'flex items-center gap-1 text-sm hover:text-red-600 transition-colors', title: t('navigation.logout'), data: { turbo_method: :delete } do %>
      <i class="bi bi-box-arrow-right text-xs"></i>
      <%= t('navigation.logout') %>
    <% end %>
  </div>
<% else %>
  <!-- Organisation context: full expandable menu -->
  <details class="group">
    <summary class="list-none cursor-pointer">
      <div class="flex items-center gap-3 py-2 px-4 hover:bg-cream-200 rounded transition-colors">
        <span class="relative inline-flex">
          <i class="bi bi-person-fill"></i>
          <%# Quiet unread marker for platform news (lime, not the red notification colour). %>
          <% if changelog_has_unread?(current_user) %>
            <span class="changelog-unread-dot absolute -top-1 -end-1 w-2 h-2 bg-lime-500 rounded-full border border-stroke"></span>
          <% end %>
        </span>
        <span class="flex-1">
          <%= current_user.email.split('@').first if current_user %>
        </span>
        <i class="bi bi-chevron-right group-open:rotate-90 transition-transform text-xs"></i>
      </div>
    </summary>

    <div class="pl-4">
      <ul class="flex flex-col">
        <li>
          <%= link_to edit_user_registration_path, class: 'flex items-center gap-3 py-2 px-4 hover:bg-cream-200 text-sm' do %>
            <i class="bi bi-person-fill text-xs"></i>
            <%= t('navigation.profile') %>
          <% end %>
        </li>
        <li>
          <%= link_to general_user_preferences_path, class: 'flex items-center gap-3 py-2 px-4 hover:bg-cream-200 text-sm' do %>
            <i class="bi bi-person-gear text-xs"></i>
            <%= t('navigation.preferences') %>
          <% end %>
        </li>
        <li>
          <%= link_to user_data_export_path, class: 'flex items-center gap-3 py-2 px-4 hover:bg-cream-200 text-sm' do %>
            <i class="bi bi-download text-xs"></i>
            <%= t('navigation.data_export') %>
          <% end %>
        </li>
        <li>
          <%= link_to organisation_changelog_path(organisation_id: current_organisation.id), class: 'flex items-center gap-3 py-2 px-4 hover:bg-cream-200 text-sm' do %>
            <i class="bi bi-megaphone text-xs"></i>
            <%= changelog_nav_label(changelog_has_unread?(current_user)) %>
          <% end %>
        </li>
        <li>
          <%= link_to destroy_user_session_path, class: 'flex items-center gap-3 py-2 px-4 hover:bg-cream-200 text-sm', data: { turbo_method: :delete } do %>
            <i class="bi bi-box-arrow-right text-xs"></i>
            <%= t('navigation.logout') %>
          <% end %>
        </li>
      </ul>
    </div>
  </details>
<% end %>