Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bdba1d7
temp
leonprou Jun 17, 2019
6bb2639
adding user data to 3box
leonprou Jun 19, 2019
247147a
joining user
leonprou Jun 19, 2019
cc92ff5
fixing backend
leonprou Jun 20, 2019
57f2094
fix lint
leonprou Jun 20, 2019
c3f2bda
first commit
Jun 23, 2019
62fa4ff
for check
Jun 24, 2019
b5ef9dc
linter
Jun 24, 2019
8c8b986
save
leonprou Jun 30, 2019
5bae63e
fix lint
leonprou Jun 30, 2019
b21e4f0
minor UI changes
Jun 23, 2019
8c24355
more fixs
Jun 24, 2019
7ce9b9e
minor change
Jun 24, 2019
e13e97e
community page - fixed css
Jun 25, 2019
4d4c6e8
improve validation in transferForm & mintBurnForm
Jun 24, 2019
dca2c30
fixs
Jun 24, 2019
69b8630
refactor
Jun 25, 2019
1e098a8
ipad layout fixes
Jun 26, 2019
f4890e2
refactor communities page
Jun 26, 2019
c64e202
search field in users - css fixes
Jun 26, 2019
d2d7ce2
linter
Jun 26, 2019
7d35fd0
remove disabled from transfer
Jun 26, 2019
8a3f2a4
minor
Jun 26, 2019
c821640
Integrating Portis (#290)
leonprou Jun 30, 2019
52692ec
save
leonprou Jun 30, 2019
7a98058
fix lint
leonprou Jun 30, 2019
fedc1e2
delete dubgger
leonprou Jun 30, 2019
3aea268
add provider by private key
leonprou Jun 30, 2019
9ee56f6
fix
leonprou Jun 30, 2019
180d47f
fixing zerp provider for sending blocks
leonprou Jul 1, 2019
04548a7
fixing 3box
leonprou Jul 1, 2019
ef2a34c
fix portis and profiles
leonprou Jul 1, 2019
5467cd9
Merge branch '3box_mobile' into feature/mobile_app
Jul 1, 2019
7fe2788
WIP
Jul 1, 2019
852f81e
linter
Jul 1, 2019
aaeb6f8
Fixing errors for 3box
leonprou Jul 2, 2019
5fba0bd
undefined fix
leonprou Jul 2, 2019
ae83409
fix standard
leonprou Jul 2, 2019
f205df4
separate withNetwork and withAccount
leonprou Jul 2, 2019
4036ca5
set fuse provider to https
leonprou Jul 3, 2019
f824c42
some fixs
leonprou Jul 3, 2019
5cb43d1
Allow ngrok usage
leonprou Jul 7, 2019
217b2c2
added route to sign mobile users to 3box
Jul 9, 2019
df26c74
condition to load web3 fixed
Jul 9, 2019
83bc04b
minor
Jul 9, 2019
14c86a0
minor fix for check
Jul 10, 2019
d33e1ba
changed strategy
Jul 11, 2019
8cd3fc0
changed the way of redirection
Jul 11, 2019
a0f121b
fixed rediraction bug
Jul 11, 2019
068beef
redirect after join succes from mobile
Jul 15, 2019
02bfe4d
linter
Jul 15, 2019
7089e90
minor change
Jul 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dapp/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"web3": {
"apiKey": "COMMUNITY_WEB3_API_KEY"
"apiKey": "COMMUNITY_WEB3_API_KEY",
"portis": {
"id": "COMMMUNITY_WEB3_PORTIS_ID"
}
},
"api": {
"url": {
Expand Down
13 changes: 11 additions & 2 deletions dapp/config/default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"web3": {
"fuseProvider": "http://rpc.fuse.io",
"fuseProvider": "https://rpc.fuse.io",
"supportedNetworks": ["main", "ropsten", "fuse"],
"portis": {
},
"addresses": {
"ropsten": {
"ColuLocalNetwork": "0x41C9d91E96b933b74ae21bCBb617369CBE022530",
Expand Down Expand Up @@ -35,7 +37,14 @@
},
"options": {
"fuse": {
"gasPrice": 1e9
"gasPrice": 1e9,
"transactionConfirmationBlocks": 1
},
"ropsten": {
"transactionConfirmationBlocks": 1
},
"main": {
"transactionConfirmationBlocks": 2
}
}
},
Expand Down
1 change: 1 addition & 0 deletions dapp/config/production.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"web3": {
"fuseProvider": "https://rpc.fuse.io",
"addresses": {
"ropsten": {
"ColuLocalNetwork": "0x41C9d91E96b933b74ae21bCBb617369CBE022530",
Expand Down
3 changes: 3 additions & 0 deletions dapp/config/qa.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"web3": {
"fuseProvider": "https://rpc.fuse.io"
},
"api": {
"auth": {
"domain": {
Expand Down
14 changes: 9 additions & 5 deletions dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
]
},
"dependencies": {
"3box": "^1.9.0",
"@portis/web3": "^2.0.0-beta.30",
"@fuse/entities-contracts": "../contracts/entities/",
"@fuse/roles": "../packages/roles",
"@fuse/token-factory-contracts": "../contracts/token-factory/",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.4",
Expand All @@ -40,6 +45,7 @@
"config": "^1.30.0",
"connected-react-router": "^6.2.2",
"css-loader": "^2.1.1",
"ethereumjs-wallet": "^0.6.3",
"file-loader": "^1.1.11",
"formik": "^1.5.1",
"foundation-sites": "^6.5.3",
Expand Down Expand Up @@ -71,14 +77,12 @@
"sass-loader": "^7.0.1",
"style-loader": "^0.20.3",
"superagent": "^3.8.3",
"web3": "1.0.0-beta.37",
"web3": "^1.0.0-beta.55",
"web3-provider-engine": "git+https://github.com/mikeshultz/web3-provider-engine.git#skipcache-option",
"webpack": "^4.6.0",
"webpack-cli": "^3.1.2",
"websocket": "^1.0.28",
"yup": "^0.27.0",
"@fuse/token-factory-contracts": "../contracts/token-factory/",
"@fuse/entities-contracts": "../contracts/entities/",
"@fuse/roles": "../packages/roles"
"yup": "^0.27.0"
},
"devDependencies": {
"chai": "^4.1.2",
Expand Down
6 changes: 6 additions & 0 deletions dapp/src/actions/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ export const FETCH_BALANCES = createRequestTypes('FETCH_BALANCES')
export const FETCH_TOKENS_WITH_BALANCES = createRequestTypes('FETCH_TOKENS_WITH_BALANCES')
export const ADD_USER = createRequestTypes('ADD_USER')

export const SIGN_IN = createRequestTypes('SIGN_IN')
export const CREATE_3BOX_PROFILE = createRequestTypes('CREATE_3BOX_PROFILE')

export const balanceOfToken = (tokenAddress, accountAddress, options) => action(BALANCE_OF_TOKEN.REQUEST, { tokenAddress, accountAddress, options })
export const balanceOfNative = (accountAddress) => action(BALANCE_OF_NATIVE.REQUEST, { accountAddress })
export const balanceOfCln = (accountAddress) => action(BALANCE_OF_CLN.REQUEST, { accountAddress })

export const fetchBalances = (tokens, accountAddress) => action(FETCH_BALANCES.REQUEST, { accountAddress, tokens })
export const fetchTokensWithBalances = (accountAddress) => action(FETCH_TOKENS_WITH_BALANCES.REQUEST, { accountAddress })
export const fetchCommunities = (accountAddress) => communitiesAction(FETCH_COMMUNITIES.REQUEST, { accountAddress })

export const signIn = (accountAddress) => action(SIGN_IN.REQUEST, { accountAddress })
export const create3boxProfile = (accountAddress, data) => action(CREATE_3BOX_PROFILE.REQUEST, { accountAddress, data })
8 changes: 7 additions & 1 deletion dapp/src/actions/communityEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,24 @@ export const REMOVE_ADMIN_ROLE = createTransactionRequestTypes('REMOVE_ADMIN_ROL
export const CONFIRM_USER = createTransactionRequestTypes('CONFIRM_USER')

export const FETCH_ENTITY = createRequestTypes('FETCH_ENTITY')
export const JOIN_COMMUNITY = createRequestTypes('JOIN_COMMUNITY')
export const IMPORT_EXISTING_ENTITY = createRequestTypes('IMPORT_EXISTING_ENTITY')
export const UPLOAD_IMAGE = createRequestTypes('UPLOAD_IMAGE')

export const fetchEntities = (communityAddress) => entitiesAction(FETCH_USERS_ENTITIES.REQUEST, { communityAddress })
export const fetchUsersEntities = (communityAddress, entityType = 'user') => entitiesAction(FETCH_USERS_ENTITIES.REQUEST, { communityAddress, entityType })
export const fetchBusinessesEntities = (communityAddress, entityType = 'business') => entitiesAction(FETCH_BUSINESSES_ENTITIES.REQUEST, { communityAddress, entityType })

export const fetchEntity = (account) => entitiesAction(FETCH_ENTITY.REQUEST, { account })
export const fetchEntity = (communityAddress, account) => entitiesAction(FETCH_ENTITY.REQUEST, { communityAddress, account })

export const addEntity = (communityAddress, data, isClosed) => action(ADD_ENTITY.REQUEST, { communityAddress, data, isClosed })
export const removeEntity = (communityAddress, account) => action(REMOVE_ENTITY.REQUEST, { communityAddress, account })
export const addAdminRole = (account) => action(ADD_ADMIN_ROLE.REQUEST, { account })
export const removeAdminRole = (account) => action(REMOVE_ADMIN_ROLE.REQUEST, { account })
export const confirmUser = (account) => action(CONFIRM_USER.REQUEST, { account })
export const editEntity = (listAddress, hash, data) => action(EDIT_ENTITY.REQUEST, { listAddress, hash, data })
export const joinCommunity = (communityAddress, data) => action(JOIN_COMMUNITY.REQUEST, { communityAddress, data })
export const importExistingEntity = (accountAddress, communityAddress, isClosed) => action(IMPORT_EXISTING_ENTITY.REQUEST, { accountAddress, communityAddress, isClosed })
export const uploadImage = (image) => action(UPLOAD_IMAGE.REQUEST, { image })

export const toggleCommunityMode = (communityAddress, isClosed) => action(TOGGLE_COMMUNITY_MODE.REQUEST, { communityAddress, isClosed })
1 change: 1 addition & 0 deletions dapp/src/actions/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const entityName = 'metadata'

export const FETCH_METADATA = createRequestTypes('FETCH_METADATA')
export const CREATE_METADATA = createRequestTypes('CREATE_METADATA')
export const CREATE_ENTITY_METADATA = createRequestTypes('CREATE_ENTITY_METADATA')

export const fetchMetadata = (tokenURI) => action(FETCH_METADATA.REQUEST, { tokenURI })
export const createMetadata = (metadata) => action(CREATE_METADATA.REQUEST, { metadata })
4 changes: 3 additions & 1 deletion dapp/src/actions/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { requestAction, createRequestTypes } from './utils'
export const GET_NETWORK_TYPE = createRequestTypes('GET_NETWORK_TYPE')
export const GET_BLOCK_NUMBER = createRequestTypes('GET_BLOCK_NUMBER')

export const CHANGE_NETWORK = createRequestTypes('CHANGE_NETWORK')
export const UNSUPPORTED_NETWORK_ERROR = 'UNSUPPORTED_NETWORK_ERROR'

export const CHECK_ACCOUNT_CHANGED = createRequestTypes('CHECK_ACCOUNT_CHANGED')
Expand All @@ -11,9 +12,10 @@ export const ACCOUNT_LOGGED_OUT = 'ACCOUNT_LOGGED_OUT'
export const FETCH_GAS_PRICES = createRequestTypes('FETCH_GAS_PRICES')

export const getNetworkType = () => requestAction(GET_NETWORK_TYPE)
export const getBlockNumber = (networkType, bridgeType) => requestAction(GET_BLOCK_NUMBER, { networkType, bridgeType })

export const changeNetwork = (networkType) => requestAction(CHANGE_NETWORK, { networkType })
export const checkAccountChanged = (selectedAddress) => requestAction(CHECK_ACCOUNT_CHANGED,
{ selectedAddress })

export const fetchGasPrices = () => requestAction(FETCH_GAS_PRICES)
export const getBlockNumber = (networkType, bridgeType) => requestAction(GET_BLOCK_NUMBER, { networkType, bridgeType })
24 changes: 7 additions & 17 deletions dapp/src/components/common/CommunityLogo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,26 @@ import React from 'react'
import PropTypes from 'prop-types'
import Loader from 'components/common/Loader'
import classNames from 'classnames'
// import logoDarkBlue from 'images/token-dark_blue.svg'
// import logoGreen from 'images/token-green.svg'
// import logoGreenGradiant from 'images/token-green_gradient.svg'
// import logoMain from 'images/token-main.svg'
// import logoMainDark from 'images/token-main-dark.svg'
// import logoMainGradiant from 'images/token-main-gradient.svg'
import DAI_1 from 'images/DAI_CoinIcon1.svg'
import DAI_2 from 'images/DAI_CoinIcon2.svg'
import DAI_3 from 'images/DAI_CoinIcon3.svg'
import tokenOne from 'images/CoinIcon1.svg'
import tokenTwo from 'images/CoinIcon2.svg'
import tokenThird from 'images/CoinIcon3.svg'

const getImages = (networkType) => {
// const isRopsten = networkType === 'ropsten'
const pictureEnum = {
'CoinIcon1.svg': tokenOne,
'CoinIcon2.svg': tokenTwo,
'CoinIcon3.svg': tokenThird
}
return pictureEnum
}
const getImages = () => ({
'CoinIcon1.svg': tokenOne,
'CoinIcon2.svg': tokenTwo,
'CoinIcon3.svg': tokenThird
})

const getDaiIcons = () => ({
'CoinIcon1.svg': DAI_1,
'CoinIcon2.svg': DAI_2,
'CoinIcon3.svg': DAI_3
})

const CommunityLogo = ({ networkType, metadata: { communityLogo }, token: { symbol }, isSmall = false, isBig = false, isDaiToken = false }) => {
const CommunityLogo = ({ networkType, metadata: { communityLogo = 'CoinIcon1.svg' }, token: { symbol }, isSmall = false, isBig = false, isDaiToken = false }) => {
const wrapperClasses = classNames(`logo-circle__outer`,
{ 'logo-circle__outer--normal': !isSmall && !isBig },
{ 'logo-circle__outer--small': isSmall && !isBig },
Expand All @@ -44,7 +34,7 @@ const CommunityLogo = ({ networkType, metadata: { communityLogo }, token: { symb
<div className={wrapperClasses}>
{
communityLogo
? <img src={!isDaiToken ? (getImages(networkType)[communityLogo] || tokenOne) : getDaiIcons()[communityLogo]} className='logo-circle__inner' alt='Community Logo' />
? <img src={!isDaiToken ? (getImages()[communityLogo] || tokenOne) : getDaiIcons()[communityLogo]} className='logo-circle__inner' alt='Community Logo' />
: <Loader color='#fff' className='logo-img' />
}
{!isDaiToken && <span className='logo-circle__name'>{symbol}</span>}
Expand Down
34 changes: 34 additions & 0 deletions dapp/src/components/common/JoinCommunity/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Component } from 'react'
import { withNetwork, withAccount, withBox } from 'containers/Web3'
import { connect } from 'react-redux'
import { joinCommunity } from 'actions/communityEntities'
import { withRouter } from 'react-router-dom'

class JoinCommunity extends Component {
componentDidMount () {
const { joinCommunity, data, communityAddress } = this.props
joinCommunity(communityAddress, { ...data, type: 'user' })
}

componentDidUpdate (prepProps, prevState) {
if (this.props.isBoxConnected && (!prepProps.join && this.props.join)) {
window.location.replace('http://communities-qa.cln.network')
}

if (this.props.isBoxConnected && (!prepProps.join && this.props.join === false)) {
window.location.replace('http://communities-qa.cln.network')
}
}

render = () => null
}

const mapStateToProps = (state) => ({
join: state.screens.communityEntities && state.screens.communityEntities.join
})

const mapDispatchToProps = {
joinCommunity
}

export default withRouter(withNetwork(withAccount(withBox(connect(mapStateToProps, mapDispatchToProps)(JoinCommunity)))))
2 changes: 1 addition & 1 deletion dapp/src/components/common/NavBar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class NavBar extends Component {
const { withLogo, networkType } = this.props
const { isHelpOpen, isProfileOpen } = this.state
return (
<div className={classNames('navbar', { 'navbar--scroll': this.state.scrollTop > 70 })}>
<div className={classNames('navbar', { 'navbar--scroll': this.state.scrollTop > 70 })} style={{ width: (this.state.scrollTop > 70 && !isMobileOnly) && !withLogo ? '80%' : null }}>
{ (withLogo || (isMobileOnly && this.state.scrollTop > 70)) && <div className='navbar__logo'><Logo onClick={this.goToHome} isBlue={this.state.scrollTop < 70} /></div> }
<div className='navbar__links' style={{ marginLeft: !withLogo ? 'auto' : null }}>
<div
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/components/common/ProfileDropDown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ class ProfileDropDown extends Component {
<div className='profile__account__avatar cell small-24'>
<img src={Avatar} />
</div>
<span className='cell small-24 profile__account__address'>
{accountAddress && <span className='cell small-24 profile__account__address'>
{formatAddress(accountAddress)}
<CopyToClipboard text={accountAddress}>
<FontAwesome name='clone' />
</CopyToClipboard>
</span>
</span>}
</div>
<InnerCommunities
showDashboard={this.showDashboard}
Expand Down
42 changes: 42 additions & 0 deletions dapp/src/components/common/SignIn/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Component } from 'react'
import { connect } from 'react-redux'
import { signIn, create3boxProfile } from 'actions/accounts'
import { withRouter } from 'react-router-dom'

class SignInLayout extends Component {
componentDidMount () {
const { createNew, accountAddress } = this.props

if (createNew) {
const { create3boxProfile, data } = this.props
create3boxProfile(accountAddress, data)
} else {
const { signIn } = this.props
signIn(accountAddress)
}
}

componentDidUpdate (prepProps, prevState) {
if (!prepProps.isBoxConnected && this.props.isBoxConnected && this.props.isMobileApp) {
window.location.replace('http://communities-qa.cln.network')
}
}

render = () => null
}

const mapStateToProps = (state, { match }) => ({
accountAddress: state.network.accountAddress,
isBoxConnected: state.network.isBoxConnected,
isMobileApp: match.params.isMobileApp
})

const mapDispatchToProps = {
signIn,
create3boxProfile
}

export default withRouter(connect(
mapStateToProps,
mapDispatchToProps
)(SignInLayout))
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import omit from 'lodash/omit'
import get from 'lodash/get'
import { Formik, Field, ErrorMessage } from 'formik'
import userEntity from 'utils/validation/shapes/userEntity'
import TransactionButton from 'components/common/TransactionButton'
Expand All @@ -11,6 +12,8 @@ class AddUserForm extends Component {
constructor (props) {
super(props)

const { entity } = props

this.initialValues = {
firstName: '',
lastName: '',
Expand All @@ -20,7 +23,7 @@ class AddUserForm extends Component {
country: '',
city: '',
address: '',
account: ''
account: get(entity, 'account', '')
}

this.validationSchema = userEntity
Expand All @@ -36,7 +39,7 @@ class AddUserForm extends Component {
submitEntity(entity)
}

renderForm = ({ handleSubmit, setFieldValue, setFieldTouched, values, isValid }) => {
renderForm = ({ handleSubmit, setFieldValue, isValid }) => {
return (
<form className='user-form' onSubmit={handleSubmit}>
<h5 className='user-form__title'>Add new user</h5>
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/components/dashboard/components/Bridge/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { Component, useEffect } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { BigNumber } from 'bignumber.js'
import web3 from 'web3'
import { toWei } from 'web3-utils'
import FontAwesome from 'react-fontawesome'
import { balanceOfToken } from 'actions/accounts'
import * as actions from 'actions/bridge'
Expand Down Expand Up @@ -78,7 +78,7 @@ class Bridge extends Component {
setTransferAmount = (e) => this.setState({ transferAmount: e.target.value })

handleTransfer = () => {
const value = web3.utils.toWei(this.state.transferAmount)
const value = toWei(this.state.transferAmount)
if (this.props.bridgeStatus.to.bridge === 'home') {
this.props.transferToHome(this.props.foreignTokenAddress, this.props.foreignBridgeAddress, value)
} else {
Expand Down
Loading