Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
readme and revert to original example thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenzo committed Oct 23, 2019
1 parent a3004ab commit b6e3bcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
The Comments plugin is built using a standard implementation of [Open Threads](https://docs.3box.io/build/web-apps/messaging/choose#open-threads) which are defined in the [3Box Threads API](https://docs.3box.io/api/messaging) and made available via the [`3Box.js SDK`](https://github.com/3box/3box-js). The Comments plugin also includes UI for inputting and displaying user comments, logic for fetching user profiles, and pagination. The component is configurable to various authentication patterns, and can handle both Web3/3Box logged-in & logged-out states.

#### Authentication
Without authenticating, users can read messages in the comment thread. However authentication is required to perform more interactive functionality. After the user is authenticated, a user can post a comment, delete their comment, and receive comments from other users in *real-time*. Note: if you are not logged in and the component has not been passed your ethereum address, the component cannot know which comment belongs to you in order to delete. The ability to sign in without leaving a comment so that you can delete will be implemented soon.
Without authenticating, users can read messages in the comment thread. However authentication is required to perform more interactive functionality. After the user is authenticated, a user can post a comment, delete their comment, and receive comments from other users in *real-time*. Note: if you are not logged in and the component has not been passed your ethereum address, the component cannot know which comment belongs to you in order to delete. In this case, click the login button just below the input UI.
</br>
</br>

Expand Down Expand Up @@ -125,7 +125,7 @@ const MyComponent = ({ handleLogin, box, ethereum, myAddress, currentUser3BoxPro
| `threadName` | String | | Always | A name specific to this Comments thread. |
| `adminEthAddr` | String (Ethereum Address) | | Always | The Ethereum address you wish to give admin rights to for the Comments thread. This user will be able to delete all comments and accept members in a members-only thread. **A thread with a new admin address, despite identical `spaceName` and `threadName`, will create an entirely new thread.**|
| `box` | Object | | A (and likely B) | The `box` instance returned from running `await Box.openBox(address, web3)` somewhere in your dApp.|
| `currentUserAddr` | String (Ethereum Address) | | A & B | The current user's Ethereum address. Passing this will help determine whether a user has delete access on each comment. This prop will also let the component fetch that user's 3Box profile on component mount and render that data (profile picture) in the Comment input UI. |
| `currentUserAddr` | String (Ethereum Address) | | A & B, optional for C | The current user's Ethereum address. Passing this will help determine whether a user has delete access on each comment. This prop will also let the component fetch that user's 3Box profile on component mount and render that data (profile picture) in the Comment input UI. |
| `loginFunction` | Function | | B | A function from your dApp that handles web3 and 3Box login at the global dApp state. This callback will run when a user attempts to save a comment but a `box` instance doesn't yet exist. Running this function should result in a box instance (from `const box = Box.openBox(address, web3)`) being passed as the `box` prop to this component. |
| `ethereum` | Object | window.ethereum | C | The `ethereum` object from whichever web3 provider your dApp uses. The `enable` method on this object will be used to get the current user's Ethereum address and that address will be used to `openBox` within the current Component context.|
| `members` | Boolean | False | Optional | A boolean - `true` - to make the thread a members-only thread. Passing `false` will allow all users to post to the thread. **Changing this setting after creating it will result in an entirely different thread** (see [Docs.3box.io](https://Docs.3box.io) for more info). |
Expand Down
10 changes: 5 additions & 5 deletions examples/Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
// box: {},
box: {},
myProfile: {},
myAddress: '',
isReady: false,
Expand Down Expand Up @@ -51,18 +51,18 @@ class Example extends React.Component {
<Comments
// required
spaceName='3boxtestcomments'
threadName='ghostChatTest'
threadName='freshcomments'
adminEthAddr="0x2a0D29C819609Df18D8eAefb429AEC067269BBb6"

// case A & B
// box={box}
// currentUserAddr={myAddress}
box={box}
currentUserAddr={myAddress}

// case B
// loginFunction={this.handleLogin}

// case C
ethereum={window.ethereum}
// ethereum={window.ethereum}

// optional
// members={false}
Expand Down
2 changes: 1 addition & 1 deletion examples/dist/bundle.js

Large diffs are not rendered by default.

0 comments on commit b6e3bcd

Please sign in to comment.