UI changes and sending wallet

This commit is contained in:
Richard Ramos 2018-08-22 16:26:33 -04:00
parent 998e5e0208
commit fabad3e1fd
4 changed files with 6 additions and 5 deletions

View File

@ -57,7 +57,7 @@ MongoClient.connect(connString, {useNewUrlParser:true}, function (err, client) {
{'id': vote.id},
{
'$inc': {score: choice},
'$push': {'votes': {'account': vote.account, choice}}
'$push': {'votes': {'account': vote.account, wallet: vote.wallet, choice}}
},
(err) => {
if(err){

View File

@ -124,7 +124,7 @@ class App extends Component {
<Header toggleForm={this._toggleForm} sortOrder={this._setSortOrder} search={this._search} />
{ displayForm && <Create afterPublish={this._loadPosts} /> }
{ !account && <SnackbarContent message="This DApp requires CONTACT_CODE permission from the Status app to enable voting" /> }
{ orderedList.length == 0 && <Typography variant="display2" style={{marginTop: 30, textAlign: 'center'}}>
{ orderedList.length == 0 && <Typography variant="display1" style={{marginTop: 40, textAlign: 'center'}}>
Loading items... <CircularProgress />
</Typography> }
{ orderedList.map((record) => <Post account={account} key={record.id} {...record} filterBy={filterBy} updateVotes={this._updateVotes} votingEnabled={account !== null && !votes.includes(record.hash) && canVote} />) }

View File

@ -67,8 +67,8 @@ class Header extends Component {
<SearchBar
placeholder="Search..."
style={{
margin: '10px 10px',
maxWidth: 280
marginTop: '10px',
marginBottom: '10px'
}}
onChange={(searchValue) => search(searchValue)}
/>

View File

@ -12,6 +12,7 @@ import Grid from '@material-ui/core/Grid';
import axios from 'axios';
import config from '../config';
import EmbarkJS from 'Embark/EmbarkJS';
import web3 from 'Embark/web3';
const styles = theme => ({
actions: {
@ -98,7 +99,7 @@ class Post extends Component {
});
const ipfsHash = this.props.hash;
await axios.post(config.server + '/vote', {id: ipfsHash, account: this.props.account, selection: choice});
await axios.post(config.server + '/vote', {id: ipfsHash, account: this.props.account, wallet: web3.eth.defaultAccount, selection: choice});
this.props.updateVotes(this.props.id);