main
erb 43 lines 2.84 KB
Raw
1 <%# Renders one real activity-feed entry. Locals: item, profile_user %>
2 <li class="mb-8 ml-6">
3 <% case item[:kind] %>
4 <% when :pushed %>
5 <span class="absolute -left-3 flex h-6 w-6 items-center justify-center rounded-full border border-surface-500 bg-surface-700">
6 <svg class="w-3.5 h-3.5 text-brand-500" viewBox="0 0 16 16" fill="currentColor">
7 <path d="M1.643 3.143 .427 1.927A.25.25 0 0 0 0 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 0 0 .177-.427L2.715 4.215a6.5 6.5 0 1 1-1.18 4.458.75.75 0 1 0-1.493.154 8.001 8.001 0 1 0 1.6-5.684ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"/>
8 </svg>
9 </span>
10 <div class="card px-4 py-3">
11 <p class="text-xs text-gray-500 mb-2"><%= time_ago_in_words(item[:at]) %> ago</p>
12 <p class="text-sm mb-3">
13 <span class="text-gray-400">Pushed </span>
14 <span class="font-semibold text-gray-200"><%= pluralize(item[:commits].size, "commit") %></span>
15 <span class="text-gray-400"> to </span>
16 <%= link_to "@#{profile_user.username}/#{item[:repo].name}", repository_path(profile_user.username, item[:repo].name), class: "text-brand-500 hover:underline font-medium" %>
17 <span class="text-gray-400"> on </span>
18 <code class="bg-surface-600 px-1.5 py-0.5 rounded text-xs text-gray-200"><%= item[:repo].default_branch || "main" %></code>
19 </p>
20 <ul class="space-y-1.5 border-t border-surface-600 pt-3">
21 <% item[:commits].each do |commit| %>
22 <li class="flex items-start gap-2 text-xs text-gray-400">
23 <%= link_to commit[:short_sha], repository_commit_path(profile_user.username, item[:repo].name, commit[:sha]), class: "text-brand-400 shrink-0 font-mono hover:underline" %>
24 <span><%= commit[:subject] %></span>
25 </li>
26 <% end %>
27 </ul>
28 </div>
29 <% when :created_repo %>
30 <span class="absolute -left-3 flex h-6 w-6 items-center justify-center rounded-full border border-surface-500 bg-surface-700">
31 <svg class="w-3.5 h-3.5 text-gray-400" viewBox="0 0 16 16" fill="currentColor">
32 <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
33 </svg>
34 </span>
35 <div class="card px-4 py-3">
36 <p class="text-xs text-gray-500 mb-2"><%= time_ago_in_words(item[:at]) %> ago</p>
37 <p class="text-sm">
38 <span class="text-gray-400">Created <%= item[:repo].model? ? "model" : "repository" %> </span>
39 <%= link_to "@#{profile_user.username}/#{item[:repo].name}", repository_path(profile_user.username, item[:repo].name), class: "text-brand-500 hover:underline font-medium" %>
40 </p>
41 </div>
42 <% end %>
43 </li>