From e8ef542cb6628e63824783a667b17387e2333c23 Mon Sep 17 00:00:00 2001 From: pedrofp4444 Date: Thu, 9 Mar 2023 20:03:53 +0000 Subject: [PATCH 1/7] Add listing response from bokken --- apps/app/pages/index.tsx | 156 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 5 deletions(-) diff --git a/apps/app/pages/index.tsx b/apps/app/pages/index.tsx index 0847432b..fa8ffcc0 100644 --- a/apps/app/pages/index.tsx +++ b/apps/app/pages/index.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { Button, Col, Popconfirm, Row, Typography } from "antd"; +import { Button, Col, Modal, Popconfirm, Row, Typography } from "antd"; import { useAuth } from "@coderdojobraga/ui"; import { withAuth } from "~/components/Auth/withAuth"; import AppLayout from "~/layouts/AppLayout"; @@ -21,6 +21,12 @@ function Dashboard() { const [ninjas, setNinjas] = useState([]); const { data: events, isLoading: isLoadingEvents } = useEvents(); const { data: badges, isLoading: isLoadingBadges } = useBadges(); + const [emails_sucess, setEmails_sucess] = useState([]); + const [emails_fail, setEmails_fail] = useState([]); + const [visible_signup, setVisible_signup] = useState(false); + const [visible_selected, setVisible_selected] = useState(false); + const [confirmed_signup, setConfirmed_signup] = useState(false); + const [confirmed_selected, setConfirmed_selected] = useState(false); const nextEvent = () => { const cur = moment(); @@ -34,9 +40,20 @@ function Dashboard() { return sorted_events[0] != undefined ? sorted_events[0] : false; }; + const handleCloseModal_signup = () => { + setVisible_signup(false); + }; + + const handleCloseModal_selected = () => { + setVisible_selected(false); + }; + const notify_signup_ninjas = () => { notify_signup() - .then(() => { + .then((response) => { + setEmails_sucess(response.success); + setEmails_fail(response.fail); + setVisible_signup(true); notifyInfo("Enviado com sucesso!"); }) .catch((error) => { @@ -46,7 +63,10 @@ function Dashboard() { const notify_selected_ninjas = () => { notify_selected() - .then(() => { + .then((response) => { + setEmails_sucess(response.success); + setEmails_fail(response.fail); + setVisible_selected(true); notifyInfo("Enviado com sucesso!"); }) .catch((error) => { @@ -79,8 +99,71 @@ function Dashboard() { title="Tens a certeza que queres notificar?" cancelText="Não" okText="Sim" - onConfirm={(_) => notify_signup_ninjas()} + onConfirm={(_) => { + notify_signup_ninjas(); + setConfirmed_signup(true); + }} + disabled={confirmed_signup} > + + Close + , + ]} + > +
+
+
+ +
+
    + {emails_sucess.map((email, index) => ( +
  • {email}
  • + ))} +
+
+
+
+ +
+
    + {emails_fail.map((email, index) => ( +
  • {email}
  • + ))} +
+
+
+
) : ( @@ -93,8 +176,71 @@ function Dashboard() { title="Tens a certeza que queres notificar?" cancelText="Não" okText="Sim" - onConfirm={(_) => notify_selected_ninjas()} + onConfirm={(_) => { + notify_selected_ninjas(); + setConfirmed_selected(true); + }} + disabled={confirmed_selected} > + + Close + , + ]} + > +
+
+
+ +
+
    + {emails_sucess.map((email, index) => ( +
  • {email}
  • + ))} +
+
+
+
+ +
+
    + {emails_fail.map((email, index) => ( +
  • {email}
  • + ))} +
+
+
+
) : ( From 70c73c59313a36dd37331e65a2832d50b81da780 Mon Sep 17 00:00:00 2001 From: pedrofp4444 Date: Sat, 11 Mar 2023 12:53:36 +0000 Subject: [PATCH 2/7] Add ant.design buttons --- apps/app/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app/pages/index.tsx b/apps/app/pages/index.tsx index fa8ffcc0..8eb75340 100644 --- a/apps/app/pages/index.tsx +++ b/apps/app/pages/index.tsx @@ -154,7 +154,7 @@ function Dashboard() {
- +