import React, { useState, useEffect } from 'react' import { likeAPI, API_BASE_URL } from '../api' import '../styles/matches.css' export default function Matches({ onNavigateToChat }) { const [matches, setMatches] = useState([]) const [isLoading, setIsLoading] = useState(true) const [error, setError] = useState('') useEffect(() => { loadMatches() }, []) const loadMatches = async () => { try { setIsLoading(true) const response = await likeAPI.getMatches() setMatches(response.data || []) } catch (err) { setError('Failed to load matches') } finally { setIsLoading(false) } } const handleStartChat = () => { onNavigateToChat() } if (isLoading) { return
Loading matches...
} if (matches.length === 0) { return (

No matches yet

Keep swiping to find your perfect match!

Discover more
) } return (

Your Matches

{error &&
{error}
}
{matches.map((match) => (
{match.photo && ( {match.display_name} )}

{match.display_name}

))}
) }