| 1 | <% content_for :title, "Commits · #{@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 | <% if @repository.description.present? %> |
| 18 | <p class="text-sm text-gray-400 mb-4"><%= @repository.description %></p> |
| 19 | <% end %> |
| 20 | |
| 21 | <div class="flex items-center gap-0 -mb-px"> |
| 22 | <%= link_to repository_path(@owner.username, @repository.name), |
| 23 | class: "tab-item flex items-center gap-1.5" do %> |
| 24 | <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor"> |
| 25 | <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"/> |
| 26 | </svg> |
| 27 | Code |
| 28 | <% end %> |
| 29 | <div class="tab-item active flex items-center gap-1.5"> |
| 30 | <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor"> |
| 31 | <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"/> |
| 32 | </svg> |
| 33 | Commits |
| 34 | <span class="badge-gray text-xs"><%= number_with_delimiter(@total) %></span> |
| 35 | </div> |
| 36 | <%= link_to repository_pull_requests_path(@owner.username, @repository.name), |
| 37 | class: "tab-item flex items-center gap-1.5" do %> |
| 38 | <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor"> |
| 39 | <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"/> |
| 40 | </svg> |
| 41 | Pulls |
| 42 | <% if @repository.open_pull_requests_count > 0 %> |
| 43 | <span class="badge-gray text-xs"><%= number_with_delimiter(@repository.open_pull_requests_count) %></span> |
| 44 | <% end %> |
| 45 | <% end %> |
| 46 | <%= link_to repository_cicd_path(@owner.username, @repository.name), |
| 47 | class: "tab-item flex items-center gap-1.5" do %> |
| 48 | <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor"> |
| 49 | <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"/> |
| 50 | </svg> |
| 51 | CI/CD |
| 52 | <% if @commit_count&.> 0 %> |
| 53 | <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span> |
| 54 | <% end %> |
| 55 | <% end %> |
| 56 | </div> |
| 57 | </div> |
| 58 | </div> |
| 59 | |
| 60 | <div class="max-w-6xl mx-auto px-4 sm:px-6 py-6"> |
| 61 | <div class="card rounded-b-none border-b-0 px-4 py-2.5 flex items-center gap-3 bg-surface-600"> |
| 62 | <%= render "shared/branch_switcher", |
| 63 | branches: @branches, |
| 64 | current_branch: @branch, |
| 65 | branch_url: ->(b) { repository_commits_path(@owner.username, @repository.name, b) } %> |
| 66 | </div> |
| 67 | |
| 68 | <div class="card rounded-t-none"> |
| 69 | <% @commits.each do |commit| %> |
| 70 | <div class="commit-row"> |
| 71 | <div class="min-w-0 flex-1"> |
| 72 | <p class="text-sm font-medium text-gray-100 truncate"> |
| 73 | <%= link_to commit[:subject], |
| 74 | repository_commit_path(@owner.username, @repository.name, commit[:sha]), |
| 75 | class: "hover:text-brand-500" %> |
| 76 | </p> |
| 77 | <p class="text-xs text-gray-400 mt-0.5"> |
| 78 | <span class="font-medium"><%= commit[:author_name] %></span> |
| 79 | committed <%= time_ago_in_words(commit[:authored_date]) %> ago |
| 80 | </p> |
| 81 | </div> |
| 82 | <div class="shrink-0 ml-4 flex items-center gap-3"> |
| 83 | <%= link_to commit[:short_sha], |
| 84 | repository_commit_path(@owner.username, @repository.name, commit[:sha]), |
| 85 | class: "font-mono text-xs badge-gray hover:bg-surface-500" %> |
| 86 | </div> |
| 87 | </div> |
| 88 | <% end %> |
| 89 | |
| 90 | <% if @commits.empty? %> |
| 91 | <div class="px-4 py-12 text-center text-sm text-gray-400">No commits yet.</div> |
| 92 | <% end %> |
| 93 | </div> |
| 94 | |
| 95 | <!-- Pagination --> |
| 96 | <% if @total_pages > 1 %> |
| 97 | <div class="mt-6 flex items-center justify-center gap-2"> |
| 98 | <% if @page > 1 %> |
| 99 | <%= link_to "← Newer", repository_commits_path(@owner.username, @repository.name, @branch, page: @page - 1), |
| 100 | class: "btn-secondary text-xs" %> |
| 101 | <% end %> |
| 102 | <span class="text-xs text-gray-400">Page <%= @page %> of <%= @total_pages %></span> |
| 103 | <% if @page < @total_pages %> |
| 104 | <%= link_to "Older →", repository_commits_path(@owner.username, @repository.name, @branch, page: @page + 1), |
| 105 | class: "btn-secondary text-xs" %> |
| 106 | <% end %> |
| 107 | </div> |
| 108 | <% end %> |
| 109 | </div> |