import SwiftUI struct iPadEventDetailView: View { let event: ChurchEvent @State private var showingDirections = false @State private var showingShareSheet = false @State private var showingCalendarAlert = false @State private var calendarMessage = "" @State private var shareText = "" var body: some View { VStack(spacing: 0) { // Hero Image Section - Full Width if let imageUrl = event.image { AsyncImage(url: URL(string: imageUrl)) { image in image .resizable() .aspectRatio(contentMode: .fit) .frame(maxHeight: 400) } placeholder: { Rectangle() .fill(LinearGradient( colors: [Color.blue.opacity(0.6), Color.purple.opacity(0.8)], startPoint: .topLeading, endPoint: .bottomTrailing )) .frame(height: 400) } } else { Rectangle() .fill(LinearGradient( colors: [Color.blue.opacity(0.6), Color.purple.opacity(0.8)], startPoint: .topLeading, endPoint: .bottomTrailing )) .frame(height: 400) } // Title Section - Below Image HStack { VStack(alignment: .leading, spacing: 16) { // Category Badge if !event.category.isEmpty { HStack(spacing: 8) { Image(systemName: "tag.fill") Text(event.category.uppercased()) .fontWeight(.bold) } .font(.subheadline) .foregroundColor(.white) .padding(.horizontal, 20) .padding(.vertical, 10) .background(Color(hex: "fb8b23"), in: Capsule()) } // Title Text(event.title) .font(.system(size: 42, weight: .bold, design: .serif)) .foregroundColor(.primary) .lineLimit(3) } Spacer() // Action Buttons EventActionButtons( event: event, showingDirections: $showingDirections, showingShareSheet: $showingShareSheet, showingCalendarAlert: $showingCalendarAlert, calendarMessage: $calendarMessage, style: .ipad ) } .padding(.horizontal, 40) .padding(.vertical, 32) .background(Color(.systemBackground)) // Simple Centered Content VStack(spacing: 32) { // Event Details Card - Compact and Centered VStack(alignment: .leading, spacing: 24) { HStack { Image(systemName: "calendar.circle.fill") .font(.title) .foregroundColor(.blue) VStack(alignment: .leading, spacing: 2) { Text(event.formattedDate) .font(.title2) .fontWeight(.bold) Text(event.detailedTimeDisplay) .font(.subheadline) .foregroundColor(.secondary) } Spacer() } if !event.location.isEmpty { HStack { Image(systemName: "location.circle.fill") .font(.title) .foregroundColor(.red) Text(event.location) .font(.title3) .fontWeight(.semibold) Spacer() } } if !event.description.isEmpty { Text(event.description) .font(.body) .lineSpacing(4) .padding(.top, 8) } // Registration/contact info removed since fields no longer exist in API } .padding(40) .frame(maxWidth: 600) .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 20)) } .frame(maxWidth: .infinity) .padding(.horizontal, 60) .padding(.bottom, 60) } .onAppear { shareText = EventDetailActions.createShareText(for: event) } .sheet(isPresented: $showingDirections) { Text("Directions to \(event.location)") } #if os(iOS) .sheet(isPresented: $showingShareSheet) { ShareSheet(activityItems: [shareText]) } #endif .alert("Calendar", isPresented: $showingCalendarAlert) { Button("OK") { } } message: { Text(calendarMessage) } } } #Preview { iPadEventDetailView(event: ChurchEvent.sampleEvent()) }