D8-X / d8x-trader-frontend-lite

Other
0 stars 7 forks source link

Disclaimer and Terms of Service

Usage of this repository is subject to the Terms of Service and the D8X Protocol Software Disclaimer as specified on D8X Exchange


Pre-flight checklist

Configuring the Frontend Kit

This package is configured entirely via environment variables. You must specify:


Branding the Frontend Kit

Logo

Header logo

A default logo with text is located under this path src/assets/logoWithText.svg

The logo with text is used in:

You can update the svg file.

Footer logo

A default static logo is contained in src/assets/logo.svg

You can update the svg file.

Colors & Color scheme

By default, the FE supports a light and a dark color theme

How to modify existing themes

Colors are defined in scss files in src/styles

Colors for TradingView chart

Fonts

Fonts can be specified in src/styles/theme/index.scss

Background

By default, the FE has a mobile, a tablet and a desktop background. The background is handled by src/components/static-background/StaticBackground.tsx

Mobile & Tablet background

The MobileBackground component is by default used for both the mobile and the table version of the FE. You can update the svg in assets/background/mobile-background.svg

You can also differentiate mobile from tablet background by:

Desktop Background

For desktop, the background is handled by the imported styles from ./StaticBackground.module.scss

PnL Poster

Backgrounds of the PnL poster are color scheme specific and are stored in src/assets/pnl-poster

Advanced styling options

Global styles are defined in src/styles/theme/theme.ts and in index.scss

Local styles are defined in corresponding components

Manifest

All the fields populated in the manifest, found in public/manifest.json, are required for the DApp to be properly integrated within third party applications. In particular, values in this file may be modified to reflect the branding, but no entries should be removed.


Development Guidelines

Project setup

Quantena testnet deployments

Setup autoformatting using Prettier

We have rules which are defined in the .prettierre.json file. These rules should work when code is saved.

Please set up it accordingly this topic: https://prettier.io/docs/en/editors.html.

Create environment file

Copy .env.example file and paste as .env file. Make changes if necessary.

Note: Without this environment file requests to server would not work.

Setup nvm

Note: for advance usage and better DX, setup automatic detection of .nvmrc config, e.g. explore this post

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.\ Open http://localhost:5173 to view it in the browser.

The page will reload if you make edits.\ You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.\ See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.\ It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\ Your app is ready to be deployed!

npm run preview

Starts a local web server that serves the built solution from ./build folder for preview.

npm run prepare

Note: run this once!

Creates configuration files for git hooks to work.

Note 1: In case .husky/pre-commit file is not created, run this command:

npx husky add .husky/pre-commit "npm run lint:staged"

Note 2: In case the .husky/pre-commit hook was ignored because it's not set as executable, run this command:

chmod ug+x .husky/*