Skip to content

Commit

Permalink
Merge pull request #217 from Aar-if/main
Browse files Browse the repository at this point in the history
Issue #1817 feat: View course planner on admin app UI development
  • Loading branch information
itsvick authored Sep 18, 2024
2 parents baeaca3 + 7f79c86 commit cd62df8
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 135 deletions.
10 changes: 0 additions & 10 deletions src/components/layouts/sidebar/MenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ const Menuitems = [
title: "SIDEBAR.COURSE_PLANNER",
icon: coursePannerIcon,
href: "/course-planner",
subOptions: [
{
title: "SIDEBAR.FOUNDATION_COURSE",
href: "/course-planner",
},
// {
// title: "SIDEBAR.MAIN_COURSE",
// href: "/mainCourse",
// },
],
},
];

Expand Down
17 changes: 1 addition & 16 deletions src/pages/course-planner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,10 @@ const Foundation = () => {
return (
<ProtectedRoute>
<>
<FilterSearchBar
grade={grade}
medium={medium}
searchQuery={searchQuery}
handleGradeChange={handleGradeChange}
handleMediumChange={handleMediumChange}
handleSearchChange={handleSearchChange}
selectedOption={selectedOption}
handleDropdownChange={(event) => handleFilter(event.target.value)}
card={undefined}
selectFilter={selectFilter}
onBackClick={undefined}
/>

{loading ? (
<Loader showBackdrop={true} loadingText={t("COMMON.LOADING")} />
) : (
<Box sx={{ pl: "20px" }}>
<Box sx={{ pl: "20px", mt: 5 }}>
{/* <Box
sx={{
display: "grid",
Expand Down Expand Up @@ -242,7 +228,6 @@ const Foundation = () => {
}}
sx={{ minWidth: "auto", padding: 0 }}
>
<InsertLinkOutlinedIcon />
</Button>
</Box>
</Box>
Expand Down
68 changes: 21 additions & 47 deletions src/pages/importCsv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,9 @@ const ImportCsv = () => {
const userProjectDetailsResponse = await getUserProjectDetails({
id: courseId,
});
setUserProjectDetails(userProjectDetailsResponse.result.tasks);
setUserProjectDetails(userProjectDetailsResponse?.result?.tasks);
if (userProjectDetails?.length) {
const totalChildren = userProjectDetails.reduce(
(acc: number, project: any) => {
return acc + (project?.children?.length || 0);
},
0
);

if (totalChildren !== subTopics) {
setSubTopics(totalChildren);
}

}
setLoading(false);
} catch (error) {
Expand Down Expand Up @@ -313,6 +304,17 @@ const ImportCsv = () => {
});
};

const totalChildren = userProjectDetails?.reduce(
(acc: number, project: any) => {
return acc + (project?.children?.length || 0);
},
0
);

if (totalChildren !== subTopics) {
setSubTopics(totalChildren);
}

return (
<Box sx={{ padding: isSmallScreen ? "16px" : "32px" }}>
<Box
Expand All @@ -329,8 +331,8 @@ const ImportCsv = () => {
<IconButton onClick={handleBackClick}>
<ArrowBackIcon />
</IconButton>
<Typography variant={isSmallScreen ? "h5" : "h4"}>
{subjectDetails?.subject}
<Typography variant={isSmallScreen ? "h5" : "h2"}>
{tstore.taxonomySubject}
</Typography>
</Box>
<Box sx={{ display: "flex", alignItems: "center", gap: "16px" }}>
Expand Down Expand Up @@ -375,27 +377,11 @@ const ImportCsv = () => {
}}
onClick={handleCopyLink}
>
<AttachmentIcon />
{/* <AttachmentIcon /> */}
</Button>
</Box>
</Box>

<FilterSearchBar
grade=""
medium=""
searchQuery=""
handleGradeChange={() => {}}
handleMediumChange={() => {}}
handleSearchChange={() => {}}
selectedOption=""
handleDropdownChange={() => {}}
card={undefined}
selectFilter={undefined}
onBackClick={() => {}}
showGradeMedium={false}
showFoundaitonCourse={false}
/>

<Box>
{loading ? (
<Loader showBackdrop={true} loadingText={t("COMMON.LOADING")} />
Expand Down Expand Up @@ -479,7 +465,7 @@ const ImportCsv = () => {
sx={{
display: "flex",
gap: "10px",
alignItems: "center",
alignItems: "center",
}}
>
<Typography
Expand All @@ -505,7 +491,7 @@ const ImportCsv = () => {
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
padding: "10px 25px 0px 25px ",
padding: "10px 25px 0px 25px",
borderRadius: "8px",
}}
>
Expand All @@ -518,10 +504,8 @@ const ImportCsv = () => {
<Box sx={{ flex: 1, textAlign: "right" }}>
{t("COURSE_PLANNER.DURATION/MONTH")}
</Box>
<Box sx={{ flex: 1, textAlign: "right" }}>
{t("COURSE_PLANNER.COPY_LINK")}
</Box>
</Box>

<AccordionDetails
sx={{
padding: "20px",
Expand All @@ -532,13 +516,13 @@ const ImportCsv = () => {
{topic.children.map((subTopic: any) => (
<Box
key={subTopic._id}
onClick={() => handleResources(subTopic) }
onClick={() => handleResources(subTopic)}
sx={{
border: `1px solid #E0E0E0`,
padding: "10px",
backgroundColor: "white",
marginBottom: "20px",
cursor: "pointer"
cursor: "pointer",
}}
>
<Box
Expand Down Expand Up @@ -606,16 +590,6 @@ const ImportCsv = () => {
)}
</Box>
</Box>
<Box
sx={{
flex: 1,
display: "flex",
justifyContent: "flex-end",
alignItems: "center",
}}
>
<LinkIcon />
</Box>
</Box>
</Box>
</Box>
Expand Down
57 changes: 7 additions & 50 deletions src/pages/stateDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const StateDetails = () => {

const channel = store?.boards;
setBoards(channel);

localStorage.removeItem("overallCommonSubjects")
setLoading(false);
}, 1000);
};
Expand Down Expand Up @@ -107,38 +107,16 @@ const StateDetails = () => {

return (
<Box>
<FilterSearchBar
grade={grade}
medium={medium}
searchQuery={searchQuery}
handleGradeChange={handleGradeChange}
handleMediumChange={handleMediumChange}
handleSearchChange={handleSearchChange}
selectedOption={selectedOption}
handleDropdownChange={handleDropdownChange}
card={undefined}
selectFilter={""}
onBackClick={() => {}}
/>
<Box sx={{ display: "flex", alignItems: "center", gap: 2, mb: 2 }}>

<Box sx={{ display: "flex", alignItems: "center", gap: 2, mb: 2, mt: 2 }}>
<IconButton onClick={handleBackClick}>
<ArrowBackIcon />
</IconButton>
<Typography variant="h2">{card.state}</Typography>
<Box sx={{ display: "flex", gap: 3, alignItems: "center" }}>
<CustomStepper completedSteps={card.boardsUploaded} />
<Typography
sx={{
fontSize: isSmallScreen ? "12px" : "14px",
color: "#7C766F",
}}
>
({card.boardsUploaded}/{card.totalBoards}
{t("COURSE_PLANNER.BOARDS_FULLY_UPLOADED")})
</Typography>
</Box>
</Box>
<Grid spacing={2} container sx={{ marginTop: "16px" }}>
<Grid spacing={2} container sx={{ marginTop: "16px", ml: 2 }}>
{boards.map((board: any, index: number) => (
<Grid item xs={12} md={4} key={index}>
<Box
Expand Down Expand Up @@ -173,29 +151,8 @@ const StateDetails = () => {
{board?.name}
</Typography>
</Box>
<Box
sx={{
display: "flex",
alignItems: "center",
gap: "16px",
}}
>
<Box sx={{ width: "40px", height: "40px" }}>
<CircularProgressbar
value={(card.boardsUploaded / card.totalBoards) * 100}
strokeWidth={10}
styles={buildStyles({
pathColor: "#06A816",
trailColor: "#E6E6E6",
strokeLinecap: "round",
})}
/>
</Box>
<Typography sx={{ fontSize: "14px" }}>
{card.boardsUploaded} / {card.totalBoards}{" "}
{t("COURSE_PLANNER.SUBJECTS_UPLOADED")}
</Typography>
</Box>


</Box>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<Button
Expand All @@ -205,7 +162,7 @@ const StateDetails = () => {
}}
sx={{ minWidth: "auto", padding: 0 }}
>
<InsertLinkOutlinedIcon />

</Button>
</Box>
</Box>
Expand Down
Loading

0 comments on commit cd62df8

Please sign in to comment.