blob: 6f40b571f84c659ca2992f82aa66f6ab3b51c32a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import SwiftUI
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) {
Text(commit.title)
.font(.subheadline)
.lineLimit(1)
HStack(spacing: 8) {
Text(commit.shortId)
.font(.caption.monospaced())
.foregroundStyle(.secondary)
Text(commit.author.name)
.font(.caption)
.foregroundStyle(.secondary)
Spacer()
Text(commit.author.time.relativeDescription)
.font(.caption)
.foregroundStyle(.tertiary)
}
}
.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 {
appState.copyToPasteboard(commit.id, label: "commit SHA")
} label: {
Label("Copy Full SHA", systemImage: "doc.on.doc")
}
Button {
appState.copyToPasteboard(commit.shortId, label: "short commit SHA")
} label: {
Label("Copy Short SHA", systemImage: "doc.on.doc.fill")
}
}
}
}
|