-
Notifications
You must be signed in to change notification settings - Fork 21
[PROD RELEASE] - Copilot Portal tweaks & tech dept clean up #1222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
13c1cfd
d0f3439
37a0adc
5f03e7a
2369279
706383a
b5f73a9
f1df526
5ae7d43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
import { ReactComponent as MFAImage } from './mfa.svg' | ||
import { ReactComponent as AppleStore } from './apple-store.svg' | ||
import credentialImage from './credential.png' | ||
import diceIdLogo from './dicelogo.png' | ||
import diceIdLogoBig from './dicelogobig.png' | ||
import diceIdLogoSmall from './dicelogosmall.png' | ||
import googlePlay from './google-play.png' | ||
|
||
export { | ||
AppleStore, | ||
credentialImage, | ||
diceIdLogo, | ||
diceIdLogoBig, | ||
diceIdLogoSmall, | ||
googlePlay, | ||
MFAImage, | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,12 +86,8 @@ const CopilotOpportunityDetails: FC<{}> = () => { | |
const [activeTab, setActiveTab]: [string, Dispatch<SetStateAction<string>>] = useState<string>(activeTabHash) | ||
|
||
useEffect(() => { | ||
if (isAdminOrPM) { | ||
setActiveTab(activeTabHash) | ||
} else { | ||
setActiveTab('0') | ||
} | ||
}, [activeTabHash, isAdminOrPM]) | ||
setActiveTab(activeTabHash) | ||
}, [activeTabHash]) | ||
|
||
const handleTabChange = useCallback((tabId: string): void => { | ||
setActiveTab(tabId) | ||
|
@@ -286,7 +282,7 @@ const CopilotOpportunityDetails: FC<{}> = () => { | |
<TabsNavbar | ||
defaultActive={activeTab} | ||
onChange={handleTabChange} | ||
tabs={getCopilotDetailsTabsConfig(isAdminOrPM, copilotApplications?.length || 0)} | ||
tabs={getCopilotDetailsTabsConfig(copilotApplications?.length || 0)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
/> | ||
) | ||
} | ||
|
@@ -297,7 +293,7 @@ const CopilotOpportunityDetails: FC<{}> = () => { | |
opportunity={opportunity} | ||
members={members} | ||
onApplied={onApplied} | ||
isAdminOrPM | ||
isAdminOrPM={isAdminOrPM} | ||
/> | ||
)} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ export enum CopilotDetailsTabViews { | |
applications = '1', | ||
} | ||
|
||
export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean, count: number): TabsNavItem[] => (isAdminOrPM ? [ | ||
export const getCopilotDetailsTabsConfig = (count: number): TabsNavItem[] => ([ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parameter |
||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
|
@@ -18,11 +18,6 @@ export const getCopilotDetailsTabsConfig = (isAdminOrPM: boolean, count: number) | |
id: CopilotDetailsTabViews.applications, | ||
title: 'Applications', | ||
}, | ||
] : [ | ||
{ | ||
id: CopilotDetailsTabViews.details, | ||
title: 'Details', | ||
}, | ||
]) | ||
|
||
export const CopilotDetailsTabsConfig: TabsNavItem[] = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import { Dispatch, FC, SetStateAction, useCallback, useContext, useState } from 'react' | ||
import { FC, useCallback, useContext } from 'react' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The imports for |
||
import { NavigateFunction, useNavigate } from 'react-router-dom' | ||
|
||
import { Button } from '~/libs/ui' | ||
import { profileContext, ProfileContextData } from '~/libs/core' | ||
|
||
import { getAuthenticateAndEnrollRoute, getTCACertificationEnrollPath } from '../../learn.routes' | ||
import { LearnConfig } from '../../config' | ||
import { DiceModal } from '../../course-details/course-curriculum/dice-modal' | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import for |
||
interface EnrollCtaBtnProps { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import for |
||
certification: string | ||
|
@@ -15,15 +13,9 @@ interface EnrollCtaBtnProps { | |
const EnrollCtaBtn: FC<EnrollCtaBtnProps> = (props: EnrollCtaBtnProps) => { | ||
const navigate: NavigateFunction = useNavigate() | ||
const { initialized: profileReady, profile }: ProfileContextData = useContext(profileContext) | ||
const [isDiceModalOpen, setIsDiceModalOpen]: [boolean, Dispatch<SetStateAction<boolean>>] | ||
= useState<boolean>(false) | ||
|
||
const isLoggedIn: boolean = profileReady && !!profile | ||
|
||
function onDiceModalClose(): void { | ||
setIsDiceModalOpen(false) | ||
} | ||
|
||
/** | ||
* Handle user click on start course/resume/login button | ||
*/ | ||
|
@@ -37,15 +29,8 @@ const EnrollCtaBtn: FC<EnrollCtaBtnProps> = (props: EnrollCtaBtnProps) => { | |
return | ||
} | ||
|
||
// if the user is wipro and s/he hasn't set up DICE, | ||
// let the user know | ||
if (LearnConfig.REQUIRE_DICE_ID && profile?.isWipro && !profile.diceEnabled) { | ||
setIsDiceModalOpen(true) | ||
return | ||
} | ||
|
||
navigate(getTCACertificationEnrollPath(props.certification)) | ||
}, [isLoggedIn, profile?.isWipro, profile?.diceEnabled, props, navigate]) | ||
}, [isLoggedIn, props, navigate]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The dependency array for the |
||
|
||
return ( | ||
<> | ||
|
@@ -55,11 +40,6 @@ const EnrollCtaBtn: FC<EnrollCtaBtnProps> = (props: EnrollCtaBtnProps) => { | |
label={isLoggedIn ? 'Enroll Now' : 'Log in to enroll'} | ||
onClick={handleEnrollClick} | ||
/> | ||
|
||
<DiceModal | ||
isOpen={isDiceModalOpen} | ||
onClose={onDiceModalClose} | ||
/> | ||
</> | ||
) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ export interface LearnConfigModel { | |
value: string, | ||
} | ||
CLIENT: string | ||
REQUIRE_DICE_ID: boolean | undefined | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { EnvironmentConfig } from '~/config' | ||
import { getReactEnv } from '~/config/environments/react-env' | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The import statement for |
||
import { LearnConfigModel } from './learn-config.model' | ||
|
||
|
@@ -14,5 +13,4 @@ export const LearnConfigDefault: LearnConfigModel = { | |
value: 'certificate-container', | ||
}, | ||
CLIENT: 'https://fcc.topcoder-dev.com:4431', | ||
REQUIRE_DICE_ID: `${getReactEnv<string>('REQUIRE_DICE_ID', '')}` === 'true', | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,9 @@ import { | |
getLessonPathFromCurrentLesson, | ||
LEARN_PATHS, | ||
} from '../../learn.routes' | ||
import { LearnConfig } from '../../config' | ||
|
||
import { CurriculumSummary } from './curriculum-summary' | ||
import { TcAcademyPolicyModal } from './tc-academy-policy-modal' | ||
import { DiceModal } from './dice-modal' | ||
import styles from './CourseCurriculum.module.scss' | ||
|
||
interface CourseCurriculumProps { | ||
|
@@ -47,8 +45,6 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable |
||
const [isTcAcademyPolicyModal, setIsTcAcademyPolicyModal]: [boolean, Dispatch<SetStateAction<boolean>>] | ||
= useState<boolean>(false) | ||
const [isDiceModalOpen, setIsDiceModalOpen]: [boolean, Dispatch<SetStateAction<boolean>>] | ||
= useState<boolean>(false) | ||
|
||
const status: string = props.progress?.status ?? UserCertificationProgressStatus.inititialized | ||
const completedPercentage: number = (props.progress?.courseProgressPercentage ?? 0) / 100 | ||
|
@@ -98,17 +94,6 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp | |
return | ||
} | ||
|
||
// if the user is wipro and s/he hasn't set up DICE, | ||
// let the user know | ||
if ( | ||
LearnConfig.REQUIRE_DICE_ID | ||
&& props.profile?.isWipro | ||
&& !props.profile.diceEnabled | ||
) { | ||
setIsDiceModalOpen(true) | ||
return | ||
} | ||
|
||
// Check if user accepted policy and resume(or start) the course | ||
if (props.progress?.academicHonestyPolicyAcceptedAt) { | ||
handleStartCourse() | ||
|
@@ -188,10 +173,6 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp | |
setIsTcAcademyPolicyModal(false) | ||
} | ||
|
||
function onDiceModalClose(): void { | ||
setIsDiceModalOpen(false) | ||
} | ||
|
||
return ( | ||
<> | ||
<div className={styles.wrap}> | ||
|
@@ -232,11 +213,6 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp | |
onClose={onAcademicHonestyModalClose} | ||
onConfirm={handlePolicyAccept} | ||
/> | ||
|
||
<DiceModal | ||
isOpen={isDiceModalOpen} | ||
onClose={onDiceModalClose} | ||
/> | ||
</> | ||
) | ||
} | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,6 @@ import { | |
getCoursePath, | ||
getLessonPathFromModule, | ||
} from '../learn.routes' | ||
import { LearnConfig } from '../config' | ||
import { CoursePageContextValue, useCoursePageContext } from '../course-page-wrapper' | ||
|
||
import { useCheckAndMarkCourseCompleted } from './hooks/use-mark-course-completed' | ||
|
@@ -410,7 +409,7 @@ const FreeCodeCamp: FC<{}> = () => { | |
|
||
/** | ||
* Check if the user accepted the academic honesty policy | ||
* and either is not a wipro user or the wipro user has dice enabled. | ||
* and either is not a wipro user. | ||
* if not, redirect user to course details page to accept the policy | ||
*/ | ||
useLayoutEffect(() => { | ||
|
@@ -421,11 +420,9 @@ const FreeCodeCamp: FC<{}> = () => { | |
} | ||
|
||
// if the user is logged in, | ||
// and the user is a either not wipro user or is a wipro user with dice enabled, | ||
// and if the user has accepted the academic honesty policy, | ||
// the user is permitted to take the course, so there's nothing to do. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment on line 424 seems to be incomplete or not aligned with the current code logic. Consider updating the comment to accurately reflect the conditions being checked in the |
||
if (isLoggedIn | ||
&& (!LearnConfig.REQUIRE_DICE_ID || !profile?.isWipro || !!profile?.diceEnabled) | ||
&& !!certificateProgress?.academicHonestyPolicyAcceptedAt) { | ||
return | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the
isAdminOrPM
condition changes the behavior of theuseEffect
hook. Previously, theactiveTab
was set to'0'
if the user was not an admin or PM. Now, it always setsactiveTab
toactiveTabHash
. Ensure this change aligns with the intended functionality and does not introduce any unintended behavior for non-admin/PM users.