summaryrefslogtreecommitdiff
path: root/Hutch/Views/Repositories/CommitRowView.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/CommitRowView.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/CommitRowView.swift')
-rw-r--r--Hutch/Views/Repositories/CommitRowView.swift17
1 files changed, 14 insertions, 3 deletions
diff --git a/Hutch/Views/Repositories/CommitRowView.swift b/Hutch/Views/Repositories/CommitRowView.swift
index 362ab4d..6f40b57 100644
--- a/Hutch/Views/Repositories/CommitRowView.swift
+++ b/Hutch/Views/Repositories/CommitRowView.swift
@@ -1,8 +1,11 @@
import SwiftUI
-import UIKit
struct CommitRowView: View {
+ @Environment(AppState.self) private var appState
+ @Environment(\.openURL) private var openURL
+
let commit: CommitSummary
+ let repository: RepositorySummary
var body: some View {
VStack(alignment: .leading, spacing: 4) {
@@ -28,14 +31,22 @@ struct CommitRowView: View {
}
.padding(.vertical, 2)
.contextMenu {
+ if let url = SRHTWebURL.commit(repository: repository, commitId: commit.id) {
+ Button {
+ openURL(url)
+ } label: {
+ Label("Open in Browser", systemImage: "safari")
+ }
+ }
+
Button {
- UIPasteboard.general.string = commit.id
+ appState.copyToPasteboard(commit.id, label: "commit SHA")
} label: {
Label("Copy Full SHA", systemImage: "doc.on.doc")
}
Button {
- UIPasteboard.general.string = commit.shortId
+ appState.copyToPasteboard(commit.shortId, label: "short commit SHA")
} label: {
Label("Copy Short SHA", systemImage: "doc.on.doc.fill")
}