From af955fbe4dc251b35f653d8917777dadf2b04740 Mon Sep 17 00:00:00 2001 From: ManojNathIC Date: Tue, 6 Aug 2024 17:09:53 +0530 Subject: [PATCH] Task #0000:Bug fixes-organization name on profile, join course issue, continue learning page card click issue --- packages/nulp_elite/src/components/Card.js | 9 ++--- .../src/pages/content/joinCourse.js | 38 +++++++++++-------- .../nulp_elite/src/pages/profile/Profile.js | 16 ++++---- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/packages/nulp_elite/src/components/Card.js b/packages/nulp_elite/src/components/Card.js index 033ad296..64c49720 100644 --- a/packages/nulp_elite/src/components/Card.js +++ b/packages/nulp_elite/src/components/Card.js @@ -191,11 +191,10 @@ export default function BoxCard({ items, index, onClick }) { title={ Array.isArray(items?.board) && items.board.length === 1 ? items.board.join(", ") - : items.se_boards[0] || - (Array.isArray(items?.se_boards) && - items?.se_boards.length > 1 - ? items.se_boards.join(", ") - : items.se_boards?.[0] || "") + : Array.isArray(items?.se_boards) && + items.se_boards.length > 1 + ? items.se_boards.join(", ") + : items?.se_boards?.[0] || "" } placement="top" className="labelOne cardLabelEllips" diff --git a/packages/nulp_elite/src/pages/content/joinCourse.js b/packages/nulp_elite/src/pages/content/joinCourse.js index 2e918b2f..d5a280ea 100644 --- a/packages/nulp_elite/src/pages/content/joinCourse.js +++ b/packages/nulp_elite/src/pages/content/joinCourse.js @@ -79,7 +79,7 @@ const JoinCourse = () => { const [creatorId, setCreatorId] = useState(""); const [open, setOpen] = useState(false); const [chat, setChat] = useState([]); - const[childnode, setChildNode]=useState([]); + const [childnode, setChildNode] = useState([]); const [formData, setFormData] = useState({ message: "", }); @@ -96,7 +96,7 @@ const JoinCourse = () => { const [showMore, setShowMore] = useState(false); const [batchDetail, setBatchDetail] = useState(""); const [score, setScore] = useState(""); - const [isEnroll, setIsEnroll]=useState(true); + const [isEnroll, setIsEnroll] = useState(true); const toggleShowMore = () => { setShowMore((prevShowMore) => !prevShowMore); }; @@ -144,7 +144,9 @@ const JoinCourse = () => { setCreatorId(data?.result?.content?.createdBy); setCourseData(data); setUserData(data); - const identifiers = data?.result?.content?.children?.map((child) => child.identifier) || []; + const identifiers = + data?.result?.content?.children?.map((child) => child.identifier) || + []; setChildNode(identifiers); } catch (error) { console.error("Error fetching course data:", error); @@ -209,8 +211,12 @@ const JoinCourse = () => { } const data = await response.json(); setUserCourseData(data.result); - if(userCourseData.courses.some((course) => course.contentId != contentId)){ - setIsEnroll(false) + if ( + userCourseData?.courses?.some( + (course) => course?.contentId != contentId + ) + ) { + setIsEnroll(false); } } catch (error) { console.error("Error while fetching courses:", error); @@ -309,16 +315,16 @@ const JoinCourse = () => { const handleLinkClick = (id) => { console.log(" batchDetails?.batchId", batchDetails?.batchId); - console.log("contentId",contentId); - console.log("isEnroll",isEnroll); - navigate(`${routeConfig.ROUTES.PLAYER_PAGE.PLAYER}?${id}`,{ - state: { - coursename: userData?.result?.content?.name, - batchid: batchDetails?.batchId, - courseid: contentId, - isenroll: isEnroll, - }, }); - + console.log("contentId", contentId); + console.log("isEnroll", isEnroll); + navigate(`${routeConfig.ROUTES.PLAYER_PAGE.PLAYER}?${id}`, { + state: { + coursename: userData?.result?.content?.name, + batchid: batchDetails?.batchId, + courseid: contentId, + isenroll: isEnroll, + }, + }); }; const handleSnackbarClose = (event, reason) => { @@ -858,7 +864,7 @@ const JoinCourse = () => { {t("CONTENT_TAGS")}:{" "} - {courseData?.result?.content?.board && + {Array.isArray(courseData?.result?.content?.board) && courseData?.result?.content?.board?.map((item, index) => (