main
erb 104 lines 6.01 KB
Raw
1 <% content_for :title, "#{@current_path} · #{@repository.full_name}" %>
2 <%= render "shared/repository_social", repository: @repository %>
3
4 <div class="border-b border-surface-600 bg-surface-800">
5 <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
6
7 <div class="flex items-center gap-2 text-sm mb-3">
8 <%= link_to "@#{@owner.username}", user_profile_path(@owner.username),
9 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),
12 class: "text-brand-500 hover:underline font-semibold" %>
13 </div>
14
15 <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">
16 <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
17 class: "breadcrumb-item font-medium" %>
18 <span class="text-gray-500">/</span>
19 <% @path_parts.each_with_index do |part, i| %>
20 <% partial_path = @path_parts[0..i].join("/") %>
21 <% if i < @path_parts.length - 1 %>
22 <%= link_to part,
23 repository_tree_path(@owner.username, @repository.name, @branch, partial_path),
24 class: "breadcrumb-item" %>
25 <span class="text-gray-500">/</span>
26 <% else %>
27 <span class="font-medium text-gray-100"><%= part %></span>
28 <% end %>
29 <% end %>
30 </nav>
31
32 <div class="flex items-center gap-0 -mb-px">
33 <%= link_to repository_path(@owner.username, @repository.name),
34 class: "tab-item flex items-center gap-1.5" do %>
35 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
36 <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"/>
37 </svg>
38 Code
39 <% end %>
40 <%= link_to repository_commits_path(@owner.username, @repository.name, @branch),
41 class: "tab-item flex items-center gap-1.5" do %>
42 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
43 <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"/>
44 </svg>
45 Commits
46 <% end %>
47 <%= link_to repository_pull_requests_path(@owner.username, @repository.name),
48 class: "tab-item flex items-center gap-1.5" do %>
49 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
50 <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"/>
51 </svg>
52 Pulls
53 <% if @repository.open_pull_requests_count > 0 %>
54 <span class="badge-gray text-xs"><%= number_with_delimiter(@repository.open_pull_requests_count) %></span>
55 <% end %>
56 <% end %>
57 <%= link_to repository_cicd_path(@owner.username, @repository.name),
58 class: "tab-item flex items-center gap-1.5" do %>
59 <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
60 <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"/>
61 </svg>
62 CI/CD
63 <% if @commit_count&.> 0 %>
64 <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span>
65 <% end %>
66 <% end %>
67 </div>
68 </div>
69 </div>
70
71 <div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
72 <div class="card rounded-b-none border-b-0 px-4 py-2.5 flex items-center gap-3 bg-surface-600">
73 <%= render "shared/branch_switcher",
74 branches: @branches,
75 current_branch: @branch,
76 branch_url: ->(b) {
77 @current_path.present? ?
78 repository_tree_path(@owner.username, @repository.name, b, @current_path) :
79 repository_branch_path(@owner.username, @repository.name, b)
80 } %>
81 </div>
82
83 <div class="card rounded-t-none">
84 <% @tree.each do |entry| %>
85 <div class="file-row">
86 <% if entry[:type] == "tree" %>
87 <svg class="w-4 h-4 text-brand-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">
88 <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"/>
89 </svg>
90 <%= link_to entry[:name],
91 repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),
92 class: "text-brand-500 hover:underline font-medium flex-1" %>
93 <% else %>
94 <svg class="w-4 h-4 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor">
95 <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"/>
96 </svg>
97 <%= link_to entry[:name],
98 repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),
99 class: "text-gray-200 hover:text-brand-500 hover:underline flex-1" %>
100 <% end %>
101 </div>
102 <% end %>
103 </div>
104 </div>