From 3f7d45d309d3a2c023353425a7ef0b045052a546 Mon Sep 17 00:00:00 2001
From: Kamen Stoykov
- 12,345
+ {dapp.sntValue}
-
+
Upvote
-
+
Downvote
@@ -65,9 +72,13 @@ DappListItem.defaultProps = {
showActionButtons: false,
}
-DappListItem.propTypes = Object.assign({}, DappModel, {
+DappListItem.propTypes = {
+ dapp: PropTypes.shape(DappModel).isRequired,
+ isRanked: PropTypes.bool,
+ showActionButtons: PropTypes.bool,
+ position: PropTypes.number.isRequired,
onClickUpVote: PropTypes.func.isRequired,
onClickDownVote: PropTypes.func.isRequired,
-})
+}
export default DappListItem
diff --git a/src/common/components/Modal/Modal.jsx b/src/common/components/Modal/Modal.jsx
index d9f57b5..87bf100 100644
--- a/src/common/components/Modal/Modal.jsx
+++ b/src/common/components/Modal/Modal.jsx
@@ -32,6 +32,7 @@ Modal.defaultProps = {
modalClassName: '',
windowClassName: '',
contentClassName: '',
+ children: null,
}
Modal.propTypes = {
@@ -42,7 +43,7 @@ Modal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
- ]).isRequired,
+ ]),
onClickClose: PropTypes.func.isRequired,
}
diff --git a/src/common/data/dapps.js b/src/common/data/dapps.js
index aaa85cb..c3e2f26 100644
--- a/src/common/data/dapps.js
+++ b/src/common/data/dapps.js
@@ -8,6 +8,8 @@ const Dapps = [
description: 'Meet the future of trading',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Bancor',
@@ -16,6 +18,8 @@ const Dapps = [
description: 'Bancor is a decentralized liquidity network',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Kyber',
@@ -25,6 +29,8 @@ const Dapps = [
image: '/images/dapps/kyber.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Uniswap',
@@ -34,6 +40,8 @@ const Dapps = [
image: '/images/dapps/uniswap.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-23',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'DAI by MakerDao',
@@ -42,6 +50,8 @@ const Dapps = [
image: '/images/dapps/dai.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Augur',
@@ -51,6 +61,8 @@ const Dapps = [
image: '/images/dapps/augur.svg',
category: Categories.EXCHANGES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'LocalEthereum',
@@ -59,6 +71,8 @@ const Dapps = [
image: '/images/dapps/local-ethereum.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Eth2phone',
@@ -67,6 +81,8 @@ const Dapps = [
image: '/images/dapps/eth2phone.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'DDEX',
@@ -76,6 +92,8 @@ const Dapps = [
image: '/images/dapps/ddex.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Nuo',
@@ -85,6 +103,8 @@ const Dapps = [
image: '/images/dapps/nuo.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'EasyTrade',
@@ -93,6 +113,8 @@ const Dapps = [
image: '/images/dapps/easytrade.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'slow.trade',
@@ -102,6 +124,8 @@ const Dapps = [
image: '/images/dapps/slowtrade.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Expo Trading',
@@ -110,6 +134,8 @@ const Dapps = [
image: '/images/dapps/expotrading.png',
category: Categories.EXCHANGES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'blockimmo',
@@ -119,6 +145,8 @@ const Dapps = [
image: '/images/dapps/blockimmo.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoCribs',
@@ -127,6 +155,8 @@ const Dapps = [
image: '/images/dapps/cryptocribs.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Ethlance',
@@ -136,6 +166,8 @@ const Dapps = [
image: '/images/dapps/ethlance.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'OpenSea',
@@ -144,6 +176,8 @@ const Dapps = [
image: '/images/dapps/opensea.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'KnownOrigin',
@@ -152,6 +186,8 @@ const Dapps = [
image: '/images/dapps/knownorigin.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'dBay',
@@ -160,6 +196,8 @@ const Dapps = [
image: '/images/dapps/dBay.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-23',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Name Bazaar',
@@ -168,6 +206,8 @@ const Dapps = [
image: '/images/dapps/name-bazaar.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'The Bounties Network',
@@ -176,6 +216,8 @@ const Dapps = [
image: '/images/dapps/bounties-network.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Emoon',
@@ -185,6 +227,8 @@ const Dapps = [
image: '/images/dapps/emoon.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Astro Ledger',
@@ -193,6 +237,8 @@ const Dapps = [
image: '/images/dapps/astroledger.svg',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'SuperRare',
@@ -202,6 +248,8 @@ const Dapps = [
image: '/images/dapps/superrare.png',
category: Categories.MARKETPLACES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoCare',
@@ -211,6 +259,8 @@ const Dapps = [
image: '/images/dapps/cryptocare.jpg',
category: Categories.COLLECTIBLES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoKitties',
@@ -219,6 +269,8 @@ const Dapps = [
image: '/images/dapps/cryptokitties.png',
category: Categories.COLLECTIBLES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Cryptographics',
@@ -228,6 +280,8 @@ const Dapps = [
image: '/images/dapps/cryptographics.png',
category: Categories.COLLECTIBLES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoPunks',
@@ -236,6 +290,8 @@ const Dapps = [
image: '/images/dapps/cryptopunks.png',
category: Categories.COLLECTIBLES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Crypto Takeovers',
@@ -244,6 +300,8 @@ const Dapps = [
image: '/images/dapps/cryptotakeovers.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoFighters',
@@ -252,6 +310,8 @@ const Dapps = [
image: '/images/dapps/cryptofighters.png',
category: Categories.GAMES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Decentraland',
@@ -261,6 +321,8 @@ const Dapps = [
image: '/images/dapps/decentraland.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Dragonereum',
@@ -269,6 +331,8 @@ const Dapps = [
image: '/images/dapps/dragonereum.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Etherbots',
@@ -277,6 +341,8 @@ const Dapps = [
image: '/images/dapps/etherbots.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Etheremon',
@@ -285,6 +351,8 @@ const Dapps = [
image: '/images/dapps/etheremon.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'CryptoStrikers',
@@ -293,6 +361,8 @@ const Dapps = [
image: '/images/dapps/cryptostrikers.png',
category: Categories.GAMES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
// {
// name: 'FairHouse',
@@ -301,6 +371,8 @@ const Dapps = [
// image: '/images/dapps/fairhouse.png',
// category: Categories.GAMES,
// dateAdded: '2019-04-11',
+ // sntValue: 12345,
+ // categoryPosition: 2,
// },
{
name: 'Cent',
@@ -309,6 +381,8 @@ const Dapps = [
image: '/images/dapps/cent.png',
category: Categories.SOCIAL_NETWORKS,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Kickback',
@@ -318,6 +392,8 @@ const Dapps = [
image: '/images/dapps/kickback.png',
category: Categories.SOCIAL_NETWORKS,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Peepeth',
@@ -326,6 +402,8 @@ const Dapps = [
image: '/images/dapps/peepeth.png',
category: Categories.SOCIAL_NETWORKS,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'livepeer.tv',
@@ -334,6 +412,8 @@ const Dapps = [
image: '/images/dapps/livepeer.png',
category: Categories.OTHER,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Aragon',
@@ -342,6 +422,8 @@ const Dapps = [
image: '/images/dapps/aragon.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Compound Finance',
@@ -351,6 +433,8 @@ const Dapps = [
image: '/images/dapps/compoundfinance.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'InstaDApp',
@@ -359,6 +443,8 @@ const Dapps = [
image: '/images/dapps/instadapp.jpg',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Livepeer',
@@ -367,6 +453,8 @@ const Dapps = [
image: '/images/dapps/livepeer.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'ETHLend',
@@ -375,6 +463,8 @@ const Dapps = [
image: '/images/dapps/ethlend.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Civitas',
@@ -383,6 +473,8 @@ const Dapps = [
image: '/images/dapps/civitas.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: '3Box',
@@ -391,6 +483,8 @@ const Dapps = [
image: '/images/dapps/3Box.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Hexel',
@@ -399,6 +493,8 @@ const Dapps = [
image: '/images/dapps/hexel.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-11',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'Smartz',
@@ -407,6 +503,8 @@ const Dapps = [
image: '/images/dapps/smartz.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
{
name: 'SNT Voting DApp',
@@ -416,6 +514,8 @@ const Dapps = [
image: '/images/dapps/snt-voting.png',
category: Categories.UTILITIES,
dateAdded: '2019-04-05',
+ sntValue: 12345,
+ categoryPosition: 2,
},
]
diff --git a/src/common/data/vote.js b/src/common/data/vote.js
index 5e9b41c..8c95680 100644
--- a/src/common/data/vote.js
+++ b/src/common/data/vote.js
@@ -1,5 +1,8 @@
const vote = {
visible: false,
+ dapp: null,
+ isUpvote: false,
+ sntValue: '0',
}
export default vote
diff --git a/src/common/utils/models.js b/src/common/utils/models.js
index 60cdc98..b4cd760 100644
--- a/src/common/utils/models.js
+++ b/src/common/utils/models.js
@@ -7,9 +7,8 @@ export const DappModel = {
description: PropTypes.string,
category: PropTypes.string,
dateAdded: PropTypes.string,
- isRanked: PropTypes.bool,
- position: PropTypes.number,
- showActionButtons: PropTypes.bool,
+ sntValue: PropTypes.number,
+ categoryPosition: PropTypes.number,
}
export const DappListModel = PropTypes.arrayOf(PropTypes.shape(DappModel))
diff --git a/src/modules/RecentlyAdded/RecentlyAdded.selector.js b/src/modules/RecentlyAdded/RecentlyAdded.selector.js
index 1db81bd..a883e60 100644
--- a/src/modules/RecentlyAdded/RecentlyAdded.selector.js
+++ b/src/modules/RecentlyAdded/RecentlyAdded.selector.js
@@ -11,7 +11,7 @@ const recentDapps = createSelector(
return (
moment(dapp.dateAdded).toISOString() >
moment()
- .subtract(21, 'days')
+ .subtract(31, 'days')
.utc()
.toISOString()
)
diff --git a/src/modules/Vote/Vote.container.js b/src/modules/Vote/Vote.container.js
index 2771e20..80a369f 100644
--- a/src/modules/Vote/Vote.container.js
+++ b/src/modules/Vote/Vote.container.js
@@ -1,7 +1,12 @@
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import Vote from './Vote'
-import { closeVoteAction } from './Vote.reducer'
+import {
+ closeVoteAction,
+ switchToUpvoteAction,
+ switchToUpDownvoteAction,
+ onInputSntValueAction,
+} from './Vote.reducer'
const mapStateToProps = state => state.vote
const mapDispatchToProps = dispatch => ({
@@ -9,6 +14,9 @@ const mapDispatchToProps = dispatch => ({
window.history.back()
dispatch(closeVoteAction())
},
+ onClickUpvote: () => dispatch(switchToUpvoteAction()),
+ onClickDownvote: () => dispatch(switchToUpDownvoteAction()),
+ onInputSntValue: sntValue => dispatch(onInputSntValueAction(sntValue)),
})
export default withRouter(
diff --git a/src/modules/Vote/Vote.jsx b/src/modules/Vote/Vote.jsx
index 913fa25..352970f 100644
--- a/src/modules/Vote/Vote.jsx
+++ b/src/modules/Vote/Vote.jsx
@@ -7,6 +7,7 @@ import CategoriesUtils from '../Categories/Categories.utils'
import Categories from '../../common/utils/categories'
import icon from '../../common/assets/images/icon.svg'
import Modal from '../../common/components/Modal'
+import { DappModel } from '../../common/utils/models'
const getCategoryName = category =>
Categories.find(x => x.key === category).value
@@ -14,46 +15,36 @@ const getCategoryName = category =>
class Vote extends Component {
constructor(props) {
super(props)
- this.state = {
- isUpvote: true,
- sntValue: 0,
- }
- this.onClickTab = this.onClickTab.bind(this)
this.handleChange = this.handleChange.bind(this)
}
- onClickTab(showUpvote) {
- return () => {
- this.setState({ isUpvote: showUpvote })
- }
- }
-
handleChange(e) {
const { value } = e.target
if (value !== '' && /^[1-9][0-9]*$/.test(value) === false) return
+
if (parseInt(value, 10) > 1571296) return
- this.setState({ sntValue: value })
+ const { onInputSntValue } = this.props
+ onInputSntValue(value)
}
render() {
- const { isUpvote, sntValue } = this.state
- const { visible, onClickClose } = this.props
+ const {
+ visible,
+ onClickClose,
+ isUpvote,
+ dapp,
+ onClickUpvote,
+ onClickDownvote,
+ sntValue,
+ } = this.props
- // TODO: extract these to props
-
- const dapp = {
- name: 'Kyber',
- url: 'https://web3.kyber.network',
- description:
- 'On-chain, instant and liquid platform for exchange and payment service',
- image: '/images/dapps/kyber.png',
- category: 'EXCHANGES',
- dateAdded: null,
+ if (dapp === null) {
+ return