You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-16Lines changed: 44 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
The Platform UI is the official Topcoder web app to host all modern user interfaces to be used by all users.
4
4
5
-
All future user interfaces at Topcoder will be implemented here.
6
-
Pre-existing user interfaces will be ported to here over time until this is the only user interface any user sees when interacting with Topcoder.
5
+
All future user interfaces at Topcoder will be implemented here. Pre-existing user interfaces will be ported to here over time until this is the only user interface any user sees when interacting with Topcoder.
7
6
8
7
>**NOTE:** The information in this file describes our coding standards and best practices. All new code should follow these guidelines both when coding new features as well as porting old features. Please take the time to read through this file in detail.
-[Developer Center specific setup](#developer-center-contentful-api-key-and-space-id)
14
14
-[Yarn Commands](#yarn-commands)
15
15
16
16
# Application structure
@@ -81,29 +81,37 @@ You will need to add the following line to your hosts file. The hosts file is no
81
81
82
82
>% yarn start
83
83
84
-
3. Go to https://local.topcoder-dev.com:3003/
84
+
3. Go to https://local.topcoder-dev.com:3000
85
+
86
+
>**NOTE**: The default port is 3000, but you can override it in your [personal config](#personal-config).
85
87
86
88
### Local SSL
87
89
88
90
SSL is required for authentication to work properly.
89
91
90
-
The `yarn start` command serves the site using the cert and key in the /ssl directory.
92
+
The `yarn start` command serves the site using the cert and key in the /ssl directory, which authorize the `https://local.topcoder-dev.com`URL.
93
+
94
+
By overriding the app to use <b>port 443</b>, you can use the authorized URL and trust the root CA to avoid SSL errors in the browser.
95
+
96
+
>**NOTE:** Mac users will require running the app with elevated permissions in order to use a port lower than 500.
91
97
92
-
For easier development, it is recommended that you add this certificate to your trusted root authorities and as a trused cert in your browser. Google your browser and OS for more info.
98
+
For easier development, it is recommended that you add this certificate to your trusted root authorities and as a trused cert in your browser. Google your browser and OS for more info on how to trust cert authorities.
93
99
94
100
Otherwise, you will need to override the exception each time you load the site. Firefox users may need to user an incognito browser in order to override the exception.
95
101
96
102
### Personal Config
97
103
98
-
1. Add [hostname] to src-ts/config/environments/app-host-environment.enum.ts
99
-
2. Copy an existing config from src-ts/config/environments/environment.*.config.ts
100
-
3. Rename new config environment.[hostname].config.ts
101
-
4. Rename config variable to EnvironmentConfig[HostName]
102
-
5. Set the ENV variable to AppHostEnvironment.[hostname]
103
-
6. Add the switch case for the host name to src-ts/config/environments/environment.config.ts
104
+
1. Add [hostname] to [`/src-ts/config/environments/app-host-environment.type.ts`](/src-ts/config/environments/app-host-environment.type.ts)
105
+
2. Copy an existing config from [`/src-ts/config/environments/environment.*.config.ts`](/src-ts/config/environments/environment.bsouza.config.ts)
106
+
3. Rename new config `environment.[hostname].config.ts`
107
+
4. Rename config variable to `EnvironmentConfig[HostName]`
108
+
5. Set the `ENV` variable to `[hostname]`
109
+
6. Add the switch case for the host name to [`/src-ts/config/environments/environment.config.ts`](/src-ts/config/environments/environment.config.ts)
104
110
7. Prior to starting the server, set your host name:
105
111
```% export REACT_APP_HOST_ENV=[hostname]```
106
112
113
+
>**NOTE:** Individual tools (e.g. [Learn tool](/src-ts/tools/learn/README.md)) can have their own configuration, which can be configured the same way as the global config.
114
+
107
115
#### For further convenience
108
116
109
117
1. Copy start-ssl-*.sh
@@ -117,7 +125,22 @@ The app uses CircleCI for CI/CD.
117
125
118
126
The "dev" branch is auto-deployed to the dev environment: https://platform-mvp.topcoder-dev.com.
119
127
120
-
The "master" branch is auto-deployed to the production environment: https://platform-mvp.topcoder.com.
128
+
The "master" branch is auto-deployed to the production environment: https://platform-ui.topcoder.com.
129
+
130
+
## Developer Center Contentful API Key and Space Id
131
+
132
+
The app requires two environment variables, which contain the space id and the key used to access contentful and retrieve Thrive Articles.
133
+
134
+
You should create a file named `.env` in the root folder, and write inside the following lines:
135
+
136
+
```sh
137
+
REACT_APP_CONTENTFUL_EDU_SPACE_ID=<space-id>
138
+
REACT_APP_CONTENTFUL_EDU_CDN_API_KEY=<API Key>
139
+
```
140
+
141
+
We should use the same space ID and API Key as Topcoder Thrive, these are for fetching Thrive articles and videos in the landing page.
142
+
143
+
See the [Dev Center README](/src-ts/tools/dev-center/README.md) for further instructions on setting up the Dev Center.
121
144
122
145
## yarn Commands
123
146
@@ -132,7 +155,11 @@ The "master" branch is auto-deployed to the production environment: https://plat
132
155
|`yarn eslint`| Run eslint against js/x files and outputs report |
133
156
|`yarn eslint:fix`| Run eslint against js/x files, fixes auto-fixable issues, and outputs report |
134
157
|`yarn test`| Run unit tests, watching for changes and re-running per your specifications |
135
-
|`yarn test:no-watch`| Run unit tests once, without watching for changes or re-running |
158
+
|`yarn test:no-watch`| Run unit tests once, without watching for changes or re-running |
159
+
|`yarn cy:run`| Run e2e tests once in local command with the site is running |
160
+
|`yarn cy:ci`| Run e2e tests once by circle ci |
161
+
|`yarn report:coverage`| Generate e2e coverage report in html format |
162
+
|`yarn report:coverage:text`| Generate e2e coverage report in text format |
136
163
137
164
## Folder Structure
138
165
@@ -247,9 +274,10 @@ The PlatformRoute model has several useful options:
247
274
|`element: JSX.Element`| The element property is the JSX element that should appear at the specified URL. |
248
275
|`disabled?: boolean`| When a route is marked as disabled, it will not be registered and will the URL will return a 404. |
249
276
|`hide?: boolean`| When a route is hidden, it will be registered and the URL will be available through deep-linking but will not be visible in either the Tools or Utils Selectors. This is useful for handling redirects for obsolete routes. |
250
-
|`requireAuth?: boolean`| Requiring authentication for a route means that users who are not logged in will be redirected to the Login Form when they try to access the route. |
277
+
|`authRequired?: boolean`| Requiring authentication for a route means that users who are not logged in will be redirected to the Login Form when they try to access the route. |
251
278
|`route: string`| The route property is the path to the route, relative to its parent(s). |
252
279
|`title: string`| The title property is the text that will appear in the Tools or Utils Selectors (this is irrelevant on hidden routes). |
280
+
|`rolesRequired: Array<string>`| Requiring roles for a route means that users who do not own the roles will be presented with restricted page when they try to access the route. |
0 commit comments