This is the web app components package library for the Terraware application from Terraformation.
This package primarily provides UI components for reuse in the web app repo.
This project was bootstrapped with Create React App.
If you're not a Terraformation employee, thanks for checking this repo out!
We're offering this project as Apache-licensed open source in the interest of sharing our technology with the world and being transparent about our work. Our mission is to accelerate global native forest restoration, and we believe we'll get there faster by sharing what we do.
For the moment, we're not asking for code contributions from the community. (Check our careers page if you're itching to work on this code!)
You may see references to some private repositories in the documentation. We're working toward opening more of our code, but not everything is ready yet.
Make sure you're using Node 24
With nvm:
nvm useyarnExecute the following commands:
yarn startYou can add a comment to your open pull request with the text "publish rc".
This will publish an RC build to NPM for use in your repo that consumes web-components with a tag like v2.3.58-rc.0.
In the project directory, you can run:
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
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!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will
remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right
into your project so you have full control over them. All of the commands except eject will still work, but they will
point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you
shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t
customize it when you are ready for it.
Execute the following commands:
yarn lintUpdate the style-dictionary/generate.sh script to download the tokens json and then run:
yarn build-dictionaryComponents read their text from the string tables in src/strings rather than taking it as props.
Use useStrings() in a component, or getStrings() in code that can't hold a hook. Applications
pick the language by calling setLocale('es') — until they do, everything renders in English.
src/strings/csv/en.csv is the only file you edit by hand. The src/strings/strings-*.ts tables are
generated from it and aren't checked in, so run this after editing the CSV:
yarn generate-stringsyarn install does this for you, which is also how CI gets the tables. If you see TypeScript
complaining that ./strings-en doesn't exist, that's the step you're missing.
Translations are generated with OpenAI, so you need an API key — get one from your OpenAI account
administrator or the OpenAI console, and put it in .env as
OPENAI_API_KEY. Then, after editing en.csv:
yarn translateThat translates the new or changed strings and regenerates the tables. If you'd rather not do it by
hand each time, yarn translate:start watches en.csv in the background instead. Editing a
translation directly in es.csv or fr.csv is fine too; autotranslate only touches strings whose
English text has changed.
- Copy svgs to
./assets - Run
yarn generate-assets, see new files under./src/components/svgas asset React components - Integrate new asset React component into
./src/components/Icon/icons/index.tsxif needed as an icon
You might see an error like this when running Storybook:
Error: error:0308010C:digital envelope routines::unsupported
storybook/preview.js undefinedThis means you are on a version of Node > 16.
Set your Node version to 16, re-install dependencies, and try yarn start again.
See https://stackoverflow.com/a/69699772 for more info.