summaryrefslogtreecommitdiff
path: root/Hutch/Views/Inbox/InboxView.swift
blob: a4870dba53fb4e6e5c7b799c45fd8d7f3bf053fe (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
import SwiftUI

// Legacy wrapper kept temporarily so stale references continue to compile while
// the app transitions from Inbox to Work.
struct InboxView: View {
    var body: some View {
        WorkView()
    }
}

struct InboxThreadRow: View {
    let thread: InboxThreadSummary

    var body: some View {
        HStack(alignment: .top, spacing: 12) {
            Circle()
                .fill(thread.isUnread ? .blue : .clear)
                .frame(width: 8, height: 8)
                .padding(.top, 6)

            VStack(alignment: .leading, spacing: 4) {
                Text(thread.displaySubject)
                    .font(.subheadline.weight(thread.isUnread ? .semibold : .medium))
                    .lineLimit(2)

                HStack(spacing: 8) {
                    if thread.containsPatch {
                        Image(systemName: "arrow.triangle.branch")
                            .font(.caption)
                            .foregroundStyle(.secondary)
                    }

                    Text(thread.metadataLine)
                        .font(.caption)
                        .foregroundStyle(.secondary)
                        .lineLimit(1)
                }
            }

            Spacer(minLength: 8)

            Text(thread.lastActivityAt.relativeDescription)
                .font(.caption)
                .foregroundStyle(.tertiary.opacity(0.7))
                .lineLimit(1)
        }
        .padding(.vertical, 2)
    }
}