summaryrefslogtreecommitdiff
path: root/Hutch/Views/Repositories/CommitDetailView.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
committerChristian Cleberg <[email protected]>2026-04-13 09:57:23 -0500
commit0e461a382257979037e8927e5f6b468635b0a7fe (patch)
tree0aa3a19f6f8f966b0e90f4874ed54359a7898107 /Hutch/Views/Repositories/CommitDetailView.swift
parentee9f2904aa319231b7047fca3cb069f0c07019cd (diff)
downloadhutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.gz
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.bz2
hutch-0e461a382257979037e8927e5f6b468635b0a7fe.zip
feat: add power user actions
Implements: https://todo.sr.ht/~ccleberg/hutch/52 Implements: https://todo.sr.ht/~ccleberg/hutch/53 Implements: https://todo.sr.ht/~ccleberg/hutch/54
Diffstat (limited to 'Hutch/Views/Repositories/CommitDetailView.swift')
-rw-r--r--Hutch/Views/Repositories/CommitDetailView.swift36
1 files changed, 34 insertions, 2 deletions
diff --git a/Hutch/Views/Repositories/CommitDetailView.swift b/Hutch/Views/Repositories/CommitDetailView.swift
index d303542..1dcbf68 100644
--- a/Hutch/Views/Repositories/CommitDetailView.swift
+++ b/Hutch/Views/Repositories/CommitDetailView.swift
@@ -5,6 +5,7 @@ struct CommitDetailView: View {
let repository: RepositorySummary
@Environment(AppState.self) private var appState
+ @Environment(\.openURL) private var openURL
@State private var viewModel: CommitDetailViewModel?
var body: some View {
@@ -18,7 +19,38 @@ struct CommitDetailView: View {
.navigationTitle(commitSummary.shortId)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
- ToolbarItem(placement: .topBarTrailing) {
+ ToolbarItemGroup(placement: .topBarTrailing) {
+ Menu {
+ if let commitURL = SRHTWebURL.commit(repository: repository, commitId: commitSummary.id) {
+ Button {
+ openURL(commitURL)
+ } label: {
+ Label("Open in Browser", systemImage: "safari")
+ }
+
+ Button {
+ appState.copyToPasteboard(commitURL.absoluteString, label: "commit URL")
+ } label: {
+ Label("Copy URL", systemImage: "doc.on.doc")
+ }
+ }
+
+ Button {
+ appState.copyToPasteboard(commitSummary.id, label: "commit SHA")
+ } label: {
+ Label("Copy Full SHA", systemImage: "doc.on.doc")
+ }
+
+ Button {
+ appState.copyToPasteboard(commitSummary.shortId, label: "short commit SHA")
+ } label: {
+ Label("Copy Short SHA", systemImage: "number")
+ }
+ } label: {
+ Image(systemName: "ellipsis.circle")
+ }
+ .accessibilityLabel("Commit actions")
+
SRHTShareButton(url: SRHTWebURL.commit(repository: repository, commitId: commitSummary.id), target: .commit) {
Image(systemName: "square.and.arrow.up")
}
@@ -109,7 +141,7 @@ struct CommitDetailView: View {
VStack(alignment: .leading, spacing: 8) {
// Full hash — tappable to copy
Button {
- UIPasteboard.general.string = commit.id
+ appState.copyToPasteboard(commit.id, label: "commit SHA")
} label: {
HStack(spacing: 4) {
Text(commit.id)