Skip to content

Commit

Permalink
fix(read me): enhance cread me file and add coding guidelines (eclips…
Browse files Browse the repository at this point in the history
  • Loading branch information
manojava-gk authored Jul 16, 2024
1 parent 70218c7 commit 8c6da7a
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,82 @@ yarn start

Note: if you'd like to run the complete frontend application, follow the `Run frontend on localhost.md` guide available within the technical documentation of [portal-assets](https://github.com/eclipse-tractusx/portal-assets).

## Coding guidelines

### Naming conventions for custom components

Folder, File and component name to be in Camel Case\
Scss files to be in Camel Case\
RTK folders and files to be in small case

### Import Components

Always use components from [portal-shared-components library](https://github.com/eclipse-tractusx/portal-shared-components)\
Do not import components directly from mui

### Allowed imports from mui

Box, useMediaQuery

### Guidelines for consistent styling and theming

Do not use useTheme from mui\
Use theme from the [portal-shared-components library](https://github.com/eclipse-tractusx/portal-shared-components)\
Use custom class names to override default or mui styles\
Use appropriate `Typography` for the text and do not override font family of it

### Create new text locale file

Create a new file in the respective `language` folder with the module name in `assets/locales`\
Use small cases for the `json` file\

ex: notifications.json

### Add new text values in locale file

Keys inside `json` file should be in Camel Case\

ex: notificationTitle

### Read text values from locale file

Import `useTranslation` from `react-i18next`\
Declare translation object using the specific module\

```
const { t } = useTranslation('notification')
```

Empty in the usetransation() will pull the data from `main.json` file

```
const { t } = useTranslation()
```

Usage ex:

```
t('header.title')
```

### Code formatting and linting

Before committing your changes,

s1. Remove all the disabled linter rules from `.eslintrc.json` and run `yarn lint` on your newly created file or folder to see the results 2. Disable linter rules is allowd only for the exceptional cases. Code comments with proper reason is mandatory

### Handling of API responses and error states

1. All the api call has to be addressed with a throbber in the UI
2. Empty response to be shown with a proper message to the user
3. API error has to be shown in a component with appropriate action\
a. Error code 4xx needs to show error component with message\
b. Error code 5xx should allow user to refetch the api once again.

### State Managment

URL path names to be in Camel Case

## Known Issues and Limitations

See [Known Knowns](/CHANGELOG.md#known-knowns).
Expand Down

0 comments on commit 8c6da7a

Please sign in to comment.