@espresso-org/aragon-comments
v0.0.8
Published
Add comments to any Aragon app
Downloads
11
Readme
Aragon Comments
Aragon Comments
offers an easy way for developers to integrate discussion threads to their Aragon app.
Install
npm install --save @espresso-org/aragon-comments
Usage
- Import and inherit the
HasComments
solidity smart contract.
import "@espresso-org/aragon-comments/contracts/HasComments.sol";
contract MyApp is HasComments, AragonApp {
...
}
- Add the
postComment
function to your smart contract. This function lets you write custom validation logic on the author and message content before posting a comment to a discussion thread.
contract MyApp is HasComments, AragonApp {
function postComment(string comment, string threadName) public {
aragonComments.postComment(comment, msg.sender, threadName);
}
}
- Import and add the
CommentThread
react component to your javascript frontend.
import { CommentThread } from '@espresso-org/aragon-comments'
class App extends React.Component {
render () {
return (
<div>
...
<CommentThread
aragonApp={this.props.app}
thread="my-comment-thread"
/>
</div>
)
}
}
- Make sure to install the
Aragon Comments
app to your DAO.
aragon dao install <dao address> aragon-comments