~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/old-fella

Old people's social media app

0
1
main
38 lines · 1.2 KB Raw History
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()
        }
    }
}