Commit 2ab41747b5

2ab41747b5f3fa2c72858d531b6b1dc07ddc2164

parent: 1d2287143b

Unsigned

cmc <hello@cleberg.net> · 2026-03-23 01:42 UTC

feat: context menus to copy clone URLs and commit SHAs

Layout: unified · split

Hutch/Views/Repositories/CommitRowView.swift +14
@@ -1,4 +1,5 @@
11import SwiftUI
2import UIKit
23
34struct CommitRowView: View {
45 let commit: CommitSummary
@@ -26,5 +27,18 @@ struct CommitRowView: View {
2627 }
2728 }
2829 .padding(.vertical, 2)
30 .contextMenu {
31 Button {
32 UIPasteboard.general.string = commit.id
33 } label: {
34 Label("Copy Full SHA", systemImage: "doc.on.doc")
35 }
36
37 Button {
38 UIPasteboard.general.string = commit.shortId
39 } label: {
40 Label("Copy Short SHA", systemImage: "doc.on.doc.fill")
41 }
42 }
2943 }
3044}
Hutch/Views/Repositories/RepositoryRowView.swift +27
@@ -1,4 +1,5 @@
11import SwiftUI
2import UIKit
23
34struct RepositoryRowView: View {
45 let repository: RepositorySummary
@@ -54,9 +55,35 @@ struct RepositoryRowView: View {
5455 }
5556 }
5657 .padding(.vertical, 2)
58 .contextMenu {
59 Button {
60 UIPasteboard.general.string = httpsCloneURL(for: repository)
61 } label: {
62 Label("Copy HTTPS URL", systemImage: "doc.on.doc")
63 }
64
65 Button {
66 UIPasteboard.general.string = sshCloneURL(for: repository)
67 } label: {
68 Label("Copy SSH URL", systemImage: "terminal")
69 }
70 }
5771 }
5872}
5973
74private func httpsCloneURL(for repository: RepositorySummary) -> String {
75 let host = "\(repository.service.rawValue).sr.ht"
76 let owner = repository.owner.canonicalName
77 return "https://\(host)/\(owner)/\(repository.name)"
78}
79
80private func sshCloneURL(for repository: RepositorySummary) -> String {
81 let host = "\(repository.service.rawValue).sr.ht"
82 let user = repository.service == .hg ? "hg" : "git"
83 let owner = repository.owner.canonicalName
84 return "\(user)@\(host):\(owner)/\(repository.name)"
85}
86
6087private struct RepositoryBuildStatusIndicator: View {
6188 let status: RepositoryBuildStatus
6289