Our webapp's frontend
|
|
||
|---|---|---|
| .vscode | ||
| public | ||
| src | ||
| .env | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| docker-compose.dev.yml | ||
| docker-compose.prod.yml | ||
| docker-compose.staging.yml | ||
| docker-compose.streamline.yml | ||
| Dockerfile | ||
| eslint.config.js | ||
| index.html | ||
| indexV2.html | ||
| nginx.conf | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
White-labeling
Steps to add a new white label
- Client Instructions:
- supply assets and colours to be used for the white-label (favicon if necessary)
- determine a sub-domain to use as mask, dashboard is preferred (ex: dashboard.example.com)
- add a
CNAMErecord pointing their custom subdomain (ex: dashboard.example.com) to brandxtech.ca - add a login button on their website point to
/loginof their custom subdomain (ex: dashboard.example.com/login)
- Create a PWA folder in
publicthat is named after the client and generate PWA assets using this website (use the company logo but you might need to use a custom favicon depending on the result)
- https://maskable.app/ also create a maskable icon for PWA
- create a 512x512 png as well for PWA
- Create a white-label branding folder in
src/assets/whitelabelsand create adarkLogo.pngandlightLogo.pngfrom the client's logo - In
src/services/whiteLabel.ts, add a newWhitelabelinstance with the required fields and add its hostname mapping to thewhitelabelsmap (it is very similar to step one but had some constraints when dealing with thepublicfolder) - If there are any pages specific to the whitelabel be sure to update the side and bottom navigator
-
In
dynamic-config.prod.yml, add a router entry for the new whitelabel -
In
pond/http/server.go, add the sub-domain to theallowedOrigins -
In
pond/whitelabel.go, add an entry for the new white label -
Create a new
Auth0application for the client- use a image bucket like postimg to store their company logo and favicon
- add a whitelabel logo
- allow necessary
origins,callback URLs, andCORS domainsto the application settings (see the default application as a guideline) - customize the Universal Login page to handle the new whitelabel
- check if the client ID matches this client's Auth0 application
- change the Universal Login theme using white-label colours and images stored in a bucket (ex: postimg)
-
Enable the white-label sub-domain for CORS in the backend
- in http.go, add the white-label sub-domain to the
AllowedOriginslist
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
- Replace
tseslint.configs.recommendedtotseslint.configs.recommendedTypeCheckedortseslint.configs.strictTypeChecked - Optionally add
...tseslint.configs.stylisticTypeChecked - Install eslint-plugin-react and update the config:
// eslint.config.js
import react from 'eslint-plugin-react'
export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})