Skip to content

Commit 81d5da5

Browse files
Merge pull request #396 from topcoder-platform/dev
TCA-564 Release 2.0 -> master
2 parents e33dabf + b004565 commit 81d5da5

File tree

155 files changed

+4653
-5700
lines changed

Some content is hidden

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

155 files changed

+4653
-5700
lines changed

README.md

Lines changed: 153 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,75 @@ All future user interfaces at Topcoder will be implemented here. Pre-existing us
66

77
>**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.
88
9-
# Getting started with local development
9+
- [Source Control & CI/CD](#source-control--cicd)
10+
- [Local Development](#local-development)
11+
- [Application Structure](#application-structure)
12+
- [Coding Practices](#coding-practices)
13+
- [Tools](#tools)
14+
15+
---
16+
17+
# Source Control & CI/CD
1018

11-
- [Local Environment Setup](#local-environment-setup)
1219
- [Deployments](#deployments)
13-
- [Developer Center specific setup](#developer-center-contentful-api-key-and-space-id)
14-
- [Yarn Commands](#yarn-commands)
20+
- [Pull Requests](#pull-requests)
21+
- [Branching](#branching)
22+
- [Commits](#commits)
23+
24+
## Deployments
25+
26+
The app uses CircleCI for CI/CD.
27+
28+
The `dev` branch is auto-deployed to the dev environment: https://platform-mvp.topcoder-dev.com.
29+
30+
The `master` branch is auto-deployed to the production environment: https://platform-ui.topcoder.com.
31+
32+
## Pull Requests
33+
34+
If a Jira ticket requires any code changes, it should have its own pull request.
35+
36+
PRs should be named as follows:
37+
38+
`[TICKET-###] [Short Description] -> [target-branch-name]`
39+
40+
e.g. `GAME-174 Upload Badge Image Fix -> dev`
41+
42+
PRs should also have a description that includes a link to the Jira ticket and a summary of what the PR is changing.
43+
44+
## Branching
45+
46+
All branches use `dev` as their source. All merges to `dev` should be made via [pull request](#pull-requests) and should be approved by application owner(s).
47+
48+
When working on Jira tickets, a branch should correspond with a single ticket.
49+
50+
When using subtasks, each parent ticket should have its own branch off `dev`, and all subtasks branches should be merged into the parent ticket branch instead of directly to `dev`.
51+
52+
Use the following naming convention for branches in order to link associated Git PRs and branches to the tickets:
53+
54+
`[TICKET-###]_[short-description]`
55+
56+
e.g.: `PROD-1516_work-issue`
57+
58+
## Commits
59+
We use [Smart Commits](https://bigbrassband.com/git-integration-for-jira/documentation/smart-commits.html#bbb-nav-basic-examples) to link comments and time tracking to tickets. You would enter the following as your commit message:
60+
61+
`[TICKET #] #comment <commit message> #time <jira-formatted time>`
62+
63+
e.g.: `PROD-001 #comment adding readme notes #time 45m`
64+
65+
66+
1567

16-
# Application structure
1768

18-
- [Folder Structure](#folder-structure)
19-
- [Adding a Tool or Util](#adding-a-tool-or-util)
2069

21-
# Coding Practices
22-
- [Git](#git)
23-
- [Linting](#linting)
24-
- [Styling](#styling)
25-
- [Icons](#icons)
2670

27-
---
71+
72+
73+
# Local Development
74+
75+
- [Local Environment Setup](#local-environment-setup)
76+
- [Tool-specific Setup](#tool-specific-setup)
77+
- [Yarn Commands](#yarn-commands)
2878

2979
## Local Environment Setup
3080

@@ -34,7 +84,7 @@ All future user interfaces at Topcoder will be implemented here. Pre-existing us
3484
- Typescript
3585
- React Scripts
3686

37-
This app uses React 17, Typescript 4, and Node 16.
87+
This app uses React 18, Typescript 4, and Node 16.
3888

3989
### IDE
4090

@@ -127,28 +177,10 @@ Otherwise, you will need to override the exception each time you load the site.
127177
3. Set the REACT_APP_HOST_ENV=[hostname]
128178
4. Add "start:[hostname]": "sh start-ssl-[hostname].sh" to scripts in package.json
129179

130-
## Deployments
131180

132-
The app uses CircleCI for CI/CD.
181+
## Tool-specific setup
133182

134-
The "dev" branch is auto-deployed to the dev environment: https://platform-mvp.topcoder-dev.com.
135-
136-
The "master" branch is auto-deployed to the production environment: https://platform-ui.topcoder.com.
137-
138-
## Developer Center Contentful API Key and Space Id
139-
140-
The app requires two environment variables, which contain the space id and the key used to access contentful and retrieve Thrive Articles.
141-
142-
You should create a file named `.env` in the root folder, and write inside the following lines:
143-
144-
```sh
145-
REACT_APP_CONTENTFUL_EDU_SPACE_ID=<space-id>
146-
REACT_APP_CONTENTFUL_EDU_CDN_API_KEY=<API Key>
147-
```
148-
149-
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.
150-
151-
See the [Dev Center README](/src-ts/tools/dev-center/README.md) for further instructions on setting up the Dev Center.
183+
Each [Tool](#tools) can have its own setup requirements. Please see each tool's [README](#tools) for further information.
152184

153185
## yarn Commands
154186

@@ -169,6 +201,15 @@ See the [Dev Center README](/src-ts/tools/dev-center/README.md) for further inst
169201
| `yarn report:coverage`| Generate e2e coverage report in html format |
170202
| `yarn report:coverage:text` | Generate e2e coverage report in text format |
171203

204+
205+
206+
207+
208+
# Application Structure
209+
210+
- [Folder Structure](#folder-structure)
211+
- [Adding a Tool or Util](#adding-a-tool-or-util)
212+
172213
## Folder Structure
173214

174215
The folder structure of the app has the following goals:
@@ -272,6 +313,36 @@ These routes then need to be added to the routes file for the parent tools/utils
272313
Simply adding the routes to one of thes files above will register the tool/util
273314
with the application and will display the new component.
274315

316+
### Lazy loading and code splitting
317+
318+
When loading a route component, please use the `lazyLoad()` method defined in the application lib.
319+
320+
| param | description|
321+
| ----- | ---------- |
322+
| `moduleImport: () => Promise<any>` | Function which imports the desired module |
323+
| `namedExport?: string` | The name of the exported module (if the module has named exports) |
324+
325+
Eg:
326+
```
327+
// Lazy load the WelcomePage component
328+
const WelcomePage: LazyLoadedComponent = lazyLoad(() => import('./welcome'), 'WelcomePage')
329+
...
330+
// Use the component as route element
331+
export const learnRoutes: Array<PlatformRoute> = [
332+
{
333+
children: [
334+
{
335+
children: [],
336+
element: <WelcomePage />,
337+
...
338+
},
339+
...
340+
]
341+
}
342+
]
343+
```
344+
345+
275346
### Platform Route
276347

277348
The PlatformRoute model has several useful options:
@@ -287,25 +358,14 @@ The PlatformRoute model has several useful options:
287358
| `title: string` | The title property is the text that will appear in the Tools or Utils Selectors (this is irrelevant on hidden routes). |
288359
| `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. |
289360

290-
## Git
291-
292-
### Branching
293-
When working on Jira tickets, we link associated Git PRs and branches to the tickets. Use the following naming convention for branches:
294361

295-
`[TICKET #]_short-description`
296362

297-
e.g.: `PROD-1516_work-issue`
298363

299-
#### Branching strategy
300-
TBD
301-
302-
### Commits
303-
We use [Smart Commits](https://bigbrassband.com/git-integration-for-jira/documentation/smart-commits.html#bbb-nav-basic-examples) to link comments and time tracking to tickets. You would enter the following as your commit message:
304-
305-
`[TICKET #] #comment <commit message> #time <jira-formatted time>`
306-
307-
e.g.: `PROD-001 #comment adding readme notes #time 45m`
308364

365+
# Coding Practices
366+
- [Linting](#linting)
367+
- [Styling](#styling)
368+
- [Icons](#icons)
309369

310370
## Linting
311371

@@ -519,3 +579,47 @@ e.g.:
519579
```
520580
521581
>**NOTE** - all SVGs require explicit `width` and `height` in the Safari browser in order to be rendered properly, otherwise they'll be rendered to the _default_ size and probably will crop out of view
582+
583+
584+
585+
586+
587+
588+
589+
590+
# Tools
591+
592+
The following summarizes the various [tools](#adding-a-tool-or-util) in the Platform UI.
593+
594+
- [Dev Center](#dev-center)
595+
- [Gamification Admin](#gamification-admin)
596+
- [Learn](#learn)
597+
- [Work](#work)
598+
599+
## Dev Center
600+
601+
A community-led project to document how to work with Topcoder internal applications.
602+
603+
[Dev Center README](./src-ts/tools/dev-center/README.md)
604+
[Dev Center Routes](./src-ts/tools/dev-center/dev-center.routes.tsx)
605+
606+
## Gamification Admin
607+
608+
Application that allows administrators to CRUD badges and de/assign them to specific users.
609+
610+
[Gamification Admin README TBD](./src-ts/tools/gamification-admin/README.md)
611+
[Gamification Admin Routes](./src-ts/tools/gamification-admin/gamification-admin.routes.tsx)
612+
613+
## Learn
614+
615+
Application that serves 3rd-party educational content.
616+
617+
[Learn README](./src-ts/tools/learn/README.md)
618+
[Learn Routes](./src-ts/tools/learn/learn.routes.tsx)
619+
620+
## Work
621+
622+
Application that allows customers to submit/start challenges self-service.
623+
624+
[Work README TBD](./src-ts/tools/work/README.md)
625+
[Work Routes](./src-ts/tools/work/work.routes.tsx)

0 commit comments

Comments
 (0)