@espresso-org/aragon-comments
v0.0.8
Published
Add comments to any Aragon app
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-commentsUsage
- Import and inherit the
HasCommentssolidity smart contract.
import "@espresso-org/aragon-comments/contracts/HasComments.sol";
contract MyApp is HasComments, AragonApp {
...
}- Add the
postCommentfunction 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
CommentThreadreact 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 Commentsapp to your DAO.
aragon dao install <dao address> aragon-comments