Merge branch 'deployment-email' of https://github.com/dap-ps/discover into fetching-dapps-flow

This commit is contained in:
Lyubomir Kiprov 2019-07-20 09:30:51 +03:00
commit 4713c11747
7 changed files with 58 additions and 12 deletions

View File

@ -64,16 +64,18 @@ const DappListItem = props => {
<img src={sntIcon} alt="SNT" width="16" height="16" />
{dapp.sntValue}
</span>
<div className={styles.voteTriggers}>
<span className={styles.vote} onClick={handleUpVote}>
<img src={upvoteArrowIcon} alt="" />
Upvote
</span>
<span className={styles.vote} onClick={handleDownVote}>
<img src={downvoteArrowIcon} alt="" />
Downvote
</span>
</div>
{dapp.sntValue > 0 && (
<div className={styles.voteTriggers}>
<span className={styles.vote} onClick={handleUpVote}>
<img src={upvoteArrowIcon} alt="" />
Upvote
</span>
<span className={styles.vote} onClick={handleDownVote}>
<img src={downvoteArrowIcon} alt="" />
Downvote
</span>
</div>
)}
</div>
)}
</div>

View File

@ -7,6 +7,7 @@ export default class DappModel {
this.sntValue = 0
// metadata
this.email = ''
this.name = ''
this.image = ''
this.desc = ''

View File

@ -2,6 +2,7 @@ const submit = {
visible_submit: false,
visible_rating: false,
id: '',
email: '',
name: '',
desc: '',
url: '',

View File

@ -67,7 +67,7 @@ embarkJSConnectorWeb3.getNetworkId = function() {
EmbarkJS.Blockchain.registerProvider('web3', embarkJSConnectorWeb3)
EmbarkJS.Blockchain.setProvider('web3', {})
if (!global.__Web3) {
const web3ConnectionConfig = require('/Users/georgispasov/Development/LimeLabs/status/discover/src/embarkArtifacts/config/blockchain.json')
const web3ConnectionConfig = require('./config/blockchain.json')
EmbarkJS.Blockchain.connect(web3ConnectionConfig, err => {
if (err) {
console.error(err)
@ -76,7 +76,7 @@ if (!global.__Web3) {
}
const namehash =
global.namehash ||
require('/Users/georgispasov/Development/LimeLabs/status/discover/src/embarkArtifacts/modules/eth-ens-namehash')
require('./modules/eth-ens-namehash')
;('use strict')
/*global namehash*/

View File

@ -18,6 +18,7 @@ import {
switchToRatingAction,
onInputSntValueAction,
updateAction,
onInputEmailAction,
} from './Submit.reducer'
import { showAlertAction } from '../Alert/Alert.reducer';
@ -25,6 +26,7 @@ const mapStateToProps = state =>
Object.assign(state.submit, { dappState: state.dapps })
const mapDispatchToProps = dispatch => ({
onClickClose: () => dispatch(closeSubmitAction()),
onInputEmail: name => dispatch(onInputEmailAction(name)),
onInputName: name => dispatch(onInputNameAction(name)),
onInputDesc: name => dispatch(onInputDescAction(name)),
onInputUrl: name => dispatch(onInputUrlAction(name)),

View File

@ -23,6 +23,7 @@ class Submit extends React.Component {
this.imgCanvas = React.createRef()
this.previousMoveX = 0
this.previousMoveY = 0
this.onInputEmail = this.onInputEmail.bind(this)
this.onInputName = this.onInputName.bind(this)
this.onInputDesc = this.onInputDesc.bind(this)
this.onInputUrl = this.onInputUrl.bind(this)
@ -71,6 +72,11 @@ class Submit extends React.Component {
imgNode.src = img
}
onInputEmail(e) {
const { onInputEmail } = this.props
onInputEmail(e.target.value)
}
onInputName(e) {
const { onInputName } = this.props
onInputName(e.target.value)
@ -169,6 +175,7 @@ class Submit extends React.Component {
onSubmit,
onUpdate,
id,
email,
name,
desc,
url,
@ -178,6 +185,7 @@ class Submit extends React.Component {
} = this.props
const metadata = {
email,
name,
url,
image: img,
@ -214,6 +222,8 @@ class Submit extends React.Component {
visible_submit,
visible_rating,
onClickClose,
email,
id,
name,
desc,
url,
@ -265,6 +275,19 @@ class Submit extends React.Component {
{visible_submit && (
<div className={imgControl ? styles.cntWithImgControl : ''}>
<div className={imgControl ? styles.withImgControl : ''}>
{id === '' && (
<div className={styles.block}>
<div className={styles.labelRow}>
<span>Your eMail</span>
</div>
<input
className={styles.input}
placeholder="eMail"
value={email}
onChange={this.onInputEmail}
/>
</div>
)}
<div className={styles.block}>
<div className={styles.labelRow}>
<span>Name of your Ðapp</span>
@ -473,6 +496,7 @@ class Submit extends React.Component {
Submit.propTypes = {
visible_submit: PropTypes.bool.isRequired,
visible_rating: PropTypes.bool.isRequired,
email: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
desc: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
@ -485,6 +509,7 @@ Submit.propTypes = {
imgControlY: PropTypes.number.isRequired,
sntValue: PropTypes.string.isRequired,
onClickClose: PropTypes.func.isRequired,
onInputEmail: PropTypes.func.isRequired,
onInputName: PropTypes.func.isRequired,
onInputDesc: PropTypes.func.isRequired,
onInputUrl: PropTypes.func.isRequired,

View File

@ -16,6 +16,7 @@ import BlockchainSDK from '../../common/blockchain'
const SHOW_SUBMIT_AFTER_CHECK = 'SUBMIT_SHOW_SUBMIT_AFTER_CHECK'
const CLOSE_SUBMIT = 'SUBMIT_CLOSE_SUBMIT'
const ON_INPUT_EMAIL = 'SUBMIT_ON_INPUT_EMAIL'
const ON_INPUT_NAME = 'SUBMIT_ON_INPUT_NAME'
const ON_INPUT_DESC = 'SUBMIT_ON_INPUT_DESC'
const ON_INPUT_URL = 'SUBMIT_ON_INPUT_URL'
@ -81,6 +82,11 @@ export const closeSubmitAction = () => {
}
}
export const onInputEmailAction = email => ({
type: ON_INPUT_EMAIL,
payload: email,
})
export const onInputNameAction = name => ({
type: ON_INPUT_NAME,
payload: name,
@ -145,6 +151,7 @@ export const submitAction = (dapp, sntValue) => {
try {
const blockchain = await BlockchainSDK.getInstance()
const { tx, id } = await blockchain.DiscoverService.createDApp(sntValue, {
email: dapp.email,
name: dapp.name,
url: dapp.url,
description: dapp.description,
@ -199,6 +206,7 @@ const showSubmitAfterCheck = (state, dapp) => {
visible_submit: true,
visible_rating: false,
id: dapp !== undefined ? dapp.id : '',
email: dapp !== undefined ? dapp.email : '',
name: dapp !== undefined ? dapp.name : '',
desc: dapp !== undefined ? dapp.description : '',
url: dapp !== undefined ? dapp.url : '',
@ -219,6 +227,12 @@ const closeSubmit = state => {
})
}
const onInputEmail = (state, email) => {
return Object.assign({}, state, {
email,
})
}
const onInputName = (state, name) => {
return Object.assign({}, state, {
name,
@ -303,6 +317,7 @@ const onInputSntValue = (state, sntValue) => {
const map = {
[SHOW_SUBMIT_AFTER_CHECK]: showSubmitAfterCheck,
[CLOSE_SUBMIT]: closeSubmit,
[ON_INPUT_EMAIL]: onInputEmail,
[ON_INPUT_NAME]: onInputName,
[ON_INPUT_DESC]: onInputDesc,
[ON_INPUT_URL]: onInputUrl,