Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create docs for extensions - Closes #1742 #1798

Merged
merged 9 commits into from Mar 22, 2019
78 changes: 78 additions & 0 deletions docs/EXTENSIONS_GUIDE.md
@@ -0,0 +1,78 @@
# Lisk Hub Extension Guideline
``` ⚠️ Extension System is not avaliable on Production build so please use 'npm run dev' command ⚠️```

## How to create a new extension?
In your extension, you will have access to `React` and `LiskHubExtensions` that allows adding Your extension to specified areas in our code.

![Alt text](./assets/create_extension_1.png?raw=true "Github File with extension")

For building Your Component, You can use es6 and our wrapper will transpaile it for You.

![Alt text](./assets/create_extension_2.png?raw=true "Github File with extension")

#### LiskHubExtensions
| Properties | Description |
| --------------- |---------------------------------------------|
| `addModule({ identifier, component })` | identifier: `String`, component: `Component` <br/> Adds new component to the place we specify |
| `components` | Contains shared styled components that We use in our app. |
| `identifiers` | Identifier you pass to addModule() `dashboardColumn1, dashboardColumn2, dashboardColumn3`. It will add your component below dashboard components in specific column |

![Alt text](./assets/create_extension_3.png?raw=true "Github File with extension")

#### Props
Data from our store is accessible via `this.props.data` and actions to modify our store are in `this.props.actions`. Keep in mind that We are not sharing all data and actions. In case You want to access sth that is unavailable let us know by creating a feature proposal/ticket in our repo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some hint on what props are available would be nice

```
data = {
latestBlocks,
transactions,
time,
accountAddress,
search,
}
actions={
testExtensions,
loadTransactions,
sent,
loadTransaction,
transactionsFilterSet,
searchDelegate,
searchVotes,
searchVoters,
searchAccount,
searchTransactions,
}
```

#### How to Share Your extension with others?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put here a note to distinguish between how it works now vs. how it should work in the future.

Once Your component was created You need to add it our [repository](https://github.com/michaeltomasik/extensions-lisk). In order to do it
1. Create your own fork or branch.
2. Add your component.
3. Create Pull Request.

First We need to verify Your code and then We will merge Your extension.

In the future we will aim to create extension manager so users can easily add extension they want to their app.

## How to add a new extension?

1. Open our [repository](https://github.com/michaeltomasik/extensions-lisk) with all extensions.
2. Click on the module you want to integrate.
3. Once You have file open click `Raw` to get the code.

![Alt text](./assets/add_extension_raw.png?raw=true "Github File with extension")

4. Copy url link.

![Alt text](./assets/add_extension_link.png?raw=true "Github raw link")

5. Open `/extensions` page
6. Paste Your url to input field and press Add Extension.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would expect some description of what will happen - the url is stored locally and when is the extension executed.


![Alt text](./assets/add_extension_page.png?raw=true "Extension page")
The url is stored locally and The code from the repository will be transpiled, executed and added to the place you declared.

7. Open page where You targeted Your component to be in lisk-hub.

![Alt text](./assets/add_extension_dashboard.png?raw=true "Extension added to dashboard")


Binary file added docs/assets/add_extension_dashboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/add_extension_link.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/add_extension_page.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/add_extension_raw.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/create_extension_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/create_extension_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/create_extension_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.