Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: new cohort visibility w/o refreshing the page #326

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/containers/admin-dashBoard/CreateCohortModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default function CreateCohortModal({
setValue('phaseName', { value: undefined, label: undefined });

toast.success(t('Cohort Created successful') as TFunction);
refetch();
},
});
}
Expand Down
131 changes: 71 additions & 60 deletions src/pages/AdminTraineeDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -250,69 +251,79 @@ function AdminTraineeDashboard() {
accessor: '',
Cell: ({ row }: any) => (
<div
className={` items-center${
className={`items-center${
traineeData?.length > 0 ? ' flex' : ' hidden'
}`}
>
<Icon
icon="el:file-edit-alt"
className="mr-2"
width="25"
height="25"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
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);
}}
/>
<Icon
icon="mdi:close-circle-outline"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
removeTraineeMod();
setDeleteEmail(row.original.email);
setDeleteFromCohort(row.original.team);
}}
/>

<Icon
icon="mdi:close-circle"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
dropModel(row.original.email);
setdropTraineeID(row.original.userId);
setReason(row.original.reason);
}}
/>

<Icon
icon="flat-color-icons:view-details"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
onClick={() => handleClickOpen(row.original.email)}
/>
{showOptions ? (
<>
<Icon
icon="el:file-edit-alt"
className="mr-2"
width="25"
height="25"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
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);
}}
/>
<Icon
icon="mdi:close-circle-outline"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
removeTraineeMod();
setDeleteEmail(row.original.email);
setDeleteFromCohort(row.original.team);
}}
/>
<Icon
icon="mdi:close-circle"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
/* istanbul ignore next */
onClick={() => {
dropModel(row.original.email);
setdropTraineeID(row.original.userId);
setReason(row.original.reason);
}}
/>
<Icon
icon="flat-color-icons:view-details"
width="30"
height="30"
cursor="pointer"
color="#9e85f5"
onClick={() => handleClickOpen(row.original.email)}
/>
</>
) : (
<Icon
icon="entypo:dots-three-vertical"
width="30"
cursor="pointer"
color="#9e85f5"
onClick={() => setShowOptions(true)}
/>
)}
</div>
),
},
Expand Down
Loading