Skip to content

Commit 168dac0

Browse files
authored
Merge pull request #207 from ensdomains/dev
Deploy to production
2 parents 4400eb1 + d79a4f5 commit 168dac0

File tree

21 files changed

+488
-167
lines changed

21 files changed

+488
-167
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"@emotion/styled": "^10.0.9",
1010
"@ensdomains/ens": "^0.3.3",
1111
"@ensdomains/ens-022": "npm:@ensdomains/ens@0.2.2",
12-
"@ensdomains/ethregistrar": "^1.1.4",
13-
"@ensdomains/resolver": "^0.1.4",
12+
"@ensdomains/ethregistrar": "^1.2.2",
13+
"@ensdomains/resolver": "^0.1.6",
1414
"apollo-cache-inmemory": "^1.2.9",
1515
"apollo-client": "^2.4.5",
1616
"apollo-link": "^1.2.2",
@@ -34,6 +34,7 @@
3434
"react-add-to-calendar": "^0.1.5",
3535
"react-apollo": "^2.1.2",
3636
"react-dom": "16.7.0-alpha.0",
37+
"react-ga": "^2.5.7",
3738
"react-router": "^4.2.0",
3839
"react-router-dom": "^4.2.2",
3940
"react-scripts": "2.0.4",

src/App.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { NetworkError } from './components/Error/Errors'
2020
import { CONFIRM } from './modals'
2121

2222
import DefaultLayout from './components/Layout/DefaultLayout'
23+
import Analytics from './utils/analytics'
2324

2425
const HomePageLayout = ({ children }) => <Fragment>{children}</Fragment>
2526

@@ -28,6 +29,7 @@ const Route = ({
2829
layout: Layout = DefaultLayout,
2930
...rest
3031
}) => {
32+
Analytics.pageview()
3133
return (
3234
<DefaultRoute
3335
{...rest}
@@ -44,6 +46,7 @@ const App = () => (
4446
<>
4547
<Query query={GET_ERRORS}>
4648
{({ data }) => {
49+
Analytics.setup()
4750
if (data.error && data.error.message) {
4851
return <NetworkError message={data.error.message} />
4952
} else {

src/api/registrar.js

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,26 @@ export const transferOwner = async ({ to, name }) => {
241241
const labelHash = web3.utils.sha3(nameArray[0])
242242
const account = await getAccount()
243243
const { permanentRegistrarRead: Registrar } = await getPermanentRegistrar()
244-
return Registrar.safeTransferFrom(account, to, labelHash).send({
245-
from: account
246-
})
244+
return () =>
245+
Registrar.safeTransferFrom(account, to, labelHash).send({
246+
from: account
247+
})
248+
} catch (e) {
249+
console.log('error getting permanentRegistrar contract', e)
250+
}
251+
}
252+
253+
export const reclaim = async ({ name, address }) => {
254+
try {
255+
const web3 = await getWeb3()
256+
const nameArray = name.split('.')
257+
const labelHash = web3.utils.sha3(nameArray[0])
258+
const account = await getAccount()
259+
const { permanentRegistrarRead: Registrar } = await getPermanentRegistrar()
260+
return () =>
261+
Registrar.reclaim(labelHash, address).send({
262+
from: account
263+
})
247264
} catch (e) {
248265
console.log('error getting permanentRegistrar contract', e)
249266
}
@@ -305,6 +322,19 @@ export const register = async (label, duration, secret) => {
305322
.send({ from: account, gas: 1000000, value: price })
306323
}
307324

325+
export const renew = async (label, duration) => {
326+
const {
327+
permanentRegistrarController
328+
} = await getPermanentRegistrarController()
329+
const account = await getAccount()
330+
const price = await getRentPrice(label, duration)
331+
332+
return () =>
333+
permanentRegistrarController
334+
.renew(label, duration)
335+
.send({ from: account, gas: 1000000, value: price })
336+
}
337+
308338
export const createSealedBid = async (name, bidAmount, secret) => {
309339
const Registrar = await getLegacyAuctionRegistrar()
310340
const web3 = await getWeb3()
@@ -353,7 +383,7 @@ export const transferRegistrars = async label => {
353383
const web3 = await getWeb3()
354384
const hash = web3.utils.sha3(label)
355385
const tx = ethRegistrar.transferRegistrars(hash)
356-
const gas = await tx.estimateGas({from:account})
386+
const gas = await tx.estimateGas({ from: account })
357387
return () =>
358388
tx.send({
359389
from: account,
@@ -367,7 +397,7 @@ export const releaseDeed = async label => {
367397
const web3 = await getWeb3()
368398
const hash = web3.utils.sha3(label)
369399
const tx = ethRegistrar.releaseDeed(hash)
370-
const gas = await tx.estimateGas({from:account})
400+
const gas = await tx.estimateGas({ from: account })
371401
return () =>
372402
tx.send({
373403
from: account,

src/api/registrar/resolvers.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import {
66
commit,
77
getMinimumCommitmentAge,
88
register,
9+
renew,
910
transferRegistrars,
1011
releaseDeed,
11-
transferOwner
12+
transferOwner,
13+
reclaim
1214
} from '../registrar'
1315
import { getOwner } from '../registry'
1416
import modeNames from '../modes'
@@ -46,6 +48,14 @@ const resolvers = {
4648

4749
return sendHelper(tx)
4850
},
51+
async reclaim(_, { name, address }) {
52+
const tx = await reclaim({ name, address })
53+
return sendHelper(tx)
54+
},
55+
async renew(_, { label, duration }) {
56+
const tx = await renew(label, duration)
57+
return sendHelper(tx)
58+
},
4959
async getDomainAvailability(_, { name }, { cache }) {
5060
try {
5161
const {
@@ -89,7 +99,7 @@ const resolvers = {
8999
}
90100
},
91101
async setRegistrant(_, { name, address }) {
92-
const tx = transferOwner({ name, to: address })
102+
const tx = await transferOwner({ name, to: address })
93103
return sendHelper(tx)
94104
},
95105
async transferRegistrars(_, { label }) {

src/components/Modal/Modal.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,25 @@ const ModalContainer = styled('div')`
3434
top: 0;
3535
width: 100%;
3636
height: 100%;
37-
padding: 20px;
37+
padding: 0;
3838
display: flex;
3939
justify-content: center;
4040
align-items: center;
4141
z-index: 99999999;
4242
background: rgba(0, 0, 0, 0.5);
43+
44+
${mq.small`
45+
padding: 20px;
46+
`};
4347
`
4448

4549
const ModalContent = styled('div')`
4650
background: white;
47-
padding: 40px;
51+
padding: 20px;
4852
overflow-y: scroll;
49-
height: auto%;
50-
min-width: 850px;
53+
height: auto;
5154
${mq.medium`
55+
padding: 40px;
5256
width: 70%;
5357
`};
5458

src/components/SingleName/AddRecord.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const Select = styled(DefaultSelect)`
3232

3333
const RecordsTitle = styled('h3')`
3434
/* Pointers: */
35-
font-family: Overpass-Bold;
35+
font-family: Overpass;
36+
font-weight: 700;
3637
font-size: 12px;
3738
color: #adbbcd;
3839
letter-spacing: 0.5px;

src/components/SingleName/Confirm.js

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,37 @@ import React from 'react'
22
import styled from '@emotion/styled'
33
import Button from '../Forms/Button'
44
import warning from '../../assets/warning.svg'
5-
import write from '../../assets/Write.svg'
5+
import write from '../../assets/Write.svg'
6+
7+
import mq from 'mediaQuery'
68

79
const ConfirmContainer = styled('div')`
810
&:before {
11+
display: none;
912
background: url(${write});
1013
content: '';
1114
height: 43px;
1215
width: 42px;
1316
float: right;
17+
${mq.large`
18+
display: block;
19+
flex-direction: row;
20+
`}
1421
}
1522
`
1623
const Content = styled('div')`
1724
display: flex;
1825
justify-content: space-between;
26+
flex-direction: column;
1927
`
2028

2129
const Title = styled('h3')`
22-
margin:0 0 0 1.5em;
30+
margin: 0 0 0 1.5em;
31+
font-size: 16px;
32+
font-weight: 300;
33+
${mq.small`
34+
font-size: 22px;
35+
`}
2336
&:before {
2437
background: url(${warning});
2538
content: '';
@@ -32,15 +45,18 @@ const Title = styled('h3')`
3245
`
3346

3447
const SubTitle = styled('p')`
35-
margin:0;
36-
margin-bottom:1em;
48+
margin: 0;
49+
margin-bottom: 1em;
50+
font-size: 12px;
51+
${mq.small`
52+
font-size: 14px;
53+
`}
3754
`
3855

3956
const Values = styled('ul')`
4057
list-style-type: none;
41-
width:30em;
4258
padding: 4px 0;
43-
margin:0;
59+
margin: 0;
4460
display: flex;
4561
flex-direction: column;
4662
justify-content: space-between;
@@ -53,11 +69,21 @@ const Value = styled('li')`
5369
display: flex;
5470
justify-content: space-between;
5571
color: ${({ old }) => (old ? 'grey' : 'black')};
72+
margin-bottom: 10px;
73+
74+
${mq.large`
75+
justify-content: flex-start;
76+
`}
77+
78+
span:first-child {
79+
width: 75px;
80+
}
5681
`
5782

5883
const Buttons = styled('div')`
59-
height:100%;
60-
margin-top:1em;
84+
height: 100%;
85+
margin-top: 1em;
86+
display: flex;
6187
`
6288

6389
const Action = styled(Button)``
@@ -79,24 +105,36 @@ const Confirm = ({
79105
<Title>Are you sure you want to do this?</Title>
80106
<SubTitle>This action will modify the state of the blockchain.</SubTitle>
81107
<Content>
82-
{explanation ? (<p>{explanation}</p>): ''}
108+
{explanation ? <p>{explanation}</p> : ''}
83109
{value || newValue ? (
84-
<Values>
85-
<Value old={true} ><span>PREVIOUS</span><span>{value}</span></Value>
86-
<Value><span>FUTURE</span><span>{newValue}</span></Value>
87-
</Values>
88-
): ''}
110+
<Values>
111+
<Value old={true}>
112+
<span>PREVIOUS</span>
113+
<span>{value}</span>
114+
</Value>
115+
<Value>
116+
<span>FUTURE</span>
117+
<span>{newValue}</span>
118+
</Value>
119+
</Values>
120+
) : (
121+
''
122+
)}
89123
<Buttons>
90124
<Cancel type="hollow" onClick={cancel}>
91-
Cancel
125+
Cancel
92126
</Cancel>
93127
{disabled ? (
94-
<Action type="disabled">Confirm</Action>
128+
<Action type="disabled">Confirm</Action>
95129
) : (
96-
<Action onClick={()=>{
97-
mutation()
98-
cancel()
99-
}}>Confirm</Action>
130+
<Action
131+
onClick={() => {
132+
mutation()
133+
cancel()
134+
}}
135+
>
136+
Confirm
137+
</Action>
100138
)}
101139
</Buttons>
102140
</Content>

0 commit comments

Comments
 (0)