import React, { useMemo } from 'react' import { useParams, Link } from 'react-router-dom' import { Helmet } from 'react-helmet-async' import ministries from '../data/ministries.json' import { useEvents } from '../hooks/useEvents' import LazyImage from '../components/LazyImage' export default function MinistryDetail() { const { slug } = useParams() const { events: eventItems } = useEvents() const ministry = ministries.find(x => x.slug === slug) const relatedEvents = useMemo(() => { if (!ministry) return [] const category = `${ministry.category || ''}`.toLowerCase() return eventItems .filter(event => { const title = `${event.title || ''}`.toLowerCase() const description = `${event.description || ''}`.toLowerCase() return title.includes(category) || description.includes(category) }) .slice(0, 3) }, [eventItems, ministry]) if (!ministry) { return (

Ministry Not Found

The ministry you're looking for doesn't exist.

Back to Ministries
) } return ( <> {ministry.name} - Annaville Seventh-day Adventist Church {/* Hero Section */}
{ministry.category}

{ministry.name}

{ministry.description}

�Y' {ministry.meeting}
�Y"? {ministry.where}
�Y'� {ministry.ages}
{/* Main Content */}
{/* What We Do */}

What We Do

{ministry.activities.map((activity, index) => (
�o" {activity}
))}
{/* Upcoming Events */} {relatedEvents.length > 0 && (

Upcoming Events

{relatedEvents.map(event => (

{event.title}

{event.date} - {event.time}

{event.description}

))}
)} {/* FAQ Section */}

Frequently Asked Questions

{ministry.faq.map((item, index) => (

{item.question}

�-�

{item.answer}

))}
{/* Sidebar */}
{/* Contact Information */}

Get Involved

Ministry Leader

{ministry.leader}

Meeting Details

{ministry.meeting}

{ministry.where}

{/* Quick Links */}

Quick Links

��? Back to All Ministries View All Events Plan Your Visit
{/* Related Ministries */}

Other Ministries

{ministries .filter(other => other.slug !== ministry.slug) .slice(0, 3) .map(other => (

{other.name}

{other.meeting}

))}
) }