Skip to content

Commit

Permalink
Merge pull request #235 from ensdomains/dev
Browse files Browse the repository at this point in the history
Deploy to production
  • Loading branch information
makoto authored May 1, 2019
2 parents 82a9d9a + bce3fd5 commit 3c4748d
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 70 deletions.
5 changes: 2 additions & 3 deletions src/api/registrar.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,9 @@ export const getEntry = async name => {

try {
let permEntry = await getPermanentEntry(name)

if (ret.registrationDate && permEntry.migrationLockPeriod) {
if (legacyEntry.registrationDate && permEntry.migrationLockPeriod) {
ret.migrationStartDate = new Date(
ret.registrationDate + permEntry.migrationLockPeriod * 1000
legacyEntry.registrationDate + permEntry.migrationLockPeriod * 1000
)
} else {
ret.migrationStartDate = null
Expand Down
15 changes: 15 additions & 0 deletions src/components/Forms/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ function getButtonStyles({ type }) {
box-shadow: 0 10px 21px 0 rgba(161, 175, 184, 0.89);
}
`
case 'hollow-white':
return `
background: transparent;
color: white;
border: 2px solid #fff;
&:visited {
color: white;
}
&:hover {
cursor: pointer;
border: 2px solid transparent;
background: #2c46a6;
box-shadow: 0 10px 21px 0 rgba(161, 175, 184, 0.89);
}
`
case 'hollow-primary':
return `
color: #5384FE;
Expand Down
2 changes: 1 addition & 1 deletion src/components/HowToUse/HowToUse.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const HowToUse = ({ text = false, className }) => (
title="Register names"
text={
text
? 'Register .eth names for ~$5/year. Renew or cancel your name registration at any time.'
? 'Register .eth names for $5/year. Renew or cancel your name registration at any time.'
: ''
}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/Icons/PermanentRegistrar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 9 additions & 12 deletions src/components/SingleName/Name.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,26 @@ function Name({ details: domain, name, pathname, refetch }) {
return (
<QueryAccount>
{({ account }) => {
const hasAnOwner = account !== EMPTY_ADDRESS
const isOwner = isOwnerOfDomain(domain, account)
const isDeedOwner = domain.deedOwner === account

const registrationOpen = isRegistrationOpen(domain, isDeedOwner)
return (
<NameContainer state={isOwner ? 'Yours' : domain.state}>
<TopBar percentDone={percentDone}>
<Title>{name}</Title>
<RightBar>
{isOwner && <Owner>Owner</Owner>}
<Favourite domain={domain} />
{smallBP &&
domain.parent === 'eth' &&
domain.state === 'Owned' && (
<Tabs pathname={pathname} domain={domain} />
)}
{smallBP && hasAnOwner && (
<Tabs pathname={pathname} domain={domain} />
)}
</RightBar>
</TopBar>
{!smallBP &&
domain.parent === 'eth' &&
domain.state === 'Owned' && (
<Tabs pathname={pathname} domain={domain} />
)}
{isRegistrationOpen(domain, isDeedOwner) ? (
{!smallBP && hasAnOwner && (
<Tabs pathname={pathname} domain={domain} />
)}
{registrationOpen ? (
<NameRegister
domain={domain}
pathname={pathname}
Expand Down
117 changes: 66 additions & 51 deletions src/components/SingleName/TransferRegistrars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import ReleaseDeed from './ReleaseDeed'

const CloseLink = styled('a')`
position: relative;
cursor:pointer;
cursor: pointer;
${mq.small`
top:-46px;
`}
`
`

const MigrationInstruction = styled('h3')`
margin: 0;
Expand Down Expand Up @@ -63,7 +63,8 @@ const MigrationIcon = styled(DefaultMigrationIcon)`

const TransferDetail = styled(DetailsItem)`
padding: 20px;
background-color: ${props => props.condition === 'warning' ? '#fef6e9' : '#f0f6fa'};
background-color: ${props =>
props.condition === 'warning' ? '#fef6e9' : '#f0f6fa'};
position: relative;
padding-top: 65px;
margin-bottom: 25px;
Expand All @@ -87,37 +88,42 @@ const Action = styled('div')`
`}
`

const LearnMoreLink = styled('a')`
`
const LearnMoreLink = styled('a')``

const LearnMore = () => (
<LearnMoreLink
// Temp link until we get better blog post explaining the detail.
href="https://medium.com/the-ethereum-name-service/the-future-of-ens-as-explained-in-our-ethcc-talks-videos-inside-395fbaaa6cad"
href="https://docs.ens.domains/permanent-registrar-faq"
target="_blank"
>
Learn More
</LearnMoreLink>
)

const ReleaseInstead = ({label, refetch}) =>(
const ReleaseInstead = ({ label, refetch }) => (
<MigrationExplanation>
<ReleaseDeed
label={label}
refetch={refetch}
actionText = 'Release'
actionType = 'link'
explanation = 'You will no longer have ownership of this name'
actionText="Release"
actionType="link"
explanation="You will no longer have ownership of this name"
/>{' '}
the domain to get your locked ETH back if you don’t want it anymore.
</MigrationExplanation>
</MigrationExplanation>
)

function displayMigrationDiralogue({parent, isOwner,isDeedOwner, isNewRegistrar, confirmed}){
function displayMigrationDiralogue({
parent,
isOwner,
isDeedOwner,
isNewRegistrar,
confirmed
}) {
return (
parent === 'eth' &&
((isOwner || isDeedOwner) && !isNewRegistrar)
) || confirmed
(parent === 'eth' && ((isOwner || isDeedOwner) && !isNewRegistrar)) ||
confirmed
)
}

function TransferRegistrars({
Expand All @@ -141,8 +147,9 @@ function TransferRegistrars({
Congratulations on Migrating your domain!
</MigrationInstruction>
<MigrationExplanation>
You successfully migrated this domain to the new ENS Permanent Registrar.
We've sent back to you the ETH that you had locked in the older registrar contract.
You successfully migrated this domain to the new ENS Permanent
Registrar. We've sent back to you the ETH that you had locked in the
older registrar contract.
</MigrationExplanation>
</>
)
Expand All @@ -153,15 +160,13 @@ function TransferRegistrars({
Be Ready! ENS is migrating to a new Registrar.
</MigrationInstruction>
<MigrationExplanation>
This domain is currently recorded in the old ENS Registrar which will be discontinued after 2019.05.04.
Migrate to the new ENS Registrar between{' '}
This domain is currently recorded in the old ENS Registrar which will be
discontinued after 2019.05.04. Migrate to the new ENS Registrar between{' '}
<strong>
{formatDate(migrationStartDate, true)} -{' '}
{formatDate(transferEndDate, true)}
</strong>
{' '}
if you want to keep your domain.
{' '}<LearnMore />
</strong>{' '}
if you want to keep your domain. <LearnMore />
</MigrationExplanation>
<ReleaseInstead label={label} refetch={refetch} />
</>
Expand All @@ -173,22 +178,24 @@ function TransferRegistrars({
Migration period ended {formatDate(transferEndDate, true)}
</MigrationInstruction>
<MigrationExplanation>
You no longer own this name and it has been made available for registration in the new ENS Permanent Registrar.
You can release the domain from the older registrar to get your locked ETH back and register it again in the new ENS Permanent Registrar.
{' '}<LearnMore />
You no longer own this name and it has been made available for
registration in the new ENS Permanent Registrar. You can release the
domain from the older registrar to get your locked ETH back and register
it again in the new ENS Permanent Registrar. <LearnMore />
</MigrationExplanation>
</>
)

const MigrateNow = (
<>
<MigrationInstruction>
Migrate your name to the Permanent Registrar.
Migrate your name to the Permanent Registrar.
</MigrationInstruction>
<MigrationExplanation>
Migrate now to get your locked ETH back and free registration for one year.
If you do not migrate by <strong>{formatDate(transferEndDate, true)}</strong>, you will lose your domain, and others will be able to register it.
{' '}<LearnMore />
Migrate now to get your locked ETH back and free registration for one
year. If you do not migrate by{' '}
<strong>{formatDate(transferEndDate, true)}</strong>, you will lose your
domain, and others will be able to register it. <LearnMore />
</MigrationExplanation>
<ReleaseInstead label={label} refetch={refetch} />
</>
Expand All @@ -198,9 +205,9 @@ function TransferRegistrars({
<ReleaseDeed
label={label}
refetch={refetch}
actionText = 'Release'
actionType = 'button'
explanation = 'You already lost ownership of this name but will get ETH back'
actionText="Release"
actionType="button"
explanation="You already lost ownership of this name but will get ETH back"
/>
)

Expand All @@ -222,42 +229,50 @@ function TransferRegistrars({
startPending(Object.values(data)[0])
}}
>
{mutate => <TransferButton
onClick={mutate}
type="hollow-primary"
>Migrate</TransferButton>
}
{mutate => (
<TransferButton onClick={mutate} type="hollow-primary">
Migrate
</TransferButton>
)}
</Mutation>
)}
</>
)

let CurrentMigrationInstruction, CurrentAction, condition
if(confirmed){
if (confirmed) {
CurrentMigrationInstruction = MigrationConfirmed
CurrentAction = <CloseLink onClick={stopEditing}>x</CloseLink>
}else{
} else {
if (currentBlockDate < migrationStartDate) {
CurrentMigrationInstruction = TooEarly
CurrentAction = <TransferButton type="hollow-primary-disabled">Migrate</TransferButton>
CurrentAction = (
<TransferButton type="hollow-primary-disabled">Migrate</TransferButton>
)
condition = 'warning'
} else if (currentBlockDate < transferEndDate) {
CurrentMigrationInstruction = MigrateNow
CurrentAction = MigrateAction
condition = 'warning'
} else if (currentBlockDate >= transferEndDate){
} else if (currentBlockDate >= transferEndDate) {
CurrentMigrationInstruction = TooLate
CurrentAction = ReleaseAction
}
}
}
return (
displayMigrationDiralogue({parent, isOwner, isDeedOwner, isNewRegistrar, confirmed}) ? (
<TransferDetail condition={condition}>
<MigrationIcon />
{CurrentMigrationInstruction}
<Action>{CurrentAction}</Action>
</TransferDetail>
): ''
return displayMigrationDiralogue({
parent,
isOwner,
isDeedOwner,
isNewRegistrar,
confirmed
}) ? (
<TransferDetail condition={condition}>
<MigrationIcon />
{CurrentMigrationInstruction}
<Action>{CurrentAction}</Action>
</TransferDetail>
) : (
''
)
}

Expand Down
1 change: 1 addition & 0 deletions src/globalStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ injectGlobal`
body {
font-family: Overpass;
background: #F0F6FA;
margin: 0;
}
a {
Expand Down
Loading

0 comments on commit 3c4748d

Please sign in to comment.