krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

v2.6.0: Hutch/Views/Repositories/CommitRowView.swift · raw

 1import SwiftUI
 2import UIKit
 3
 4struct CommitRowView: View {
 5    let commit: CommitSummary
 6
 7    var body: some View {
 8        VStack(alignment: .leading, spacing: 4) {
 9            Text(commit.title)
10                .font(.subheadline)
11                .lineLimit(1)
12
13            HStack(spacing: 8) {
14                Text(commit.shortId)
15                    .font(.caption.monospaced())
16                    .foregroundStyle(.secondary)
17
18                Text(commit.author.name)
19                    .font(.caption)
20                    .foregroundStyle(.secondary)
21
22                Spacer()
23
24                Text(commit.author.time.relativeDescription)
25                    .font(.caption)
26                    .foregroundStyle(.tertiary)
27            }
28        }
29        .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        }
43    }
44}