# payee-portal
## Payee Portal

### Setup

Make sure your yarn and node versions are up to date.

```bash
cp .env.shadow .env # initialize environment configuration
`brew install yarn` or `apt-get install yarn` # make sure you have yarn
yarn # installs all package.json dependencies
yarn start # starts dev server
```

### Development

#### Running without a dev-box
You can run the application without a proper dev-box setup using mocked data.
Change your .env file to set `USE_MOCK_DATA=true`.
This will intercept requests and return the content of the files found in the `lib/fixtures` folder.

#### Adding new dependencies
To add a new dependency:

```
yarn add {dependency}
```

Then, be sure to add/commit the yarn.lock file.

#### Tasks

* `yarn start` runs local development server at localhost:8080
* `yarn test` to run the linter and unit tests
* `yarn lint` to run only the linter
* `yarn test:unit` to run only the unit tests
* `yarn watch` to run unit tests every time a change is saved

Note: to see all available tasks, run `yarn run`.

#### Internationalization (for future)

Support for Internationalization is done using [react-intl](https://github.com/yahoo/react-intl)
and you can find an example in [hello-world](/theorchard/docs/blob/master/boilerplates/react-webpack/src/components/example/hello-world.js).

Run the build to create the components and generate the list of strings:
```
$ yarn webpack
```

Prepare and export the strings to POEditor:
```
$ export POEDITOR_PROJECT_ID=<project_id>
$ export API_KEY=<api_key>
$ yarn i18n:export
```

Download the latest version of all the strings:
```
$ export POEDITOR_PROJECT_ID=<project_id>
$ export API_KEY=<api_key>
$ yarn i18n:import
```

All the above:
```
$ yarn i18n
```

To create the localized bundles (bundles that have both the right locale code)
and translation messages:

```
$ yarn build
```

If you wish to add support for a new locale, add in `/locale/` the following
folder structure: `<locale>/LC_MESSAGES/` and create in it a `messages.json` file.
 Note: the `<locale>` has to match the value in POEditor.

So if you wish to add French (`fr`), it will look like this:

```
$ cat react-webpack/locale/fr/LC_MESSAGES/message.json
{}
```
