From 98a73dcd838de1105d5a67ba30420caf6f924c38 Mon Sep 17 00:00:00 2001 From: lumi-tip Date: Fri, 6 Sep 2024 15:02:20 -0400 Subject: [PATCH 1/2] :bug: attempt to fix bug related to tasks not loading after user buys a program --- .../[cohortSlug]/[slug]/[version]/index.jsx | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/pages/cohort/[cohortSlug]/[slug]/[version]/index.jsx b/src/pages/cohort/[cohortSlug]/[slug]/[version]/index.jsx index 4a0b19512..134671429 100644 --- a/src/pages/cohort/[cohortSlug]/[slug]/[version]/index.jsx +++ b/src/pages/cohort/[cohortSlug]/[slug]/[version]/index.jsx @@ -70,7 +70,7 @@ function Dashboard() { const [events, setEvents] = useState(null); const [liveClasses, setLiveClasses] = useState([]); const { featuredColor, hexColor, modal } = useStyle(); - + const [isLoadingAssigments, setIsLoadingAssigments] = useState(true); const { user, isAuthenticated } = useAuth(); const isBelowTablet = getBrowserSize()?.width < 768; @@ -270,6 +270,7 @@ function Dashboard() { // Fetch cohort data with pathName structure useEffect(() => { if (user) { + setIsLoadingAssigments(true); getCohortData({ cohortSlug, }).then((cohort) => { @@ -283,6 +284,8 @@ function Dashboard() { getCohortAssignments({ user, setContextState, slug, cohort, }); + }).finally(() => { + setIsLoadingAssigments(false); }); } }, [user]); @@ -331,9 +334,11 @@ function Dashboard() { // Sort all data fetched in order of taskTodo useEffect(() => { - prepareTasks({ - cohortProgram, contextState, nestAssignments, - }); + if (contextState.cohortProgram && typeof contextState.cohortProgram === 'object' && contextState.taskTodo) { + prepareTasks({ + cohortProgram, contextState, nestAssignments, + }); + } }, [contextState.cohortProgram, contextState.taskTodo, router]); const dailyModuleData = getDailyModuleData() || ''; @@ -500,27 +505,27 @@ function Dashboard() { /> {academyOwner?.white_labeled && ( - - - - - {academyOwner.name} - - - {t('whiteLabeledText')} - + + + + + {academyOwner.name} + + + {t('whiteLabeledText')} + + - )} {t('intro-video-title')} - + @@ -648,9 +653,9 @@ function Dashboard() { {modulesExists && ( - setShowPendingTasks(e.target.checked)} textAlign="right" gridGap="10px" display="flex" flexDirection="row-reverse" color={commonFontColor}> - {t('modules.show-pending-tasks')} - + setShowPendingTasks(e.target.checked)} textAlign="right" gridGap="10px" display="flex" flexDirection="row-reverse" color={commonFontColor}> + {t('modules.show-pending-tasks')} + )} @@ -661,7 +666,7 @@ function Dashboard() { display="flex" flexDirection="column" > - {sortedAssignments && sortedAssignments.length >= 1 ? ( + {sortedAssignments && sortedAssignments.length >= 1 && !isLoadingAssigments ? ( <> {sortedAssignmentsSearched.map((assignment, i) => { const { @@ -704,9 +709,9 @@ function Dashboard() { ); })} {sortedAssignmentsSearched && sortedAssignmentsSearched.length <= 0 && ( - - {t('modules.search-not-found')} - + + {t('modules.search-not-found')} + )} ) : } From a5ebd6f7f078f60bd73895b82b39e4a939ac9a79 Mon Sep 17 00:00:00 2001 From: lumi-tip Date: Mon, 9 Sep 2024 20:48:29 -0400 Subject: [PATCH 2/2] :recycle: add /lang to the link of the mktCourse in pricing --- src/pages/pricing.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/pricing.jsx b/src/pages/pricing.jsx index 20baf543c..dc34f2e32 100644 --- a/src/pages/pricing.jsx +++ b/src/pages/pricing.jsx @@ -346,7 +346,7 @@ function PricingView() {