Skip to content

Commit

Permalink
Merge pull request #545 from shreyas1434shinde/YouthNet
Browse files Browse the repository at this point in the history
task #2787:- youth-net UI implementation
  • Loading branch information
itsvick authored Dec 23, 2024
2 parents 3e1d319 + 54e48f3 commit cb3db5d
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 25 deletions.
Binary file added src/assets/images/mp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/components/PlannedSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import WeekDays from './WeekDays';
import { getOptionsByCategory } from '@/utils/Helper';
import { telemetryFactory } from '@/utils/telemetry';
import { DesktopTimePicker } from '@mui/x-date-pickers/DesktopTimePicker';
import useNotification from '@/hooks/useNotification';

dayjs.extend(utc);
dayjs.extend(timezone);
Expand Down Expand Up @@ -810,6 +811,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
)
);
};
const { getNotification } = useNotification();

const handleAddSession = () => {
const newSessionId = sessionBlocks.length;
Expand Down Expand Up @@ -976,6 +978,34 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
'success'
);

if (cohortId) {
const filters = {
cohortId,
role: Role.STUDENT,
// status: [Status.ACTIVE],
};

try {
const response = await getMyCohortMemberList({
// limit: 20,
// page: 0,
filters,
});

if (response?.result?.userDetails) {
const deviceId = response?.result?.userDetails.map((device: any) => device?.deviceId).filter((id: any) => id !== null);
if (deviceId?.length > 0) {
getNotification(deviceId, "LEARNER_NEW_SESSION_ALERT");
} else {
console.warn("No valid device IDs found. Skipping notification API call.");
}
}
} catch (error) {
console.error("Error fetching cohort member list:", error);
}
}


const windowUrl = window.location.pathname;
const cleanedUrl = windowUrl.replace(/^\//, '');
const telemetryInteract = {
Expand Down
64 changes: 64 additions & 0 deletions src/components/youthNet/UploadedFile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react';
import { Box, Typography } from '@mui/material';
import { VillageDetailProps } from '@/utils/Interfaces';
import { useTheme } from '@mui/material/styles';
import Image from 'next/image';
import mp from './../../assets/images/mp.png'
import GetAppIcon from '@mui/icons-material/GetApp';




const UploadedFile: React.FC<VillageDetailProps> = ({
title,
}) => {
const theme = useTheme<any>();
return (
<Box
sx={{
border: `1px solid ${theme.palette.warning['A100']}`,
bgcolor: theme.palette.warning['800'],
padding: '12px',
margin: '100px',
borderRadius: '8px',
}}
>
<Box display="flex" justifyContent="space-between" alignItems="center">
<Box display="flex" gap="8px">

<Box>
<Image
src={mp}
alt="Login Image"
/>
</Box>

{title && (
<Typography
variant="subtitle1"
sx={{
fontWeight: 500,
lineHeight: '24px',
fontSize:'14px',
color: 'black',
}}
className="one-line-text"
>
{title}
</Typography>
)}

</Box>

<GetAppIcon
sx={{
fontSize: '20px',
color: theme.palette.warning['300']
}}
/>
</Box>
</Box>
);
};

export default UploadedFile;
25 changes: 0 additions & 25 deletions src/pages/centers/[cohortId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,32 +213,7 @@ const CohortPage = () => {
});


if (cohortId) {
const filters = {
cohortId,
role: Role.STUDENT,
// status: [Status.ACTIVE],
};

try {
const response = await getMyCohortMemberList({
// limit: 20,
// page: 0,
filters,
});

if (response?.result?.userDetails) {
const deviceId = response?.result?.userDetails.map((device: any) => device?.deviceId).filter((id:any) => id !== null);
if (deviceId?.length > 0) {
getNotification(deviceId, "LEARNER_NEW_SESSION_ALERT");
} else {
console.warn("No valid device IDs found. Skipping notification API call.");
}
}
} catch (error) {
console.error("Error fetching cohort member list:", error);
}
}
};

const handleCloseSchedule = () => {
Expand Down

0 comments on commit cb3db5d

Please sign in to comment.