-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1304 from Chia-Network/update-readme-872024
docs: replace template README with existing README and update content
- Loading branch information
Showing
1 changed file
with
88 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,112 @@ | ||
# React + TypeScript + Vite | ||
# Climate Action Data Trust User Interface | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
This repository provides a graphical user interface (UI) for the [Climate Action Data Trust (CADT)](https://github.com/Chia-Network/cadt) application. CADT interfaces with the Chia Blockchain software and provides and API for entering and retrieving carbon data. This UI is a javascript application that connects to the CADT API for a convenient way to access the data. | ||
|
||
Currently, two official plugins are available: | ||
*Note that this application was previously called the Climate Warehouse UI and that name may be used interchangeably in documentation and throughout this application.* | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
||
## Expanding the ESLint configuration | ||
## Installation | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
The UI application can be hosted as a web application and accessed via the browser, or as a desktop application packaged with Electron. Currently the application is only packaged for x86 platforms, though building from source is expected to work on ARM. | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
### Desktop Applications | ||
|
||
```js | ||
export default { | ||
// other rules... | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './tsconfig.node.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
} | ||
The [releases](https://github.com/Chia-Network/cadt-ui/releases) page provides desktop applications packaged for Windows, Mac, and Debian-based Linux distributions. | ||
|
||
#### Ubuntu Desktop via Apt | ||
|
||
For Ubuntu-based Linux desktops the CADT UI is available for install with `apt`. | ||
|
||
1. Start by updating apt and allowing repository download over HTTPS: | ||
|
||
``` | ||
sudo apt-get update | ||
sudo apt-get install ca-certificates curl gnupg | ||
``` | ||
|
||
2. Add Chia's official GPG Key (if you have installed Chia or [CADT](https://github.com/Chia-Network/cadt) with `apt`, you'll have this key already and will get a message about overwriting the existing key, which is safe to do): | ||
|
||
``` | ||
curl -sL https://repo.chia.net/FD39E6D3.pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/chia.gpg | ||
``` | ||
|
||
3. Use the following command to setup the repository. | ||
|
||
``` | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chia.gpg] https://repo.chia.net/cadt/debian/ stable main" | sudo tee /etc/apt/sources.list.d/cadt.list > /dev/null | ||
``` | ||
|
||
4. Install CADT-UI | ||
|
||
``` | ||
sudo apt-get update | ||
sudo apt-get install cadt-ui | ||
``` | ||
|
||
|
||
### Web Application | ||
|
||
The CADT UI can be hosted as a web application, either for internal use, or made available to the public. When operating as a web application, the user's browser must be able to connect to the [CADT API](https://github.com/Chia-Network/cadt). This means the API must be available on the public internet if the UI is public. The `READ_ONLY` option on the API should be set when running a public observer node. | ||
|
||
To host the UI on the web, use the [web-build.tar.gz file from the releases page](https://github.com/Chia-Network/cadt-ui/releases). One of the simplest solutions is to uncompress these files into a [public S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteAccessPermissionsReqd.html). These files could also be served by any webserver, such as Nginx or Apache. | ||
|
||
To make the CADT UI web application automatically connect to a CADT host by default, build the application from source (`npm install && npm run build`) with the following environment variables set: | ||
|
||
* `REACT_APP_API_HOST`: Set to the URL of the CADT API, including the `/v1` path. For example: `https://www.example.com:31310/v1` | ||
* `REACT_APP_APP_URL`: Set to the URL of the UI application. | ||
|
||
### From Source | ||
|
||
*It is recommended to use the pre-built application from the releases page or the apt repo and only build from source if contributing code to the application* | ||
|
||
|
||
``` | ||
git clone [email protected]:Chia-Network/cadt-ui.git | ||
cd cadt-ui | ||
nvm install | ||
nvm use | ||
npm install | ||
npm install -g git-authors-cli | ||
npm run start | ||
``` | ||
|
||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` | ||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list | ||
#### Prerequisites | ||
|
||
### Contributing | ||
You'll need: | ||
|
||
All branches should be created from the `develop` branch and not from `main`. All pull requests should be made against the `develop` branch, unless it is a new release. The `develop` branch will be merged into the `main` branch to create a release. Automation in the CI will create the [release](https://github.com/Chia-Network/cadt/releases) and attach the installation files to it automatically whenever code is merged to `main`. Additionally, the changelog will automatically be updated in the `main` branch. Therefore, the `main` branch should always be a representation of the latest released code. | ||
- Git | ||
- [nvm](https://github.com/nvm-sh/nvm) | ||
|
||
This app uses `nvm` to align node versions across development, CI and production. If you're working on Windows you should consider [nvm-windows](https://github.com/coreybutler/nvm-windows) | ||
|
||
## Contributing | ||
|
||
Upon your first commit, you will automatically be added to the package.json file as a contributor. | ||
|
||
## Commiting | ||
|
||
This repo uses a commit convention. A typical commit message might read: | ||
|
||
This repo uses a [commit convention](https://www.conventionalcommits.org/en/v1.0.0/). A typical commit message might read: | ||
| ||
``` | ||
fix: correct home screen layout | ||
``` | ||
| ||
|
||
The first part of this is the commit "type". The most common types are "feat" for new features, and "fix" for bugfixes. Using these commit types helps us correctly manage our version numbers and changelogs. Since our release process calculates new version numbers from our commits it is very important to get this right. | ||
| ||
|
||
- `feat` is for introducing a new feature | ||
- `fix` is for bug fixes | ||
- `docs` for documentation only changes | ||
- `style` is for code formatting only | ||
- `refactor` is for changes to code which should not be detectable by users or testers | ||
- `perf` is for a code change that improves performance | ||
- `test` is for changes which only touch test files or related tooling | ||
- `build` is for changes which only touch our develop/release tools | ||
- `ci` is for changes to the continuous integration files and scripts | ||
- `chore` is for changes that don't modify code, like a version bump | ||
- `revert` is for reverting a previous commit | ||
| ||
After the type and scope there should be a colon. | ||
| ||
The "subject" of the commit follows. It should be a short indication of the change. The commit convention prefers that this is written in the present-imperative tense. | ||
- `chore` is for housekeeping tasks such as hydrating from another branch | ||
|
||
After the type and scope there should be a colon. | ||
|
||
The "subject" of the commit follows. It should be a short indication of the change. The commit convention prefers that this is written in the present-imperative tense. | ||
|
||
### Commit linting | ||
|
||
Each time you commit the message will be checked against these standards in a pre-commit hook. Additionally all the commits in a PR branch will be linted before it can be merged to master. |