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.

1.7 KB
Raw Blame
<%# Latest notifications, newest first. Each row links to its source and names who acted + where
    (actor · project) on a sub-line, so it is actionable rather than just "something happened".
    Unread rows carry a cobalt dot. Empty -> calm in-card line (the widget stays, slot never collapses). %>
<div>
  <%= render WidgetHeaderComponent.new(title: t('overview.widgets.recent_notifications')) %>
  <% if notifications.any? %>
    <ul class="divide-y divide-cream-200 border border-cream-300 rounded-lg bg-cream-50 overflow-hidden">
      <% notifications.each do |notification| %>
        <li>
          <%= link_to path_for(notification),
                class: "flex items-start gap-3 px-4 py-2.5 hover:bg-cream-100 transition-colors" do %>
            <span class="w-1.5 h-1.5 mt-1.5 rounded-full shrink-0 <%= notification.unread? ? 'bg-cobalt-600' : 'bg-cream-300' %>"
                  aria-hidden="true"></span>
            <div class="flex-1 min-w-0">
              <div class="flex items-baseline gap-2">
                <span class="flex-1 truncate text-sm text-cream-900"><%= title_for(notification) %></span>
                <span class="font-mono text-xs text-cream-500 shrink-0"><%= t('overview.notifications.time_ago', time: helpers.time_ago_in_words(notification.created_at)) %></span>
              </div>
              <% context = context_label(notification) %>
              <% if context.present? %>
                <div class="font-mono text-xs text-cream-500 truncate mt-0.5"><%= context %></div>
              <% end %>
            </div>
          <% end %>
        </li>
      <% end %>
    </ul>
  <% else %>
    <%= render WidgetEmptyComponent.new(message: t('overview.notifications.empty')) %>
  <% end %>
</div>