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
import SwiftUI
struct NotificationActivityHeader<Label: View>: View {
let reason: FeedNotification.Reason
let date: Date
let isRead: Bool
@ViewBuilder let label: () -> Label
private var activityColor: Color {
switch reason {
case .like: AppPalette.accent
case .repost, .reply: AppPalette.reply
case .quote: AppPalette.quote
case .mention: AppPalette.mention
case .follow, .unknown: .secondary
}
}
var body: some View {
HStack(alignment: .firstTextBaseline, spacing: 6) {
Image(systemName: reason.symbol)
.font(.subheadline.weight(.medium))
.foregroundStyle(activityColor)
.accessibilityHidden(true)
label()
.appFont(.subheadline, weight: .semibold)
.foregroundStyle(activityColor)
.frame(maxWidth: .infinity, alignment: .leading)
if !isRead {
Circle()
.fill(.tint)
.frame(width: 8, height: 8)
.accessibilityLabel("Unread")
}
PostTimestamp(date: date).fixedSize()
}
}
}