diff --git a/backend/src/routes/events.js b/backend/src/routes/events.js index 9ad4dfe..d315896 100644 --- a/backend/src/routes/events.js +++ b/backend/src/routes/events.js @@ -19,7 +19,6 @@ router.get('/', authenticate, async (req, res, next) => { startDate: true, endDate: true, worldsdcId: true, - participantsCount: true, description: true, createdAt: true, participants: { @@ -30,6 +29,11 @@ router.get('/', authenticate, async (req, res, next) => { joinedAt: true, }, }, + _count: { + select: { + participants: true, + }, + }, }, }); @@ -42,7 +46,7 @@ router.get('/', authenticate, async (req, res, next) => { startDate: event.startDate, endDate: event.endDate, worldsdcId: event.worldsdcId, - participantsCount: event.participantsCount, + participantsCount: event._count.participants, description: event.description, createdAt: event.createdAt, isJoined: event.participants.length > 0, diff --git a/frontend/src/pages/EventsPage.jsx b/frontend/src/pages/EventsPage.jsx index 3b10d11..6d94a04 100644 --- a/frontend/src/pages/EventsPage.jsx +++ b/frontend/src/pages/EventsPage.jsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import Layout from '../components/layout/Layout'; import { eventsAPI } from '../services/api'; -import { Calendar, MapPin, Users, Loader2, CheckCircle } from 'lucide-react'; +import { Calendar, MapPin, Users, Loader2, CheckCircle, QrCode } from 'lucide-react'; const EventsPage = () => { const navigate = useNavigate(); @@ -101,12 +101,36 @@ const EventsPage = () => {

{event.description}

)} - +
+ {event.isJoined ? ( + + ) : ( +
+
+ + Check-in required +
+

+ Scan the QR code at the event venue to join the chat +

+
+ )} + + {/* Development mode: Show details link */} + {import.meta.env.DEV && ( + + )} +
))}