Skip to content

Commit

Permalink
Merge pull request #271 from Aar-if/workspace
Browse files Browse the repository at this point in the history
Issue #1817 feat: View course planner on admin app UI development fixes
  • Loading branch information
itsvick authored Oct 22, 2024
2 parents f7d64a2 + dd8e0a6 commit 75ede28
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 85 deletions.
8 changes: 4 additions & 4 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ const nextConfig = {
return [
{
source: "/action/asset/v1/upload/:identifier*", // Match asset upload routes
destination: '/api/fileUpload' // Forward asset uploads to fileUpload proxy
destination: "/api/fileUpload", // Forward asset uploads to fileUpload proxy
},
{
source: "/action/content/v3/upload/url/:identifier*", // Match content upload with 'url' in the path
destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/content/v3/upload/url/:identifier*`, // Forward to proxy route with path as query param
},
{
source: '/action/content/v3/upload/:identifier*', // Match content upload routes
destination: '/api/fileUpload', // Forward asset uploads to fileUpload proxy
source: "/action/content/v3/upload/:identifier*", // Match content upload routes
destination: "/api/fileUpload", // Forward asset uploads to fileUpload proxy
},
{
source: "/action/asset/:path*", // Match other /action/asset routes
Expand All @@ -74,7 +74,7 @@ const nextConfig = {
destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js
},
{
source: '/assets/public/:path*', // Match any URL starting with /assets/public/
source: "/assets/public/:path*", // Match any URL starting with /assets/public/
destination: `${process.env.WORKSPACE_BASE_URL}/assets/public/:path*`, // Forward to workspace proxy
},
{
Expand Down
10 changes: 2 additions & 8 deletions src/data/cardData.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
let state;

if (typeof window !== 'undefined') {
state = 'Maharashtra'
if (typeof window !== "undefined") {
state = localStorage.getItem("stateName");
}
const cardData = [
{
id: "1",
state: state,
boardsUploaded: 0,
totalBoards: 1,
details:
"Maharashtra is a state in the southeastern coastal region of India.",
boards: ["Maharashtra Board"],
subjects: ["English"],
},
];

Expand Down
21 changes: 21 additions & 0 deletions src/pages/collection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { useEffect, useState } from "react";
import dynamic from "next/dynamic";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";

// @ts-ignore
const CollectionEditor = dynamic(() => import("editor/Collection"), { ssr: false });

const Collection = () => {
return <CollectionEditor />;
};

export default Collection;

export async function getStaticProps({ locale }: any) {
return {
props: {
noLayout: true,
...(await serverSideTranslations(locale, ["common"])),
},
};
}
18 changes: 7 additions & 11 deletions src/pages/course-planner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
useMediaQuery,
useTheme,
Grid,
Divider,
} from "@mui/material";
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
import InsertLinkOutlinedIcon from "@mui/icons-material/InsertLinkOutlined";
Expand All @@ -21,7 +22,7 @@ import Loader from "@/components/Loader";
import { getChannelDetails } from "@/services/coursePlanner";
import { getOptionsByCategory } from "@/utils/Helper";
import coursePlannerStore from "@/store/coursePlannerStore";
import taxonomyStore from "@/store/tanonomyStore"
import taxonomyStore from "@/store/tanonomyStore";

const Foundation = () => {
const router = useRouter();
Expand Down Expand Up @@ -158,19 +159,15 @@ const Foundation = () => {
<Loader showBackdrop={true} loadingText={t("COMMON.LOADING")} />
) : (
<Box sx={{ pl: "20px", mt: 5 }}>
{/* <Box
<Box
sx={{
display: "grid",
gridTemplateColumns: "1fr 2fr 1fr",
gap: isSmallScreen ? "8px" : "16px",
mb: 2,
}}
>
<Typography>{t("MASTER.STATE")}</Typography>
<Typography>{t("COURSE_PLANNER.ACTIVITY")}</Typography>
<Typography>{t("COURSE_PLANNER.COPY_LINK")}</Typography>
</Box> */}
<Grid container spacing={2}>
</Box>
<Divider />
<Grid container spacing={2} mt={2}>
{!selectedCardId ? (
cardData?.map((card: any) => (
<Grid item xs={12} md={4} key={card.id}>
Expand Down Expand Up @@ -227,8 +224,7 @@ const Foundation = () => {
handleCopyLink(card.state);
}}
sx={{ minWidth: "auto", padding: 0 }}
>
</Button>
></Button>
</Box>
</Box>
</Grid>
Expand Down
29 changes: 18 additions & 11 deletions src/pages/stateDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useTheme,
useMediaQuery,
Grid,
Divider,
} from "@mui/material";
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
import InsertLinkOutlinedIcon from "@mui/icons-material/InsertLinkOutlined";
Expand Down Expand Up @@ -49,7 +50,7 @@ const StateDetails = () => {

const channel = store?.boards;
setBoards(channel);
localStorage.removeItem("overallCommonSubjects")
localStorage.removeItem("overallCommonSubjects");
setLoading(false);
}, 1000);
};
Expand Down Expand Up @@ -107,16 +108,26 @@ const StateDetails = () => {

return (
<Box>

<Box sx={{ display: "flex", alignItems: "center", gap: 2, mb: 2, mt: 2 }}>
<Box sx={{ display: "flex", alignItems: "center", mb: 2, mt: 2 }}>
<IconButton onClick={handleBackClick}>
<ArrowBackIcon />
</IconButton>
<Typography variant="h2">{tStore.state}</Typography>
<Box sx={{ display: "flex", gap: 3, alignItems: "center" }}>
</Box>

<Typography variant="h2">{card.state}</Typography>
<Typography variant="h2" sx={{ ml: 1 }}>
State
</Typography>

<Box sx={{ display: "flex", gap: 3, alignItems: "center" }}></Box>

</Box>
<Divider />
<Grid spacing={2} container sx={{ marginTop: "16px", ml: 2 }}>
<Box
sx={{ display: "flex", alignItems: "center", gap: 2, mb: 2, mt: 2 }}
>
<Typography variant="h2">Boards :</Typography>
</Box>
{boards.map((board: any, index: number) => (
<Grid item xs={12} md={4} key={index}>
<Box
Expand Down Expand Up @@ -151,8 +162,6 @@ const StateDetails = () => {
{board?.name}
</Typography>
</Box>


</Box>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<Button
Expand All @@ -161,9 +170,7 @@ const StateDetails = () => {
handleCopyLink(board?.identifier);
}}
sx={{ minWidth: "auto", padding: 0 }}
>

</Button>
></Button>
</Box>
</Box>
</Grid>
Expand Down
89 changes: 38 additions & 51 deletions src/pages/subjectDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
IconButton,
MenuItem,
Select,
Divider,
Tooltip,
} from "@mui/material";
import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";
import InsertLinkOutlinedIcon from "@mui/icons-material/InsertLinkOutlined";
Expand Down Expand Up @@ -81,8 +83,8 @@ const SubjectDetails = () => {
const setTaxonomySubject = taxonomyStore((state) => state.setTaxonomySubject);

useEffect(() => {
const subjects = localStorage.getItem('overallCommonSubjects');
const subjects = localStorage.getItem("overallCommonSubjects");

if (subjects) {
try {
const parsedData = JSON.parse(subjects);
Expand All @@ -95,8 +97,6 @@ const SubjectDetails = () => {
setSubject([]);
}
}, []);



useEffect(() => {
const fetchFrameworkDetails = async () => {
Expand Down Expand Up @@ -172,7 +172,7 @@ const SubjectDetails = () => {
const handleCopyLink = (subject: any) => {};

const handleCardClick = (subject: any) => {
setTaxonomySubject(subject?.name)
setTaxonomySubject(subject?.name);
router.push(`/importCsv?subject=${encodeURIComponent(subject?.name)}`);

setTaxanomySubject(subject?.name);
Expand All @@ -188,7 +188,10 @@ const SubjectDetails = () => {

if (medium) {
const getGrades = getOptionsByCategory(store?.framedata, "gradeLevel");
const mediumAssociations = getAssociationsByCodeNew(mediumOptions, medium);
const mediumAssociations = getAssociationsByCodeNew(
mediumOptions,
medium
);
setMediumAssociations(mediumAssociations);

console.log(getGrades);
Expand Down Expand Up @@ -359,9 +362,12 @@ const SubjectDetails = () => {
];

const overallCommonSubjects = findOverallCommonSubjects(arrays);

setSubject(overallCommonSubjects);
localStorage.setItem("overallCommonSubjects", JSON.stringify(overallCommonSubjects))
localStorage.setItem(
"overallCommonSubjects",
JSON.stringify(overallCommonSubjects)
);
}
};

Expand Down Expand Up @@ -421,7 +427,7 @@ const SubjectDetails = () => {
}}
>
<MenuItem value="">
<Typography >Select Grade</Typography>
<Typography>Select Grade</Typography>
</MenuItem>
{grade.map((item: any) => (
<MenuItem key={item.name} value={item.name}>
Expand Down Expand Up @@ -467,7 +473,7 @@ const SubjectDetails = () => {
sx={{
display: "flex",
alignItems: "center",
gap: "16px",

marginTop: "16px",
marginBottom: "16px",
}}
Expand All @@ -476,75 +482,56 @@ const SubjectDetails = () => {
<ArrowBackIcon />
</IconButton>
<Typography variant="h2">{boardName}</Typography>

<Typography variant="h2" sx={{ ml: 1 }}>
Board
</Typography>
<Box sx={{ width: "40px", height: "40px" }}></Box>
</Box>
<Divider />
<Box sx={{ marginTop: "16px" }}>
{subject && subject.length > 1 ? (
subject.map((subj: any, index: any) => (
subject.map((subj: any, index: number) => (
<MuiCard
key={index}
sx={{
display: "grid",
gridTemplateColumns: "1fr 2fr 1fr",
padding: "14px",
cursor: "pointer",
border: "1px solid #0000001A",
boxShadow: "none",
transition: "background-color 0.3s",
border: "1px solid rgba(0, 0, 0, 0.1)",
boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.05)",
borderRadius: "8px",
transition: "all 0.3s ease",
"&:hover": {
backgroundColor: "#EAF2FF",
transform: "scale(1.02)",
},
marginTop: "8px",
marginTop: "12px",
}}
onClick={() => handleCardClick(subj)}
>
{/* Left Section: Folder Icon and Subject Name */}
<Box
sx={{
display: "flex",
alignItems: "center",
gap: "8px",
gap: "10px",
}}
>
<FolderOutlinedIcon />
<Typography variant="h6">{subj?.name}</Typography>
</Box>
<Box
sx={{
display: "flex",
alignItems: "center",
gap: "16px",
}}
>
<CircularProgress
variant="determinate"
sx={{
color: "#06A816",
"& .MuiCircularProgress-circle": {
strokeLinecap: "round",
stroke: "#06A816",
},
}}
/>
<Typography sx={{ fontSize: "14px" }}>
{/* {subj.uploaded} / {subj.total} {"topics uploaded"} */}
<FolderOutlinedIcon sx={{ color: "#3C3C3C" }} />
<Typography variant="h6" noWrap>
{subj?.name || "Untitled Subject"}
</Typography>
</Box>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<Button
onClick={(e: MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
handleCopyLink(subj);
}}
sx={{ minWidth: "auto", padding: 0 }}
>
</Button>
</Box>
</MuiCard>
))
) : (
<Typography variant="h2" align="center" sx={{ marginTop: "16px" }}>
Select Medium, Grade and Type
<Typography
variant="h4"
align="center"
sx={{ marginTop: "24px", color: "#6B7280" }}
>
Select Medium, Grade, and Type
</Typography>
)}
</Box>
Expand Down

0 comments on commit 75ede28

Please sign in to comment.