From f12638d72348f8c1050651f408bd9952bc7db790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Rodrigues?= Date: Mon, 11 Mar 2024 15:51:02 +0000 Subject: [PATCH 1/3] feat: show maximum number of ninjas that can enroll on an event --- apps/app/components/Event/EventInfo.js | 36 +++++++++++++++++--------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/apps/app/components/Event/EventInfo.js b/apps/app/components/Event/EventInfo.js index 8dc4f641..5287f8cb 100644 --- a/apps/app/components/Event/EventInfo.js +++ b/apps/app/components/Event/EventInfo.js @@ -7,6 +7,7 @@ import { CloseCircleOutlined, EnvironmentOutlined, HomeOutlined, + TeamOutlined, } from "@ant-design/icons"; function EventInfo({ @@ -17,6 +18,7 @@ function EventInfo({ notes, enrollments_open, enrollments_close, + spots_available, breakpoints = { xs: 1, sm: 1, md: 1, lg: 1, xl: 1, xxl: 6 }, }) { const labelStyle = { color: "rgba(0, 0, 0, 0.45)", maxWidth: "30vw" }; @@ -47,6 +49,28 @@ function EventInfo({ day: "numeric", })} + + Notas + + } + span={5} + > + {notes} + + + Limite de Vagas + + } + span={2} + > + {spots_available} + - {team?.name} - - Notas - - } - span={5} - > - {notes} - Date: Wed, 13 Mar 2024 09:58:26 +0000 Subject: [PATCH 2/3] chore: implement suggestions --- apps/app/components/Event/EventInfo.js | 33 +++++++++++--------------- apps/app/components/Event/index.js | 3 ++- apps/app/pages/event/[id].tsx | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/apps/app/components/Event/EventInfo.js b/apps/app/components/Event/EventInfo.js index 5287f8cb..50bd47cf 100644 --- a/apps/app/components/Event/EventInfo.js +++ b/apps/app/components/Event/EventInfo.js @@ -11,22 +11,17 @@ import { } from "@ant-design/icons"; function EventInfo({ - start_time, - end_time, - location, - team, - notes, - enrollments_open, - enrollments_close, - spots_available, + 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 }; @@ -42,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", @@ -58,7 +53,7 @@ function EventInfo({ } span={5} > - {notes} + {event.notes} - {spots_available} + {enrolledNinjas} / {event.spots_available} - {location?.name} + {event.location?.name} - {new Date(start_time).toLocaleString("pt", { + {new Date(event.start_time).toLocaleString("pt", { hour: "numeric", minute: "numeric", })} @@ -105,7 +100,7 @@ function EventInfo({ } span={5} > - {new Date(end_time).toLocaleString("pt", { + {new Date(event.end_time).toLocaleString("pt", { hour: "numeric", minute: "numeric", })} @@ -119,7 +114,7 @@ function EventInfo({ } span={2} > - {team?.name} + {event.team?.name} - {new Date(enrollments_open).toLocaleDateString("pt", { + {new Date(event.enrollments_open).toLocaleDateString("pt", { year: "numeric", month: "long", day: "numeric", @@ -153,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/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} /> From d02c393991a1e393cf8203239acbc65c79969263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Rodrigues?= Date: Thu, 14 Mar 2024 14:45:34 +0000 Subject: [PATCH 3/3] fix: CI --- apps/app/pages/admin/event/[id].tsx | 1 + apps/app/pages/events.js | 2 +- apps/app/pages/index.tsx | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) 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/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) => ( - + ))}