RTSDA-iOS/Views/Detail/EventDetailView+iPhone.swift
RTSDA 00679f927c docs: Update README for v2.0 release and fix git remote URL
- Comprehensive README update documenting v2.0 architectural changes
- Updated git remote to ssh://rockvilleav@git.rockvilletollandsda.church:10443/RTSDA/RTSDA-iOS.git
- Documented unified ChurchService and 60% code reduction
- Added new features: Home Feed, responsive reading, enhanced UI
- Corrected license information (GPL v3 with church content copyright)
- Updated build instructions and technical stack details
2025-08-16 18:41:51 -04:00

131 lines
5 KiB
Swift

import SwiftUI
struct EventDetailView: 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 {
ScrollView {
LazyVStack(alignment: .leading, spacing: 20) {
// Event Image
if let imageUrl = event.image {
AsyncImage(url: URL(string: imageUrl)) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxHeight: 200)
} placeholder: {
Rectangle()
.fill(LinearGradient(
colors: [Color.blue.opacity(0.6), Color.purple.opacity(0.8)],
startPoint: .topLeading,
endPoint: .bottomTrailing
))
.frame(height: 200)
}
.cornerRadius(12)
}
VStack(alignment: .leading, spacing: 16) {
// Title and Category
VStack(alignment: .leading, spacing: 8) {
if !event.category.isEmpty {
Text(event.category.uppercased())
.font(.caption)
.fontWeight(.bold)
.foregroundColor(.blue)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.background(Color.blue.opacity(0.1))
.cornerRadius(8)
}
Text(event.title)
.font(.largeTitle)
.fontWeight(.bold)
.lineLimit(nil)
Text(event.description)
.font(.body)
.foregroundColor(.secondary)
.lineLimit(nil)
}
Divider()
// Event Details
VStack(alignment: .leading, spacing: 12) {
HStack {
Image(systemName: "calendar")
.foregroundColor(.blue)
.frame(width: 20)
Text(event.formattedDate)
.font(.body)
}
HStack {
Image(systemName: "clock")
.foregroundColor(.blue)
.frame(width: 20)
Text(event.detailedTimeDisplay)
.font(.body)
}
if !event.location.isEmpty {
HStack {
Image(systemName: "location.fill")
.foregroundColor(.blue)
.frame(width: 20)
Text(event.location)
.font(.body)
.lineLimit(nil)
}
}
}
Divider()
// Action Buttons
EventActionButtons(
event: event,
showingDirections: $showingDirections,
showingShareSheet: $showingShareSheet,
showingCalendarAlert: $showingCalendarAlert,
calendarMessage: $calendarMessage,
style: .iphone
)
}
.padding(16)
.padding(.bottom, 100)
}
}
.ignoresSafeArea(.keyboard)
.navigationBarTitleDisplayMode(.inline)
.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 {
NavigationStack {
EventDetailView(event: ChurchEvent.sampleEvent())
}
}