|
| 1 | +# Platform UI |
| 2 | + |
| 3 | +The Platform UI is the official Topcoder web app to host all modern user interfaces to be used by all users. |
| 4 | + |
| 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. |
| 6 | + |
| 7 | +## Local Environment Setup |
| 8 | + |
| 9 | +### Install VS Code |
| 10 | + |
| 11 | +Preferably, use the VS Code IDE for development. |
| 12 | + |
| 13 | +[https://code.visualstudio.com/download](https://code.visualstudio.com/download) |
| 14 | + |
| 15 | +### GIT |
| 16 | + |
| 17 | +Install git on your local machine. This is trivial for working in the community. |
| 18 | +You can follow these guides for installing GIT: |
| 19 | + |
| 20 | +- [Windows](https://local.topcoder-dev.com/devcenter/getting-started#23-install-git) |
| 21 | +- [Linux](https://local.topcoder-dev.com/devcenter/getting-started#197-install-git) |
| 22 | + |
| 23 | +### nvm |
| 24 | + |
| 25 | +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`. |
| 26 | + |
| 27 | +> **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. |
| 28 | +
|
| 29 | +Once nvm is installed, run: |
| 30 | + |
| 31 | +```sh |
| 32 | +nvm install <insert node version> |
| 33 | +``` |
| 34 | + |
| 35 | +At the root of the project directory you'll notice a file called `.nvmrc` which specifies the node version used by the project. The command `nvm use` will use the version specified in the file if no version is supplied on the command line. |
| 36 | +See [the nvm Github README](https://github.com/nvm-sh/nvm/blob/master/README.md#nvmrc) for more information on setting this up. |
| 37 | + |
| 38 | +> **NOTE:** The current node version mentioned in the `.nvmrc` is `22.13.0` |
| 39 | +
|
| 40 | +You can verify the versions of `nvm`, `node`, and `npm` using the commands below. |
| 41 | + |
| 42 | +| Command | Supported Version | |
| 43 | +| ------------- | ----------------- | |
| 44 | +| `% npm -v` | 10.9.2 | |
| 45 | +| `% node -v` | v22.13.0 | |
| 46 | + |
| 47 | +> **NOTE:** The `yarn start` command requires the `NVM_DIR` env variable is set. |
| 48 | +
|
| 49 | +```sh |
| 50 | +export NVM_DIR=~/.nvm |
| 51 | +``` |
| 52 | + |
| 53 | +### Hosting |
| 54 | + |
| 55 | +You will need to add the following line to your hosts file. The hosts file is normally located at `/etc/hosts` (Mac & Linux) or %SYSTEMROOT%\System32\drivers\etc\hosts (Windows). Do not overwrite the existing localhost entry also pointing to 127.0.0.1. |
| 56 | + |
| 57 | +``` |
| 58 | +127.0.0.1 local.topcoder-dev.com |
| 59 | +``` |
| 60 | + |
| 61 | +### Building and serving the application |
| 62 | + |
| 63 | +1. Open a terminal |
| 64 | +2. Run the following commands |
| 65 | + |
| 66 | +```sh |
| 67 | +git clone https://github.com/topcoder-platform/platform-ui.git |
| 68 | +cd platform-ui |
| 69 | +yarn install |
| 70 | +yarn start |
| 71 | +``` |
| 72 | + |
| 73 | +3. Go to https://local.topcoder-dev.com |
| 74 | + |
| 75 | +> **NOTE**: The site must run on port 443 in order for auth0 to work and for the site to load properly. Mac users will need to run the app with elevated permissions, as in: |
| 76 | +
|
| 77 | +```sh |
| 78 | +sudo yarn start |
| 79 | +``` |
| 80 | + |
| 81 | +Run following command to allow node to run apps on ports lowert than 500 (Mac & Linux): |
| 82 | + |
| 83 | +```sh |
| 84 | +sudo setcap 'cap_net_bind_service=+ep' `which node` |
| 85 | +``` |
| 86 | + |
| 87 | +### Local SSL |
| 88 | + |
| 89 | +SSL is required for authentication to work properly. |
| 90 | + |
| 91 | +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. |
| 92 | + |
| 93 | +By overriding the app to use **port 443**, you can use the authorized URL and trust the root CA to avoid SSL errors in the browser. |
| 94 | + |
| 95 | +> **NOTE:** Mac and Linux users will require running the app with elevated permissions in order to use a port lower than 500. |
| 96 | +
|
| 97 | +Easy way to overcome elevated permissions is to make use of: |
| 98 | + |
| 99 | +```sh |
| 100 | +sudo setcap 'cap_net_bind_service=+ep' `which node` |
| 101 | +``` |
| 102 | + |
| 103 | +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. |
| 104 | + |
| 105 | +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. |
| 106 | + |
| 107 | +## yarn Commands |
| 108 | + |
| 109 | +| Command | Description | |
| 110 | +| ------------------- | -------------------------------------------------------------------------------------- | |
| 111 | +| yarn start | Serve dev mode build with the default config | |
| 112 | +| yarn build | Build dev mode build with the default config and outputs static files in /build | |
| 113 | +| yarn build:prod | Build prod mode build with the prod config and outputs static files in /build | |
| 114 | +| yarn demo | Serves the built files (by running yarn:build) for local testing | |
| 115 | +| yarn lint | Run eslint against js/x and ts/x files and outputs report | |
| 116 | +| yarn lint:fix | Run eslint against js/x and ts/x files, fixes auto-fixable issues, and outputs report | |
| 117 | +| yarn sb | Start the storybook dev server | |
| 118 | +| yarn sb:build | Build the assets for storybook | |
| 119 | + |
| 120 | +## App specific setup |
| 121 | + |
| 122 | +Each Application can have its own setup requirements. Please see each apps's README for further information. |
| 123 | + |
| 124 | +### Applications hosted under Platform UI |
| 125 | + |
| 126 | +#### Platform App |
| 127 | +This is the "router" app under the whole sum of all Platform UI applications. It will just load all applications and serve one based on the specific route |
| 128 | +It also renders the [Universal Navigation](https://github.com/topcoder-platform/universal-navigation)'s header & footer. |
| 129 | + |
| 130 | +Located `src/apps/platform`. |
| 131 | + |
| 132 | +#### Account Settings |
| 133 | +App that manages user's own settings. |
| 134 | + |
| 135 | +Located `src/apps/accounts`. |
| 136 | + |
| 137 | +#### Dev Center |
| 138 | +A community-led project to document how to work with Topcoder internal applications. |
| 139 | + |
| 140 | +Located `src/apps/dev-center`. |
| 141 | + |
| 142 | +#### Gamification Admin |
| 143 | +Application that allows administrators to CRUD badges and de/assign them to specific users. |
| 144 | + |
| 145 | +Located `src/apps/gamification-admin`. |
| 146 | + |
| 147 | +#### Learn |
| 148 | +Application that serves 3rd-party educational content. |
| 149 | + |
| 150 | +Located `src/apps/learn`. |
| 151 | + |
| 152 | +#### Onboarding App |
| 153 | +Application that helps new users with the onboarding on our platform. |
| 154 | + |
| 155 | +Located `src/apps/onboarding`. |
| 156 | + |
| 157 | +#### Profiles App |
| 158 | +Application that allows users to manage their own profile data, and allows visitors to view user details and participation statistics for a specific member. |
| 159 | + |
| 160 | +Located `src/apps/profiles`. |
| 161 | + |
| 162 | +#### Talent Search App |
| 163 | +This is an internal app for finding members based on skills and other search facets. |
| 164 | + |
| 165 | +Located `src/apps/talent-search`. |
| 166 | + |
| 167 | +#### Skills Manager |
| 168 | +Admin app that allows one to manage the standardized skills. |
| 169 | + |
| 170 | +Located `src/apps/skills-manager`. |
| 171 | + |
| 172 | +#### Self Service |
| 173 | +Application that allows customers to submit/start challenges self-service. |
| 174 | + |
| 175 | +Located `src/apps/self-service`. |
| 176 | + |
| 177 | +#### Wallet App |
| 178 | +This app allows members to manage details regarding their payments. |
| 179 | + |
| 180 | +Located `src/apps/wallet`. |
| 181 | + |
0 commit comments