main
erb 98 lines 5.7 KB
Raw
1 <% content_for :title, "Pull requests · #{@repository.full_name}" %>
2
3 <div class="border-b border-surface-600 bg-surface-800">
4 <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
5 <div class="flex items-center gap-2 text-sm mb-4">
6 <svg class="w-4 h-4 text-gray-500" viewBox="0 0 16 16" fill="currentColor">
7 <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"/>
8 </svg>
9 <%= link_to "@#{@owner.username}", user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
10 <span class="text-gray-500">/</span>
11 <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
12 <% if @repository.is_private %>
13 <span class="badge-gray ml-1">Private</span>
14 <% end %>
15 </div>
16
17 <div class="flex items-center gap-0 -mb-px">
18 <%= link_to repository_path(@owner.username, @repository.name),
19 class: "tab-item flex items-center gap-1.5" do %>
20 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
21 <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"/>
22 </svg>
23 Code
24 <% end %>
25 <% if @repository.initialized? %>
26 <%= link_to repository_commits_path(@owner.username, @repository.name, @repository.default_branch),
27 class: "tab-item flex items-center gap-1.5" do %>
28 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
29 <path d="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"/>
30 </svg>
31 Commits
32 <% end %>
33 <% end %>
34 <div class="tab-item active flex items-center gap-1.5">
35 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
36 <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM12 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/>
37 </svg>
38 Pulls
39 <% if @repository.open_pull_requests_count > 0 %>
40 <span class="badge-gray text-xs"><%= number_with_delimiter(@repository.open_pull_requests_count) %></span>
41 <% end %>
42 </div>
43 <%= link_to repository_cicd_path(@owner.username, @repository.name),
44 class: "tab-item flex items-center gap-1.5" do %>
45 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
46 <path d="M4.75 4.5C2.679 4.5 1 5.958 1 7.75S2.679 11 4.75 11c1.028 0 1.948-.36 2.75-1.242l.652-.716.696.672C10.023 10.849 10.956 11 11.25 11 13.321 11 15 9.542 15 7.75S13.321 4.5 11.25 4.5c-1.028 0-1.948.36-2.75 1.242l-.652.716-.696-.672C5.977 4.651 5.044 4.5 4.75 4.5Zm0 1.5c.483 0 .943.152 1.36.556l.562.541-.562.618C5.693 8.119 5.233 8.5 4.75 8.5c-1.241 0-2.25-.672-2.25-1.5S3.509 6 4.75 6Zm6.5 0c1.241 0 2.25.672 2.25 1.5S12.491 9 11.25 9c-.483 0-.943-.152-1.36-.556l-.562-.541.562-.618c.417-.404.877-.785 1.36-.785Z"/>
47 </svg>
48 CI/CD
49 <% end %>
50 </div>
51 </div>
52 </div>
53
54 <div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
55 <div class="flex items-center justify-between mb-4">
56 <div class="flex items-center gap-1 text-sm">
57 <% [["open", "Open", @open_count], ["closed", "Closed", @closed_count], ["merged", "Merged", @merged_count], ["all", "All", nil]].each do |state, label, count| %>
58 <%= link_to repository_pull_requests_path(@owner.username, @repository.name, state: state),
59 class: "px-3 py-1.5 rounded font-medium #{@state == state ? 'bg-surface-600 text-gray-100' : 'text-gray-400 hover:text-gray-200'}" do %>
60 <%= label %><% if count %> <span class="text-xs text-gray-500">(<%= count %>)</span><% end %>
61 <% end %>
62 <% end %>
63 </div>
64 <% if @repository.writable_by?(current_user) %>
65 <%= link_to "New pull request", new_repository_pull_request_path(@owner.username, @repository.name), class: "btn-primary" %>
66 <% end %>
67 </div>
68
69 <div class="card">
70 <% @pull_requests.each do |pr| %>
71 <div class="commit-row">
72 <div class="min-w-0 flex-1">
73 <p class="text-sm font-medium text-gray-100 truncate">
74 <%= link_to pr.title, repository_pull_request_path(@owner.username, @repository.name, pr.number), class: "hover:text-brand-500" %>
75 </p>
76 <p class="text-xs text-gray-400 mt-0.5">
77 #<%= pr.number %> opened by <span class="font-medium"><%= pr.author.username %></span>
78 &middot; <span class="font-mono"><%= pr.head_ref %></span> &rarr; <span class="font-mono"><%= pr.base_ref %></span>
79 </p>
80 </div>
81 <div class="shrink-0 ml-4">
82 <% case pr.state
83 when "open" %>
84 <span class="badge-green">Open</span>
85 <% when "merged" %>
86 <span class="badge-purple">Merged</span>
87 <% else %>
88 <span class="badge-red">Closed</span>
89 <% end %>
90 </div>
91 </div>
92 <% end %>
93
94 <% if @pull_requests.empty? %>
95 <div class="px-4 py-12 text-center text-sm text-gray-400">No pull requests here.</div>
96 <% end %>
97 </div>
98 </div>