diff --git a/frontend/src/components/matches/MatchCard.jsx b/frontend/src/components/matches/MatchCard.jsx new file mode 100644 index 0000000..5c4223f --- /dev/null +++ b/frontend/src/components/matches/MatchCard.jsx @@ -0,0 +1,118 @@ +import { Link } from 'react-router-dom'; +import { MessageCircle, Check, X, Loader2, Calendar, MapPin } from 'lucide-react'; + +/** + * Match card for matches list page + * Shows match details with accept/reject/chat actions + */ +const MatchCard = ({ match, onAccept, onReject, onOpenChat, processing }) => { + const isIncoming = !match.isInitiator && match.status === 'pending'; + const isOutgoing = match.isInitiator && match.status === 'pending'; + const isAccepted = match.status === 'accepted'; + + return ( +
+
+
+
+ + {match.partner.username} + +
+ +

+ {match.partner.firstName && match.partner.lastName + ? `${match.partner.firstName} ${match.partner.lastName}` + : match.partner.username} +

+ +

@{match.partner.username}

+
+
+ +
+
+ + {match.event.name} +
+
+ + {match.event.location} +
+
+ +
+ {isIncoming && ( + + Incoming Request + + )} + {isOutgoing && ( + + Sent Request + + )} + {isAccepted && ( + + Active Match + + )} +
+
+ +
+ {isIncoming && ( + <> + + + + )} + + {isOutgoing && ( + + )} + + {isAccepted && ( + + )} +
+
+
+ ); +}; + +export default MatchCard; diff --git a/frontend/src/components/matches/index.js b/frontend/src/components/matches/index.js new file mode 100644 index 0000000..ab331b7 --- /dev/null +++ b/frontend/src/components/matches/index.js @@ -0,0 +1 @@ +export { default as MatchCard } from './MatchCard'; diff --git a/frontend/src/pages/MatchesPage.jsx b/frontend/src/pages/MatchesPage.jsx index 189a200..8b4d0e3 100644 --- a/frontend/src/pages/MatchesPage.jsx +++ b/frontend/src/pages/MatchesPage.jsx @@ -1,10 +1,11 @@ import { useState, useEffect } from 'react'; -import { useNavigate, Link } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import Layout from '../components/layout/Layout'; import { useAuth } from '../contexts/AuthContext'; import { matchesAPI } from '../services/api'; -import { MessageCircle, Check, X, Loader2, Users, Calendar, MapPin } from 'lucide-react'; +import { Loader2, Users } from 'lucide-react'; import { connectSocket, disconnectSocket, getSocket } from '../services/socket'; +import { MatchCard } from '../components/matches'; const MatchesPage = () => { const { user } = useAuth(); @@ -236,114 +237,4 @@ const MatchesPage = () => { ); }; -const MatchCard = ({ match, onAccept, onReject, onOpenChat, processing }) => { - const isIncoming = !match.isInitiator && match.status === 'pending'; - const isOutgoing = match.isInitiator && match.status === 'pending'; - const isAccepted = match.status === 'accepted'; - - return ( -
-
-
-
- - {match.partner.username} - -
- -

- {match.partner.firstName && match.partner.lastName - ? `${match.partner.firstName} ${match.partner.lastName}` - : match.partner.username} -

- -

@{match.partner.username}

-
-
- -
-
- - {match.event.name} -
-
- - {match.event.location} -
-
- -
- {isIncoming && ( - - Incoming Request - - )} - {isOutgoing && ( - - Sent Request - - )} - {isAccepted && ( - - Active Match - - )} -
-
- -
- {isIncoming && ( - <> - - - - )} - - {isOutgoing && ( - - )} - - {isAccepted && ( - - )} -
-
-
- ); -}; - export default MatchesPage;