From 78b89b15a07818992e71858317cb2e82360f5003 Mon Sep 17 00:00:00 2001 From: Marie Cynthia Abijuru Kamikazi <71440160+Cynthia-kam@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:24:15 +0200 Subject: [PATCH] fix:new cohort visibility (#326) Co-authored-by: Your Name --- .../admin-dashBoard/CreateCohortModal.tsx | 1 + src/pages/AdminTraineeDashboard.tsx | 131 ++++++++++-------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/containers/admin-dashBoard/CreateCohortModal.tsx b/src/containers/admin-dashBoard/CreateCohortModal.tsx index 773e8f898..8fc38e66b 100644 --- a/src/containers/admin-dashBoard/CreateCohortModal.tsx +++ b/src/containers/admin-dashBoard/CreateCohortModal.tsx @@ -109,6 +109,7 @@ export default function CreateCohortModal({ setValue('phaseName', { value: undefined, label: undefined }); toast.success(t('Cohort Created successful') as TFunction); + refetch(); }, }); } diff --git a/src/pages/AdminTraineeDashboard.tsx b/src/pages/AdminTraineeDashboard.tsx index 8533d1486..a910ad2fa 100644 --- a/src/pages/AdminTraineeDashboard.tsx +++ b/src/pages/AdminTraineeDashboard.tsx @@ -70,6 +70,7 @@ function AdminTraineeDashboard() { const [inviteEmail, setInviteEmail] = useState(''); const [buttonLoading, setButtonLoading] = useState(false); const [toggle, setToggle] = useState(false); + const [showOptions, setShowOptions] = useState(false); const options: any = []; const teamsOptions: any = []; const traineeOptions: any = []; @@ -250,69 +251,79 @@ function AdminTraineeDashboard() { accessor: '', Cell: ({ row }: any) => (
0 ? ' flex' : ' hidden' }`} > - { - setSelectedOptionUpdate({ - value: row.original.cohort, - label: row.original.cohort, - }); - setSelectedTeamOptionUpdate({ - value: row.original.team, - label: row.original.team, - }); - removeEditModel(); - setEditEmail(row.original.email); - setEditCohort(row.original.cohort); - setEditTeam(row.original.team); - }} - /> - { - removeTraineeMod(); - setDeleteEmail(row.original.email); - setDeleteFromCohort(row.original.team); - }} - /> - - { - dropModel(row.original.email); - setdropTraineeID(row.original.userId); - setReason(row.original.reason); - }} - /> - - handleClickOpen(row.original.email)} - /> + {showOptions ? ( + <> + { + setSelectedOptionUpdate({ + value: row.original.cohort, + label: row.original.cohort, + }); + setSelectedTeamOptionUpdate({ + value: row.original.team, + label: row.original.team, + }); + removeEditModel(); + setEditEmail(row.original.email); + setEditCohort(row.original.cohort); + setEditTeam(row.original.team); + }} + /> + { + removeTraineeMod(); + setDeleteEmail(row.original.email); + setDeleteFromCohort(row.original.team); + }} + /> + { + dropModel(row.original.email); + setdropTraineeID(row.original.userId); + setReason(row.original.reason); + }} + /> + handleClickOpen(row.original.email)} + /> + + ) : ( + setShowOptions(true)} + /> + )}
), },