Skip to content

Commit 4a9eded

Browse files
committed
more cleanup & config updates
1 parent c95d33c commit 4a9eded

File tree

76 files changed

+639
-605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+639
-605
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ Use the [VS Code](https://code.visualstudio.com/download) IDE for MFE developmen
9393
### nvm
9494
Use the node version manager [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) to easily and safely manage the required version of NodeJS (aka, node). Download and install it per the instructions for your development operating system. Installing a version of node via `nvm` will also install `npm`.
9595

96+
>**NOTE:** If the nvm command is not working it might be because the installation failed to update your paths variable properly. To try and fix this try installing nvm again using sudo.
97+
9698
Once nvm is installed, run:
9799

98100
>% nvm install <insert node version>
@@ -128,7 +130,7 @@ You will need to add the following line to your hosts file. The hosts file is no
128130
```
129131
### Serving
130132

131-
1. Open a bash shell
133+
1. Open a terminal
132134
2. Run the following commands
133135

134136
>% git clone https://github.com/topcoder-platform/platform-ui.git

craco.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ module.exports = {
2626
alias: {
2727
// aliases used in JS/TS
2828
'~': resolve('src'),
29+
'@earn': resolve('src/apps/earn/src'),
30+
'@learn': resolve('src/apps/learn/src'),
31+
'@devCenter': resolve('src/apps/dev-center/src'),
32+
'@gamificationAdmin': resolve('src/apps/gamification-admin/src'),
2933

34+
'@platform': resolve('src/apps/platform/src'),
3035
// aliases used in SCSS files
31-
'@earn': resolve('src/apps/earn/src'),
3236
'@libs/ui/styles': resolve('src/libs/ui/lib/styles'),
3337
},
3438
}

jsconfig.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

jsconfig.paths.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
"@types/react-helmet": "^6.1.6",
145145
"@types/react-redux-toastr": "^7.6.2",
146146
"@types/react-router-dom": "^5.3.3",
147+
"@types/redux-actions": "2.6.2",
147148
"@types/sanitize-html": "^2.6.2",
148149
"@types/segment-analytics": "^0.0.34",
149150
"@types/systemjs": "^6.1.1",

sample.env.dev

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
REACT_APP_ENV=dev
2+
3+
REACT_APP_ENABLE_TCA_CERT_MONETIZATION=false
4+
5+
# Stripe configs
6+
REACT_APP_STRIPE_API_KEY=
7+
REACT_APP_STRIPE_API_VERSION=
8+
# not really used anywhere
9+
REACT_APP_STRIPE_ADMIN_TOKEN=
10+
REACT_APP_STRIPE_CUSTOMER_TOKEN=
11+
12+
# Vanilla Forums
13+
REACT_APP_VANILLA_ACCESS_TOKEN=va.JApNvUOx3549h20I6tnl1kOQDc75NDIp.0jG3dA.EE3gZgV
14+
15+
# DataDogLogging
16+
REACT_APP_DATADOG_PUBLIC_TOKEN=puba0825671e469d16f940c5a30dc738f11
17+
18+
REACT_APP_MEMBER_VERIFY_LOOKER=3322
19+
20+
REACT_APP_SPRIG_ENV_ID=bUcousVQ0-yF

sample.env.prod

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
REACT_APP_ENV=prod
2+
3+
REACT_APP_ENABLE_TCA_CERT_MONETIZATION=false
4+
5+
# Stripe configs
6+
REACT_APP_STRIPE_API_KEY=pk_live_m3bCBVSfkfMOEp3unZFRsHXi
7+
REACT_APP_STRIPE_API_VERSION=2020-08-27
8+
# not really used anywhere
9+
REACT_APP_STRIPE_ADMIN_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIiwiYWRtaW5pc3RyYXRvciJdLCJpc3MiOiJodHRwczovL2FwaS50b3Bjb2Rlci1kZXYuY29tIiwiaGFuZGxlIjoidGVzdDEiLCJleHAiOjI1NjMwNzY2ODksInVzZXJJZCI6IjQwMDUxMzMzIiwiaWF0IjoxNDYzMDc2MDg5LCJlbWFpbCI6InRlc3RAdG9wY29kZXIuY29tIiwianRpIjoiYjMzYjc3Y2QtYjUyZS00MGZlLTgzN2UtYmViOGUwYWU2YTRhIn0.wKWUe0-SaiFVN-VR_-GwgFlvWaDkSbc8H55ktb9LAVw
10+
REACT_APP_STRIPE_CUSTOMER_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJ0ZXN0MSIsImV4cCI6MjU2MzA3NjY4OSwidXNlcklkIjoiNDAwNTEzMzMiLCJpYXQiOjE0NjMwNzYwODksImVtYWlsIjoidGVzdEB0b3Bjb2Rlci5jb20iLCJqdGkiOiJiMzNiNzdjZC1iNTJlLTQwZmUtODM3ZS1iZWI4ZTBhZTZhNGEifQ.jl6Lp_friVNwEP8nfsfmL-vrQFzOFp2IfM_HC7AwGcg
11+
12+
# Vanilla Forums
13+
REACT_APP_VANILLA_ACCESS_TOKEN=va.JApNvUOx3549h20I6tnl1kOQDc75NDIp.0jG3dA.EE3gZgV
14+
15+
# DataDogLogging
16+
REACT_APP_DATADOG_PUBLIC_TOKEN=puba0825671e469d16f940c5a30dc738f11
17+
18+
REACT_APP_MEMBER_VERIFY_LOOKER=3322
19+
20+
REACT_APP_SPRIG_ENV_ID=bUcousVQ0-yF
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable @typescript-eslint/typedef */
2+
import { EnvironmentConfig } from '~/config'
3+
4+
const { TOPCODER_URL } = EnvironmentConfig
5+
6+
export const API_BASE = `${TOPCODER_URL}/api`
7+
export const WP_CONTENT = `${TOPCODER_URL}/wp-content`
8+
export const BLOG_PAGE = `${TOPCODER_URL}/blog`
9+
export const THRIVE_PAGE = `${TOPCODER_URL}/thrive`

src/apps/dev-center/src/dev-center-pages/community-app/landing-page/dev-center-articles-section/ArticleCard/ArticleCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC } from 'react'
22
import classNames from 'classnames'
33

4-
import { EnvironmentConfig } from '~/config'
4+
import { THRIVE_PAGE } from '~/apps/dev-center/src/config'
55
import { IconSolid } from '~/libs/ui'
66

77
import { DevCenterTag } from '../../dev-center-tag'
@@ -54,7 +54,7 @@ function getArticleDetails(article: ThriveArticle | BlogPost): ArticleDetails {
5454
const regex: RegExp = /(<([^>]+)>)/gi
5555
const summary: string = content.replace(regex, '') // Remove html from the content string
5656
const url: string = isThrive
57-
? `${EnvironmentConfig.TOPCODER_URLS.THRIVE_PAGE}/articles/${thriveArticle.slug}`
57+
? `${THRIVE_PAGE}/articles/${thriveArticle.slug}`
5858
: blogPost.link
5959
const author: string = !isThrive ? blogPost.creator : ''
6060
const image: string = isThrive

src/apps/dev-center/src/dev-center-pages/community-app/landing-page/dev-center-articles-section/Articles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EnvironmentConfig } from '~/config'
1+
import { API_BASE, WP_CONTENT } from '~/apps/dev-center/src/config'
22

33
import { BlogPost, ThriveArticle } from './models'
44

@@ -8,12 +8,12 @@ export function isThriveArticle(article: BlogPost | ThriveArticle): article is T
88
}
99

1010
/** This is the default image to be used for blog posts that do not provide an url to the hero image */
11-
const DEFAULT_BLOG_IMAGE: string = `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2017/04/SRM_Blog.png`
11+
const DEFAULT_BLOG_IMAGE: string = `${WP_CONTENT}/uploads/2017/04/SRM_Blog.png`
1212

1313
/** Get the blog with the given url, or return undefined if the blog couldn't be fetched */
1414
export async function getBlog(url: string): Promise<BlogPost | undefined> {
1515
try {
16-
const response: Response = await fetch(`${EnvironmentConfig.TOPCODER_URLS.API_BASE}/blog?limit=200`)
16+
const response: Response = await fetch(`${API_BASE}/blog?limit=200`)
1717
const data: Array<BlogPost> = await response.json()
1818
const blog: BlogPost = data.filter(x => x.link === url)[0]
1919
// If the returned data do not contain the URL to the image, use the default one

src/apps/dev-center/src/dev-center-pages/community-app/landing-page/dev-center-articles-section/articles.config.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable max-len */
2-
import { EnvironmentConfig } from '~/config'
2+
import { BLOG_PAGE, WP_CONTENT } from '~/apps/dev-center/src/config'
33

44
import { ArticleEntry, ArticleType, BlogPost } from './models'
55

@@ -11,7 +11,7 @@ import { ArticleEntry, ArticleType, BlogPost } from './models'
1111
* Example
1212
* {
1313
* type: ArticleType.Blog,
14-
* url: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/talent-as-a-service-taas-a-brilliant-solution-to-the-talent-gap/`,
14+
* url: `${BLOG_PAGE}/talent-as-a-service-taas-a-brilliant-solution-to-the-talent-gap/`,
1515
* }
1616
* {
1717
* type: ArticleType.Thrive,
@@ -48,36 +48,36 @@ export const defaultBlogs: Array<BlogPost> = [
4848
{
4949
contentSnippet: 'In light of the incredible speed of innovation, specialized tech talent has never been more critical to business success. Yet access to that talent remains frustratingly difficult for many companies. According to the Society for Human Resources Management, 83% of businesses are having trouble recruiting suitable candidates for their open positions, particularly when it comes […]\nThe post Talent as a Service (TaaS): A Brilliant Solution to the Talent Gap appeared first on Topcoder.',
5050
creator: 'Kiran Hampapura',
51-
featuredImage: `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2019/11/taashero.jpg`,
52-
link: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/talent-as-a-service-taas-a-brilliant-solution-to-the-talent-gap/`,
51+
featuredImage: `${WP_CONTENT}/uploads/2019/11/taashero.jpg`,
52+
link: `${BLOG_PAGE}/talent-as-a-service-taas-a-brilliant-solution-to-the-talent-gap/`,
5353
title: 'Talent as a Service (TaaS): A Brilliant Solution to the Talent Gap',
5454
},
5555
{
5656
contentSnippet: 'Can our Topcoder accounts be hacked? Can our well-earned cash be stolen away through the platform? Can customers suffer from intellectual theft? These sensitive questions belong to a discussion on a beyond-interesting topic: security. Honoring Topcoder’s security themed month, we want to raise awareness on what cyber security means for members and customers. We turned […]\nThe post Securing A Safe Work System For Members And Customers With John Wheeler - The Topcoder Nation Show #18 appeared first on Topcoder.',
5757
creator: 'mahestro',
58-
featuredImage: `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2022/07/00-tcn-show-18-john-wheeler.png`,
59-
link: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/securing-a-safe-work-system-for-members-and-customers-with-john-wheeler-the-topcoder-nation-show-18/`,
58+
featuredImage: `${WP_CONTENT}/uploads/2022/07/00-tcn-show-18-john-wheeler.png`,
59+
link: `${BLOG_PAGE}/securing-a-safe-work-system-for-members-and-customers-with-john-wheeler-the-topcoder-nation-show-18/`,
6060
title: 'Securing A Safe Work System For Members And Customers With John Wheeler – The Topcoder Nation Show #18',
6161
},
6262
{
6363
contentSnippet: 'Job opportunities, upskilling, and mentoring are traits that identify the endeavor that this young gentleman is leading in Africa. Meet Abiodun (), born and raised in Lagos; he aims to close the gap between the tech talent in his region and opportunities, leveraging Topcoder as a medium to make it happen. Abiodun loves live music […]\nThe post Building A Tech Community In Africa With Code_Abbey – The Topcoder Nation Show #17 appeared first on Topcoder.',
6464
creator: 'mahestro',
65-
featuredImage: `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2022/06/00-tcn-show-17-code_abby-and-gigs-in-africa.png`,
66-
link: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/building-a-tech-community-in-africa-with-code_abbey-the-topcoder-nation-show-17/`,
65+
featuredImage: `${WP_CONTENT}/uploads/2022/06/00-tcn-show-17-code_abby-and-gigs-in-africa.png`,
66+
link: `${BLOG_PAGE}/building-a-tech-community-in-africa-with-code_abbey-the-topcoder-nation-show-17/`,
6767
title: 'Building A Tech Community In Africa With Code_Abbey – The Topcoder Nation Show #17',
6868
},
6969
{
7070
contentSnippet: 'CellPhoneService We just need to do the calculations described in the statement. One part of the calculations that may be tricky for beginners is the fee per each started minute of a call. If we have a call that takes S seconds, the number of minutes we’ll paying for can be computed by dividing S […]\nThe post Single Round Match 833 Editorials appeared first on Topcoder.',
7171
creator: 'misof',
72-
featuredImage: `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2017/04/SRM_Blog.png`,
73-
link: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/single-round-match-833-editorials/`,
72+
featuredImage: `${WP_CONTENT}/uploads/2017/04/SRM_Blog.png`,
73+
link: `${BLOG_PAGE}/single-round-match-833-editorials/`,
7474
title: 'Single Round Match 833 Editorials',
7575
},
7676
{
7777
contentSnippet: 'TwoDimensionalSort Imagine that we label rows of the board A to Z from top to bottom. If we got each rook X into its row X, the board would surely be sorted. With N rooks we can always achieve that in at most 2*N moves. In the first N moves we’ll move some rooks horizontally […]\nThe post TCO22 Round 3 Editorial appeared first on Topcoder.',
7878
creator: 'misof',
79-
featuredImage: `${EnvironmentConfig.TOPCODER_URLS.WP_CONTENT}/uploads/2017/04/SRM_Blog.png`,
80-
link: `${EnvironmentConfig.TOPCODER_URLS.BLOG_PAGE}/tco22-round-3-editorial/`,
79+
featuredImage: `${WP_CONTENT}/uploads/2017/04/SRM_Blog.png`,
80+
link: `${BLOG_PAGE}/tco22-round-3-editorial/`,
8181
title: 'TCO22 Round 3 Editorial',
8282
},
8383
]

src/apps/earn/src/actions/challenge.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { getService as getSubmissionService } from "../services/submissions";
1212
import { getApi } from "../services/challenge-api";
1313
import * as submissionUtil from "../utils/submission";
1414

15-
const { PAGE_SIZE } = 50;
15+
const { PAGE_SIZE } = config;
1616

1717
/**
1818
* Private. Loads from the backend all data matching some conditions.
@@ -21,7 +21,7 @@ const { PAGE_SIZE } = 50;
2121
* "offset" ones. Returns loaded data as an array.
2222
* @param {Number} page Optional. Next page of data to load.
2323
* @param {Number} perPage Optional. The size of the page content to load.
24-
* @param {Array} prev Optional. data loaded so far.
24+
* @param {Array<string>} prev Optional. data loaded so far.
2525
*/
2626
function getAll(getter, page = 1, perPage = PAGE_SIZE, prev) {
2727
/* Amount of submissions to fetch in one API call. 50 is the current maximum
@@ -386,7 +386,7 @@ function getSubmissionInformationDone(challengeId, submissionId, tokenV3) {
386386
return getAll(params => submissionsService.getSubmissions(filter, params), 1, 500)
387387
.then((submissions) => {
388388
const submission = _.find(submissions, { id: submissionId });
389-
_.remove(submission.review, review => review.typeId === CONFIG.AV_SCAN_SCORER_REVIEW_TYPE_ID);
389+
_.remove(submission.review, review => review.typeId === config.AV_SCAN_SCORER_REVIEW_TYPE_ID);
390390
return { submissionId, submission };
391391
});
392392
}
@@ -438,4 +438,4 @@ export default createActions({
438438
FETCH_CHALLENGE_STATISTICS_INIT: fetchChallengeStatisticsInit,
439439
FETCH_CHALLENGE_STATISTICS_DONE: fetchChallengeStatisticsDone,
440440
},
441-
});
441+
});

src/apps/earn/src/components/AccessDenied/index.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import PT from "prop-types";
22
import _ from "lodash";
3+
import { EnvironmentConfig } from "~/config";
4+
35
import { PrimaryButton } from "../Buttons";
46
import { ReactComponent as TopcoderLogo } from "../../assets/icons/logo_topcoder.svg";
57
import { ACCESS_DENIED_REASON } from "../../constants";
6-
import config from '../../config';
8+
import { styled as styledCss } from "../../utils";
79

810
import styles from "./styles.module.scss";
9-
import { styled as styledCss } from "../../utils";
1011
const styled = styledCss(styles)
1112

1213
const AccessDenied = ({ cause, redirectLink, children }) => {
@@ -21,10 +22,10 @@ const AccessDenied = ({ cause, redirectLink, children }) => {
2122
<div className={styled("msg")}>
2223
<a
2324
className="tc-btn-md tc-btn-primary"
24-
href={`${config.URL.AUTH}/member`}
25+
href={`${EnvironmentConfig.AUTH.ACCOUNTS_APP_CONNECTOR}/member`}
2526
onClick={(event) => {
2627
const retUrl = encodeURIComponent(window.location.href);
27-
window.location = `${config.URL.AUTH}/member?retUrl=${retUrl}`;
28+
window.location = `${EnvironmentConfig.AUTH.ACCOUNTS_APP_CONNECTOR}/member?retUrl=${retUrl}`;
2829
event.preventDefault();
2930
}}
3031
>

0 commit comments

Comments
 (0)