55 lines
2.4 KiB
Swift
55 lines
2.4 KiB
Swift
import SwiftUI
|
|
|
|
struct EdgeLeadSummaryView: View {
|
|
@State private var store = EdgeAppStore.shared
|
|
|
|
var body: some View {
|
|
EdgeShell(
|
|
title: "Lead Summary",
|
|
subtitle: "A compact executive view of the strongest live buyer signal."
|
|
) {
|
|
if let error = store.errorMessage {
|
|
EdgeErrorCard(message: error)
|
|
}
|
|
|
|
if store.isLoading && store.leads.isEmpty {
|
|
EdgeLoadingCard(message: "Fetching live leads.")
|
|
} else if let lead = store.selectedLead {
|
|
EdgeHeroCard(
|
|
title: lead.name,
|
|
subtitle: "\(lead.qualification.capitalized) intent with interest in \(lead.unitInterest).",
|
|
icon: "person.crop.circle.badge.checkmark"
|
|
) {
|
|
HStack(spacing: 8) {
|
|
EdgeStatusPill(label: "Score \(lead.score)", color: EdgeTheme.accent)
|
|
EdgeStatusPill(label: lead.budget, color: EdgeTheme.accentWarm)
|
|
}
|
|
}
|
|
|
|
EdgeCard(title: "Top lead") {
|
|
EdgeKeyValueRow(label: "Lead", value: lead.name)
|
|
EdgeKeyValueRow(label: "Qualification", value: lead.qualification.capitalized)
|
|
EdgeKeyValueRow(label: "Unit Interest", value: lead.unitInterest)
|
|
EdgeKeyValueRow(label: "Budget", value: lead.budget)
|
|
}
|
|
|
|
EdgeCard(title: "Top lead queue") {
|
|
ForEach(store.leads.sorted(by: { $0.score > $1.score }).prefix(5)) { item in
|
|
EdgeTimelineRow(
|
|
title: "\(item.name) · \(item.score)",
|
|
subtitle: "\(item.qualification.capitalized) · \(item.unitInterest) · \(item.budget)",
|
|
trailing: "Live",
|
|
tint: item.id == lead.id ? EdgeTheme.accent : EdgeTheme.accentWarm
|
|
)
|
|
}
|
|
}
|
|
} else {
|
|
EdgeEmptyCard(title: "Lead Summary", message: "No live leads are visible to this operator scope yet.")
|
|
}
|
|
}
|
|
.task { await store.refresh(screen: "lead_summary") }
|
|
.refreshable { await store.refresh(screen: "lead_summary") }
|
|
.edgeAutoRefresh(store: store, screen: "lead_summary")
|
|
}
|
|
}
|