diff --git a/apps/app/components/Event/EventInfo.js b/apps/app/components/Event/EventInfo.js index 8dc4f641..50bd47cf 100644 --- a/apps/app/components/Event/EventInfo.js +++ b/apps/app/components/Event/EventInfo.js @@ -7,24 +7,21 @@ import { CloseCircleOutlined, EnvironmentOutlined, HomeOutlined, + TeamOutlined, } from "@ant-design/icons"; function EventInfo({ - start_time, - end_time, - location, - team, - notes, - enrollments_open, - enrollments_close, + event, + enrolledNinjas, breakpoints = { xs: 1, sm: 1, md: 1, lg: 1, xl: 1, xxl: 6 }, }) { + enrolledNinjas = typeof enrolledNinjas !== "undefined" ? enrolledNinjas : 0; const labelStyle = { color: "rgba(0, 0, 0, 0.45)", maxWidth: "30vw" }; const timeForEnrollmentsClose = () => { - const enrollmentsClose = new Date(enrollments_close).getTime(); + const enrollmentsClose = new Date(event.enrollments_close).getTime(); const nowDate = new Date().getTime(); - const timeDiff = (enrollmentsClose - nowDate) / (1000 * 60 * 60 * 24); + const timeDiff = (event.enrollmentsClose - nowDate) / (1000 * 60 * 60 * 24); return timeDiff > 0 && timeDiff < 1; // Difference of less than a day }; @@ -40,7 +37,7 @@ function EventInfo({ } span={2} > - {new Date(start_time).toLocaleString("pt", { + {new Date(event.start_time).toLocaleString("pt", { weekday: "long", year: "numeric", month: "long", @@ -51,38 +48,45 @@ function EventInfo({ labelStyle={labelStyle} label={ - Localização + Notas } span={5} > - {location?.name} + {event.notes} - Início + Limite de Vagas } span={2} > - {new Date(start_time).toLocaleString("pt", { - hour: "numeric", - minute: "numeric", - })} + {enrolledNinjas} / {event.spots_available} - - Fim + Localização } span={5} > - {new Date(end_time).toLocaleString("pt", { + {event.location?.name} + + + Início + + } + span={2} + > + {new Date(event.start_time).toLocaleString("pt", { hour: "numeric", minute: "numeric", })} @@ -91,23 +95,26 @@ function EventInfo({ labelStyle={labelStyle} label={ - Turma + Fim } - span={2} + span={5} > - {team?.name} + {new Date(event.end_time).toLocaleString("pt", { + hour: "numeric", + minute: "numeric", + })} - Notas + Turma } - span={5} + span={2} > - {notes} + {event.team?.name} - {new Date(enrollments_open).toLocaleDateString("pt", { + {new Date(event.enrollments_open).toLocaleDateString("pt", { year: "numeric", month: "long", day: "numeric", @@ -141,7 +148,7 @@ function EventInfo({ } span={2} > - {new Date(enrollments_close).toLocaleDateString("pt", { + {new Date(event.enrollments_close).toLocaleDateString("pt", { year: "numeric", month: "long", day: "numeric", diff --git a/apps/app/components/Event/index.js b/apps/app/components/Event/index.js index 800734d6..e1808e0e 100644 --- a/apps/app/components/Event/index.js +++ b/apps/app/components/Event/index.js @@ -17,6 +17,7 @@ const Event = ({ collapsed = true, details = false, isLoading = false, + enrolledNinjas, }) => { const { user } = useAuth(); const role = user?.role; @@ -119,7 +120,7 @@ const Event = ({ ) : ( - + )} {role === EUser.Organizer ? ( <> diff --git a/apps/app/pages/admin/event/[id].tsx b/apps/app/pages/admin/event/[id].tsx index 4f3787b4..dabb592d 100644 --- a/apps/app/pages/admin/event/[id].tsx +++ b/apps/app/pages/admin/event/[id].tsx @@ -56,6 +56,7 @@ function EventPage() { collapsed={false} details={true} isLoading={isLoading} + enrolledNinjas={0} /> diff --git a/apps/app/pages/event/[id].tsx b/apps/app/pages/event/[id].tsx index cf0bf85b..9fea4ee3 100644 --- a/apps/app/pages/event/[id].tsx +++ b/apps/app/pages/event/[id].tsx @@ -213,7 +213,6 @@ function EventPage() { registerMentorOnEvent(value); } }; - return ( Detalhes do evento @@ -223,6 +222,7 @@ function EventPage() { collapsed={false} details={true} isLoading={isLoading} + enrolledNinjas={enrolledNinjas.length} /> diff --git a/apps/app/pages/events.js b/apps/app/pages/events.js index dbc3a19b..234d4592 100644 --- a/apps/app/pages/events.js +++ b/apps/app/pages/events.js @@ -17,7 +17,7 @@ function Events() { {events?.map((info) => ( - + ))} diff --git a/apps/app/pages/index.tsx b/apps/app/pages/index.tsx index a250c6e4..c6a67e47 100644 --- a/apps/app/pages/index.tsx +++ b/apps/app/pages/index.tsx @@ -110,6 +110,7 @@ function Dashboard() { event={nextEvent()} collapsed={false} isLoading={isLoadingEvents} + enrolledNinjas={0} /> ) : ( Aguarda que o próximo evento seja divulgado @@ -124,7 +125,11 @@ function Dashboard() { > {events?.slice(0, 3).map((event: any) => ( - + ))}