Skip to content

Commit dca6e64

Browse files
authored
Merge pull request #39 from XYOracleNetwork/master
0.2.9
2 parents 6c1a219 + 10eaef2 commit dca6e64

25 files changed

Lines changed: 680 additions & 456 deletions

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
</h3>
2323
<p align="center">Made with ❤️ by [<b>XY - The Persistent Company</b>] (https://xy.company)</p>
2424

25+
Check out Dapper at https://dapper.layerone.co to start playing with your smart contracts.
26+
2527
# Pt. I. - Let's Get Dapper
2628

2729

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xyo-network/tool-dapper-react",
3-
"version": "0.2.7",
3+
"version": "0.2.9",
44
"description": "An automated smart contract web viewer. Run on any ABI folder",
55
"repository": {
66
"type": "git",
@@ -25,13 +25,13 @@
2525
"eslint-config-standard-react": "^7.0.2",
2626
"file-selector": "^0.1.5",
2727
"glamor": "^2.20.40",
28-
"glamorous": "^4.13.1",
28+
"glamorous": "^5.0.0",
2929
"history": "^4.7.2",
30-
"ipfs-http-client": "^27.0.0",
30+
"ipfs-http-client": "^27.1.0",
3131
"json-loader": "^0.5.7",
3232
"portis": "^1.3.1",
3333
"react": "^16.6.1",
34-
"react-cookie": "^3.0.4",
34+
"react-cookie": "^3.0.8",
3535
"react-dom": "^16.6.1",
3636
"react-dropdown": "^1.6.2",
3737
"react-dropzone": "^7.0.1",
@@ -43,10 +43,10 @@
4343
"web3": "^1.0.0-beta.35"
4444
},
4545
"devDependencies": {
46-
"@storybook/addon-actions": "^4.0.4",
47-
"@storybook/addon-links": "^4.0.4",
48-
"@storybook/addons": "^4.0.4",
49-
"@storybook/react": "^4.0.4",
46+
"@storybook/addon-actions": "^4.0.12",
47+
"@storybook/addon-links": "^4.0.12",
48+
"@storybook/addons": "^4.0.12",
49+
"@storybook/react": "^4.0.12",
5050
"babel-core": "^6.26.3",
5151
"babel-runtime": "^6.26.0",
5252
"eslint-config-airbnb": "^17.1.0",

src/atoms/ContractAddressDropdown.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class ContractAddressDropdown extends Component {
2020
}
2121

2222
_onSelect = selection => {
23-
console.log(`Detected Selection`)
2423
let {contractObjects} = this.props
2524
// let contractObjects = this.props.fetchObjects()
2625
contractObjects.forEach(obj => {
@@ -36,27 +35,16 @@ class ContractAddressDropdown extends Component {
3635
return val.length > 20 ? `${val.substring(0, 20)}...` : val
3736
}
3837

39-
showSelectedDiv = () => {
40-
if (this.props.selectedAddress) {
41-
return (
42-
<GreyTopped>
43-
<Div>{this.props.selectedAddress}</Div>
44-
</GreyTopped>
45-
)
46-
}
47-
return null
48-
}
49-
50-
connectProvider = async () =>
38+
connectProvider = async () => {
5139
this.props.service
5240
.loadWeb3(this.props.cookies)
53-
.then(this.setState({ connectButtonState: STATE.SUCCESS }))
41+
}
42+
5443

5544

5645
dropdownDiv = () => {
5746
// let contractObjects = this.props.fetchObjects()
5847
let { contractObjects } = this.props
59-
console.log(`RENDERING ADDRESS DROPDOWN WITH OBJ`, contractObjects)
6048
let network = this.props.service.getCurrentNetwork()
6149
if (!network) {
6250
return (
@@ -74,7 +62,7 @@ class ContractAddressDropdown extends Component {
7462
)
7563
}
7664
if (!contractObjects || contractObjects.length === 0) {
77-
return <GreyTopped>Not deployed on {network}</GreyTopped>
65+
return <GreyTopped>Not deployed on {network.name}</GreyTopped>
7866
}
7967
return (
8068
<Div>
@@ -94,7 +82,6 @@ class ContractAddressDropdown extends Component {
9482
}
9583
placeholder='Nothing Selected'
9684
/>
97-
{this.showSelectedDiv()}
9885
</Div>
9986
)
10087
}

src/atoms/CookieReader.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11

22
export const readSettings = cookies => {
3-
3+
if (!cookies.get(`portisNetwork`)) {
4+
cookies.set(`portisNetwork`, `mainnet`, {
5+
path: `/`,
6+
})
7+
}
48
return {
5-
portisNetwork: cookies.get(`portisNetwork`) || `development`,
9+
portisNetwork: cookies.get(`portisNetwork`),
610
currentSource: cookies.get(`currentSource`) || `ipfs`,
711
local: cookies.get(`local`) || ``,
812
remote: cookies.get(`remote`) || ``,

src/atoms/CurNetwork.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import React from "react"
22
import { Div } from "glamorous"
33

4-
const WalletDiv = (account) => {
4+
const WalletDiv = account => {
55
if (account) {
66
return (
77
<Div key='account' className='account-right'>
88
Wallet: {account}
99
</Div>
1010
)
1111
}
12-
return <Div key='account' className='account-right'>
13-
No Wallet Connected
14-
</Div>
12+
return (
13+
<Div key='account' className='account-right'>
14+
No Wallet Connected
15+
</Div>
16+
)
1517
}
1618

1719
const CurNetwork = ({ account, network }) => {
1820
let returnDivs = []
19-
2021
returnDivs.push(WalletDiv(account))
2122
if (network) {
2223
returnDivs.push(

src/atoms/DeploymentResult.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from "react"
2+
import { Div } from "glamorous"
3+
4+
import ResultTable from "../atoms/ResultTable"
5+
import { HeaderStyle2 } from "../atoms/HeaderStyle"
6+
7+
const DeploymentResult = ({ address, ipfs, name, notes }) => {
8+
if (!name) {
9+
return null
10+
}
11+
const header = {
12+
name: `Deployed Contract`,
13+
color: `6025AE`,
14+
value: name,
15+
}
16+
const rows = [
17+
{
18+
name: `IPFS`,
19+
url: `https://ipfs.xyo.network/ipfs/${ipfs}`,
20+
value: ipfs,
21+
},
22+
{
23+
name: `Address`,
24+
value: address,
25+
},
26+
]
27+
if (notes) {
28+
rows.push({
29+
name: `Notes`,
30+
value: notes,
31+
})
32+
}
33+
return (
34+
<Div
35+
css={{
36+
display: `flex`,
37+
flexDirection: `row`,
38+
justifyContent: `center`,
39+
}}
40+
>
41+
<Div
42+
css={{
43+
display: `flex`,
44+
flexDirection: `column`,
45+
justifyContent: `center`,
46+
}}
47+
>
48+
<HeaderStyle2>Successfully Deployed {name}</HeaderStyle2>
49+
<ResultTable header={header} rows={rows} />
50+
</Div>
51+
</Div>
52+
)
53+
}
54+
export default DeploymentResult
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import glam from "glamorous"
22

3-
export const DetailsHeader = glam.div({
3+
export const HeaderStyle = glam.div({
44
display: `flex`,
55
flexDirection: `column`,
66
justifyContent: `center`,
77
height: 78,
88
paddingLeft: 24,
99
fontSize: `25px`,
10+
fontFamily: `PT Sans`,
11+
1012
})
1113

12-
export const DetailsHeader2 = glam.div({
14+
export const HeaderStyle2 = glam.div({
1315
display: `flex`,
1416
flexDirection: `column`,
1517
justifyContent: `center`,
1618
height: 78,
1719
paddingLeft: 24,
1820
fontSize: 19,
1921
marginLeft: 10,
22+
fontFamily: `PT Sans`,
23+
2024
})

src/atoms/ResultTable.js

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
1-
import React, { Component } from 'react'
2-
import glam, { Div } from 'glamorous'
3-
import './css/ResultTable.css'
4-
import Seperator from './Seperator'
5-
6-
const ReceiptRow = glam.div({
7-
display: 'flex',
8-
flexDirection: 'row',
9-
justifyContent: 'space-between',
10-
height: 35,
11-
color: '#4D4D5C',
12-
fontFamily: 'PT Sans',
13-
fontSize: 15,
14-
})
15-
const LeftColumn = glam.div({
16-
textAlign: 'left',
17-
})
18-
const RightColumn = glam.div({
19-
textAlign: 'right',
20-
})
1+
import React, { Component } from "react"
2+
import { Div } from "glamorous"
3+
import "./css/ResultTable.css"
4+
import Seperator from "./Seperator"
5+
import {Link} from 'react-router-dom'
6+
import {
7+
TableStyle,
8+
FlexSpacingRow,
9+
LeftColumn,
10+
RightColumn,
11+
} from "../atoms/SharedStyles"
2112

2213
const HeaderRow = ({ header }) => {
2314
const { name, value, color } = header
2415
return (
25-
<ReceiptRow
16+
<FlexSpacingRow
2617
css={{
2718
color: color,
2819
fontSize: 18,
@@ -31,23 +22,31 @@ const HeaderRow = ({ header }) => {
3122
>
3223
<LeftColumn>{name}</LeftColumn>
3324
<RightColumn>{value}</RightColumn>
34-
</ReceiptRow>
25+
</FlexSpacingRow>
3526
)
3627
}
3728

3829
export const RowDivs = ({ rows }) => {
3930
const rowDivs = []
40-
rows.forEach(({ name, value }, index) => {
31+
rows.forEach(({ name, value, linkTo, url }, index) => {
4132
let seperator = undefined
4233
if (index < rows.length - 1) {
4334
seperator = <Seperator />
4435
}
36+
let rightColumn = value => {
37+
if (linkTo) {
38+
return <RightColumn>{<Link to={linkTo}>{value}</Link>}</RightColumn>
39+
} else if (url) {
40+
return <RightColumn>{<a href={url} target='blank'>{value}</a>}</RightColumn>
41+
}
42+
return <RightColumn>{value}</RightColumn>
43+
}
4544
rowDivs.push(
4645
<Div key={name}>
47-
<ReceiptRow>
46+
<FlexSpacingRow>
4847
<LeftColumn>{name}</LeftColumn>
49-
<RightColumn>{value}</RightColumn>
50-
</ReceiptRow>
48+
{rightColumn(value)}
49+
</FlexSpacingRow>
5150
{seperator}
5251
</Div>,
5352
)
@@ -57,19 +56,13 @@ export const RowDivs = ({ rows }) => {
5756
}
5857

5958
class ResultTable extends Component {
60-
constructor({ header, rows }) {
61-
super()
62-
this.state = {
63-
header,
64-
rows,
65-
}
66-
}
6759
render() {
60+
const { header, rows } = this.props
6861
return (
69-
<Div className="result-table">
70-
<HeaderRow header={this.state.header} />
71-
<RowDivs rows={this.state.rows} />
72-
</Div>
62+
<TableStyle>
63+
<HeaderRow header={header} />
64+
<RowDivs rows={rows} />
65+
</TableStyle>
7366
)
7467
}
7568
}

src/atoms/SharedStyles.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import glam from "glamorous"
2+
3+
export const FlexSpacingRow = glam.div({
4+
display: `flex`,
5+
flexDirection: `row`,
6+
justifyContent: `space-between`,
7+
height: 35,
8+
color: `#4D4D5C`,
9+
fontFamily: `PT Sans`,
10+
fontSize: 15,
11+
width: 600
12+
})
13+
14+
export const LeftColumn = glam.div({
15+
textAlign: `left`,
16+
})
17+
18+
export const RightColumn = glam.div({
19+
textAlign: `right`,
20+
lineBreak: `loose`,
21+
wordWrap: `break-word`,
22+
})
23+
24+
export const TableStyle = glam.div({
25+
width: `90W%`,
26+
minHeight: `20px`,
27+
margin: 20,
28+
padding: 20,
29+
boxShadow: `0 4px 4px 0 rgba(99, 99, 99, 0.19)`,
30+
backgroundColor: `white`,
31+
borderRadius: 2,
32+
})

0 commit comments

Comments
 (0)