native macOS codings agent orchestrator prowl.onev.cat
Something went wrong. Try again.
1.4 kB · 41 lines
Swift
123456789101112131415161718192021222324252627282930313233343536373839404142import SwiftUI
struct NotificationPopoverView: View { let notifications: [WorktreeTerminalNotification] let onFocusNotification: (WorktreeTerminalNotification) -> Void
var body: some View { let count = notifications.count let countLabel = count == 1 ? "notification" : "notifications" ScrollView { VStack(alignment: .leading) { Text("Notifications") .font(.headline) Text("\(count) \(countLabel)") .font(.subheadline) .foregroundStyle(.secondary) Divider() ForEach(notifications) { notification in Button { onFocusNotification(notification) } label: { HStack(alignment: .top) { Image(systemName: "bell") .foregroundStyle(notification.isRead ? Color.secondary : Color.orange) .accessibilityHidden(true) Text(notification.content) .foregroundStyle(notification.isRead ? Color.secondary : Color.primary) .lineLimit(2) } .frame(maxWidth: .infinity, alignment: .leading) } .buttonStyle(.plain) .font(.caption) .help(notification.content.isEmpty ? String(localized: "Focus pane") : notification.content) } } .padding() } .frame(minWidth: 260, maxWidth: 480, maxHeight: 400) }}