Skip to content

Commit

Permalink
Issue feat: UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshataKatwal16 committed Nov 29, 2024
1 parent 106fa4c commit 006b93b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@
"PAGE_NOT_FOUND": "Page not found",
"ACCESS_DENIED": "Access Denied",
"YOU_DONT_HAVE_PERMISSION_TO_ACCESS_THIS_PAGE": "You don't have access to this page",
"RETURN_TO_LOGIN": "Return to Login"
"RETURN_TO_LOGIN": "Return to Login",
"COHORT_CODE_EXISTS": "Cohort code already exists"

},
"LOGIN_PAGE": {
Expand Down
25 changes: 18 additions & 7 deletions src/components/DeleteUserModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,18 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({
centers,
userId,
userName,
userType
userType,
}) => {
console.log(centers)
console.log(centers);
const { t } = useTranslation();
const theme = useTheme<any>();
const reasons = [
{ value: "Incorrect Data Entry", label: t("COMMON.INCORRECT_DATA_ENTRY") },
{ value: "Duplicated User", label: t("COMMON.DUPLICATED_USER") },
];
const [checkedCohortDeletion, setCheckedCohortDeletion] = useState<boolean>(centers === "-" ? true : false);
const [checkedCohortDeletion, setCheckedCohortDeletion] = useState<boolean>(
centers === "-" ? true : false
);

useEffect(() => {
if (centers === "-") {
Expand Down Expand Up @@ -89,7 +91,7 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({

return (
<CustomModal
width="25%"
width="25%"
open={open}
handleClose={handleClose}
title={t("COMMON.DELETE_USER")}
Expand All @@ -112,7 +114,11 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({
variant="body1"
sx={{ marginBottom: "12px", fontWeight: "bold", color: "#333" }}
>
{userType===Role.TEAM_LEADERS?t("COMMON.USER_BLOCK", { name: userName }): centers.split(', ').length===1 ? t("COMMON.USER_CENTER", { name: userName }) : t("COMMON.USER_CENTERS", { name: userName })}
{userType === Role.TEAM_LEADERS
? t("COMMON.USER_BLOCK", { name: userName })
: centers.split(", ").length === 1
? t("COMMON.USER_CENTER", { name: userName })
: t("COMMON.USER_CENTERS", { name: userName })}
</Typography>

<Box
Expand All @@ -137,8 +143,13 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({
color="primary"
/>
}
label={userType===Role.TEAM_LEADERS?t("COMMON.DELETE_FROM_BLOCK_WARNING"): centers.split(', ').length===1 ? t("COMMON.DELETE_FROM_CENTER_WARNING") : t("COMMON.DELETE_FROM_CENTERS_WARNING")}

label={
userType === Role.TEAM_LEADERS
? t("COMMON.DELETE_FROM_BLOCK_WARNING")
: centers.split(", ").length === 1
? t("COMMON.DELETE_FROM_CENTER_WARNING")
: t("COMMON.DELETE_FROM_CENTERS_WARNING")
}
sx={{ marginTop: "12px", color: "#555" }}
/>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/components/ReassignCenterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
setReassignAlertModal(true);
setAssignedTeamLeader(resp?.userDetails?.length);
setSelectedBlockForTL(checkedCenters[0]);
const userNames = resp?.userDetails?.map((user: any) => user.name);
const userNames = resp?.userDetails?.map((user: any) => firstLetterInUpperCase(user.name));

setSelectedTLUserID(userId);
setAssignedTeamLeaderNames(userNames);
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/components/SendCredentialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ const SendCredentialModal: React.FC<SendCredentialModalProps> = ({
<Box
p="18px"
display="flex"
justifyContent="space-between"
alignItems="center"
justifyContent="flex-end"
gap="8px"
alignItems="center"
>
{userType === Role.STUDENT ? (
<Button
Expand Down
5 changes: 3 additions & 2 deletions src/utils/useLocationState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useTranslation } from "react-i18next";
import { useQueryClient } from "@tanstack/react-query";
import { formatedBlocks, formatedDistricts } from "@/services/formatedCohorts";
import { cohortMemberList } from "@/services/UserList";
import { firstLetterInUpperCase} from "@/utils/Helper";
type FilterDetails = {
role: any;
status?: any;
Expand Down Expand Up @@ -206,8 +207,8 @@ export const useLocationState = (
// setcreateTLAlertModal(true)
setAssignedTeamLeader(resp?.userDetails?.length)
// setSelectedBlockForTL(selectedBlock[0])
const userNames = resp?.userDetails?.map((user: any )=> user.name);
//setSelectedTLUserID(userId)
const userNames = resp?.userDetails?.map((user: any) => firstLetterInUpperCase(user.name));
//setSelectedTLUserID(userId)
setAssignedTeamLeaderNames(userNames)
}
else{
Expand Down

0 comments on commit 006b93b

Please sign in to comment.