Skip to content

Commit 0f11ca0

Browse files
authored
Merge pull request #260 from topcoder-platform/TCA-105_rename-cert
TCA-105 Learn Config -> dev
2 parents dce9dd7 + ee5b3bd commit 0f11ca0

File tree

25 files changed

+170
-97
lines changed

25 files changed

+170
-97
lines changed

src-ts/config/environments/environment.default.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const EnvironmentConfigDefault: GlobalConfig = {
1616
V5: 'https://api.topcoder-dev.com/v5',
1717
},
1818
ENV: AppHostEnvironment.default,
19-
LEARN_SRC: 'https://fcc.topcoder-dev.com:4431',
2019
LOGGING: {
2120
PUBLIC_TOKEN: 'puba0825671e469d16f940c5a30dc738f11',
2221
SERVICE: 'platform-ui',

src-ts/config/environments/environment.dev.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const EnvironmentConfigDev: GlobalConfig = {
1212
},
1313
DISABLED_TOOLS: [],
1414
ENV: AppHostEnvironment.dev,
15-
LEARN_SRC: 'https://freecodecamp.topcoder-dev.com',
1615
// TODO: Move stripe creds to .env file
1716
STRIPE: {
1817
ADMIN_TOKEN:

src-ts/config/environments/environment.prod.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const EnvironmentConfigProd: GlobalConfig = {
1919
},
2020
DISABLED_TOOLS: [ ],
2121
ENV: AppHostEnvironment.prod,
22-
LEARN_SRC: 'https://freecodecamp.topcoder.com',
2322
// TODO: Move stripe creds to .env file
2423
STRIPE: {
2524
ADMIN_TOKEN:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './app-host-environment.enum'
12
export { default as EnvironmentConfig } from './environment.config'

src-ts/lib/global-config.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export interface GlobalConfig {
1111
}
1212
DISABLED_TOOLS?: Array<string>
1313
ENV: string
14-
LEARN_SRC: string,
1514
LOGGING: {
1615
PUBLIC_TOKEN: string
1716
SERVICE: string

src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ import { TitleNav } from './title-nav'
4545
const FreeCodeCamp: FC<{}> = () => {
4646

4747
const {
48-
profile,
4948
initialized: profileReady,
49+
isLoggedIn,
50+
profile,
5051
}: ProfileContextData = useContext(profileContext)
51-
const isLoggedIn: boolean = !!profile
5252

5353
const navigate: NavigateFunction = useNavigate()
5454
const routeParams: Params<string> = useParams()
55-
5655
const providerParam: string = routeParams.provider ?? ''
56+
5757
const [certificationParam, setCourseParam]: [string, Dispatch<SetStateAction<string>>] = useState(routeParams.certification ?? '')
5858
const [moduleParam, setModuleParam]: [string, Dispatch<SetStateAction<string>>] = useState(routeParams.module ?? '')
5959
const [lessonParam, setLessonParam]: [string, Dispatch<SetStateAction<string>>] = useState(routeParams.lesson ?? '')
@@ -178,7 +178,8 @@ const FreeCodeCamp: FC<{}> = () => {
178178
lesson.course.certificationId,
179179
lesson.course.id,
180180
currentLesson
181-
).then(setCertificateProgress)
181+
)
182+
.then(setCertificateProgress)
182183
} else {
183184
// TODO: remove this delay!!
184185
// TEMP_FIX: delay this api call to allow for previous "completeLesson" call to write in the api
@@ -297,7 +298,7 @@ const FreeCodeCamp: FC<{}> = () => {
297298
if (lessonPath !== lessonParam) {
298299
setLessonParam(lessonPath)
299300
}
300-
// eslint-disable-next-line react-hooks/exhaustive-deps
301+
// eslint-disable-next-line react-hooks/exhaustive-deps
301302
}, [
302303
// DO NOT UPDATE THIS DEPS ARRAY!!
303304
// we do not care about changes to the other deps

src-ts/tools/learn/free-code-camp/fcc-frame/FccFrame.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC, memo, MutableRefObject, useEffect, useRef } from 'react'
22

3-
import { EnvironmentConfig } from '../../../../config'
3+
import { LearnConfig } from '../../learn-config'
44
import { LearnLessonMeta } from '../../learn-lib'
55

66
import styles from './FccFrame.module.scss'
@@ -33,14 +33,14 @@ const FccFrame: FC<FccFrameProps> = (props: FccFrameProps) => {
3333
}
3434

3535
if (!frameIsReady.current) {
36-
Object.assign(frameRef.current, { src: `${EnvironmentConfig.LEARN_SRC}/${props.lesson.lessonUrl}` })
36+
Object.assign(frameRef.current, { src: `${LearnConfig.CLIENT}/${props.lesson.lessonUrl}` })
3737
} else {
3838
frameRef.current.contentWindow.postMessage(JSON.stringify({
3939
data: { path: `/${lessonUrl}` },
4040
event: 'fcc:url:update',
4141
}), '*')
4242
}
43-
// eslint-disable-next-line react-hooks/exhaustive-deps
43+
// eslint-disable-next-line react-hooks/exhaustive-deps
4444
}, [
4545
lessonUrl,
4646
])
@@ -52,7 +52,7 @@ const FccFrame: FC<FccFrameProps> = (props: FccFrameProps) => {
5252
const handleEvent: (event: any) => void = (event: any) => {
5353
const { data: jsonData, origin }: { data: string, origin: string } = event
5454

55-
if (origin.indexOf(EnvironmentConfig.LEARN_SRC) === -1) {
55+
if (origin.indexOf(LearnConfig.CLIENT) === -1) {
5656
return
5757
}
5858

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as LearnConfig } from './learn.config'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface LearnConfigModel {
2+
API: string
3+
CLIENT: string
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { LearnConfigModel } from './learn-config.model'
2+
import { LearnConfigDefault } from './learn.default.config'
3+
4+
export const LearnConfigBsouza: LearnConfigModel = {
5+
...LearnConfigDefault,
6+
}

0 commit comments

Comments
 (0)