diff --git a/.travis.yml b/.travis.yml index 649103719..3a061a760 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ jobs: name: 'Test' install: - yarn - - yarn global add cypress + - yarn global add cypress@3.5.0 - cypress install - yarn global add ganache-cli@6.1.8 - yarn global add wait-on diff --git a/cypress/integration/nameDetail.spec.js b/cypress/integration/nameDetail.spec.js index 0abe5abdb..d4b29c693 100644 --- a/cypress/integration/nameDetail.spec.js +++ b/cypress/integration/nameDetail.spec.js @@ -350,29 +350,6 @@ describe('Name detail view', () => { }) }) - // it('can set old content', () => { - // const content = - // '0xd1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162' - - // cy.visit(`${NAME_ROOT}/oldresolver.eth`) - - // cy.getByTestId('name-details').within(container => { - // cy.getByTestId('edit-content', { exact: false }).click({ force: true }) - // cy.getByPlaceholderText('Enter a content', { - // exact: false - // }).type(content, { force: true }) - // waitUntilInputResolves('Save').then(() => { - // cy.getByText('Save').click({ force: true }) - - // //form closed - // waitUntilTestIdDoesNotExist('action') - // waitUntilTestIdDoesNotExist('cancel') - // //Value updated - // cy.queryByText(content, { exact: false }).should('exist') - // }) - // }) - // }) - it('can delete records', () => { cy.visit(`${NAME_ROOT}/notsoawesome.eth`) cy.getByTestId('name-details').within(container => { diff --git a/cypress/integration/resolverMigration.spec.js b/cypress/integration/resolverMigration.spec.js index 5769d6f3a..882a78646 100644 --- a/cypress/integration/resolverMigration.spec.js +++ b/cypress/integration/resolverMigration.spec.js @@ -6,6 +6,7 @@ const DISABLED_COLOUR = 'rgb(223, 223, 223)' describe('Migrate resolver and records', () => { it('can visit a name with an old resolver and migrate it', () => { cy.visit(`${ROOT}/name/abittooawesome2.eth`) + cy.wait(3000) cy.getByText('Migrate').click({ force: true }) cy.queryByText('migrate', { timeout: 50 }).should('not.exist') cy.wait(1000) @@ -16,6 +17,22 @@ describe('Migrate resolver and records', () => { ) }) + it('can visit a name with an old content resolver and migrate it as swarm contenthash', () => { + cy.visit(`${ROOT}/name/oldresolver.eth`) + cy.wait(3000) // this one took a while to render Migrate + cy.getByText('Migrate').click({ force: true }) + cy.queryByText('migrate', { timeout: 50 }).should('not.exist') + cy.wait(1000) + cy.queryByTestId('edit-resolver').should( + 'have.css', + 'background-color', + ENABLED_COLOUR + ) + cy.queryByText('bzz://', { + exact: false + }).should('exist') + }) + it('cannot migrate resolver if the parent domain is not migrateed', () => { cy.visit(`${ROOT}/name/a1.sub2.testing.eth`) cy.wait(1000) diff --git a/package.json b/package.json index d9c7d4004..930a7487d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@ensdomains/ethregistrar": "^2.0.0", "@ensdomains/react-ens-address": "0.0.17", "@ensdomains/resolver": "^0.2.4", - "@ensdomains/ui": "2.0.11", + "@ensdomains/ui": "2.0.12", "apollo-cache-inmemory": "^1.2.9", "apollo-client": "^2.4.5", "apollo-link": "^1.2.2", @@ -92,7 +92,7 @@ } }, "devDependencies": { - "@ensdomains/mock": "2.0.6", + "@ensdomains/mock": "2.0.7", "apollo-client-mock": "0.0.8", "babel-plugin-macros": "^2.4.2", "cypress": "^3.5.0", diff --git a/src/api/manager/resolvers.js b/src/api/manager/resolvers.js index 82a961d7a..0c3baedd3 100644 --- a/src/api/manager/resolvers.js +++ b/src/api/manager/resolvers.js @@ -38,8 +38,7 @@ import { encodeContenthash, getResolverContract, getOldResolverContract, - getNamehash, - getProvider + getNamehash } from '@ensdomains/ui' import { formatsByName } from '@ensdomains/address-encoder' import isEqual from 'lodash/isEqual' @@ -544,8 +543,8 @@ const resolvers = { '0xbf80bc10d6ebfee11bea9a157d762110a0b73d95' ] const localResolvers = - process.env.REACT_APP_DEPRECATED_RESOLVERS && - process.env.REACT_APP_DEPRECATED_RESOLVERS.split(',') + process.env.REACT_APP_OLD_CONTENT_RESOLVERS && + process.env.REACT_APP_OLD_CONTENT_RESOLVERS.split(',') const oldResolvers = [...oldContentResolvers, ...localResolvers].map( a => { diff --git a/src/components/SearchErrors/SearchErrors.js b/src/components/SearchErrors/SearchErrors.js index f1355139c..3146f80e8 100644 --- a/src/components/SearchErrors/SearchErrors.js +++ b/src/components/SearchErrors/SearchErrors.js @@ -23,7 +23,7 @@ const errorData = { .split('.') .splice(-1, 1)} is not currently a support tld.`, long: searchTerm => - `We currently only support .eth and .xyz domains. Support for future domains are planned in the future` + `We currently only support .eth, .xyz and .art domains. Support for future domains are planned in the future` }, tooShort: { short: searchTerm => ( diff --git a/src/components/SingleName/ResolverAndRecords/ArtRecords.js b/src/components/SingleName/ResolverAndRecords/ArtRecords.js new file mode 100644 index 000000000..0cb57e3cc --- /dev/null +++ b/src/components/SingleName/ResolverAndRecords/ArtRecords.js @@ -0,0 +1,131 @@ +import React from 'react' +import { Query } from 'react-apollo' +import styled from '@emotion/styled' + +import Loader from '../../Loader' + +import { + RecordsContent, + RecordsItem, + RecordsKey, + RecordsValue +} from './RecordsItem' + +const Records = styled('div')` + border-radius: 6px; + border: 1px solid #ededed; + box-shadow: inset 0 0 10px 0 rgba(235, 235, 235, 0.5); + padding-bottom: 10px; + display: block; + margin-bottom: 20px; +` + +const RecordsHeader = styled('div')` + background: #f0f6fa; +` + +const RecordsTitle = styled('h3')` + font-family: Overpass; + font-weight: 700; + font-size: 12px; + color: #adbbcd; + letter-spacing: 0.5px; + text-transform: uppercase; + margin: 0; + padding: 10px 20px; + display: flex; + align-items: center; + justify-content: space-between; +` + +function isArt(name) { + return !!name.match(/\.art$/) +} + +function getArtRecordLabel(key) { + const recordLabels = { + title: 'Title', + maker: 'Maker', + type: 'Type of Object', + subject: 'Subject', + period: 'Period', + dimensions: 'Measurements', + materials: 'Materials & Techniques', + markings: 'Inscriptions & Markings', + features: 'Features', + reference: 'Reference' + } + + return recordLabels[key] +} + +function isEmpty(records) { + if (!records.length) { + return true + } + + return records.filter(record => record.value).length === 0 +} + +function decodeRecords(values) { + let parsed = {} + try { + parsed = JSON.parse(values) + } catch (e) {} + + return Object.keys(parsed).reduce( + (decoded, key) => + decoded.concat({ + label: getArtRecordLabel(key), + value: parsed[key] + }), + [] + ) +} + +function ArtRecordItem({ value, label }) { + if (!value) return null + + return ( + + + {label} + +
{value}
+
+
+
+ ) +} + +export default function ArtRecords({ domain, query }) { + if (!isArt(domain.name)) return null + + return ( + + {({ loading, data }) => { + if (loading) return + + const { getText: encodedArtRecords } = data + + if (!encodedArtRecords) return null + + const records = decodeRecords(encodedArtRecords) + + if (isEmpty(records)) return null + + return ( + + + Art records + + + {records.map((r, i) => ( + + ))} + + ) + }} + + ) +} diff --git a/src/components/SingleName/ResolverAndRecords/ResolverAndRecords.js b/src/components/SingleName/ResolverAndRecords/ResolverAndRecords.js index ceb4629e1..b9880309b 100644 --- a/src/components/SingleName/ResolverAndRecords/ResolverAndRecords.js +++ b/src/components/SingleName/ResolverAndRecords/ResolverAndRecords.js @@ -22,6 +22,7 @@ import RecordsItem from './RecordsItem' import TextRecord from './TextRecord' import Address from './Address' import ResolverMigration from './ResolverMigration' +import ArtRecords from './ArtRecords' const RecordsWrapper = styled('div')` border-radius: 6px; @@ -304,6 +305,8 @@ export default function ResolverAndRecords({ duringMigration={duringMigration} /> )} + + {hasResolver && } ) } diff --git a/src/constants/tlds.json b/src/constants/tlds.json index 8507b8812..91326271d 100644 --- a/src/constants/tlds.json +++ b/src/constants/tlds.json @@ -13,5 +13,8 @@ }, "luxe": { "supported": true + }, + "art": { + "supported": true } } diff --git a/src/routes/Home.js b/src/routes/Home.js index cef532db2..cdb66f516 100644 --- a/src/routes/Home.js +++ b/src/routes/Home.js @@ -302,8 +302,11 @@ export default props => (

warning -   ENS Registry Migration: Bug Fix, New Features  - (Find out more) +   ENS Registry Migration Is Over… Now What? A Few Things to + Know  + + (Find out more) +

diff --git a/src/testing-utils/preTest.js b/src/testing-utils/preTest.js index 176515568..dc434ef83 100644 --- a/src/testing-utils/preTest.js +++ b/src/testing-utils/preTest.js @@ -43,7 +43,11 @@ async function init() { const addresses = await deployTestEns({ web3, accounts, dnssec, migrate }) console.log(addresses) - const { ensAddress, oldResolverAddresses } = addresses + const { + ensAddress, + oldResolverAddresses, + oldContentResolverAddresses + } = addresses const envLocalFile = './.env.local' fs.writeFileSync('./cypress.env.json', JSON.stringify(addresses)) fs.writeFileSync(envLocalFile, `REACT_APP_ENS_ADDRESS=${ensAddress}`) @@ -53,11 +57,21 @@ async function init() { envLocalFile, `REACT_APP_DEPRECATED_RESOLVERS=${oldResolverAddresses.join(',')}` ) + fs.appendFileSync(envLocalFile, '\n') + fs.appendFileSync( + envLocalFile, + `REACT_APP_OLD_CONTENT_RESOLVERS=${oldContentResolverAddresses.join(',')}` + ) console.log( `Successfully wrote Old resolver address ${oldResolverAddresses.join( ',' )} to .env.local` ) + console.log( + `Successfully wrote Old content resolver address ${oldContentResolverAddresses.join( + ',' + )} to .env.local` + ) } init() diff --git a/yarn.lock b/yarn.lock index d118fb4d2..e23e558ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1337,10 +1337,10 @@ truffle "^5.0.5" web3-utils "^1.0.0-beta.48" -"@ensdomains/mock@2.0.6": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@ensdomains/mock/-/mock-2.0.6.tgz#af8bc795c6d313efe4d8145b29d9c185f833b4e9" - integrity sha512-a74vfJHCWsTmal2dOAEiS7Mb1gZvob/7EmdpZjWXk+8XwFVIHsz2rXf8d//p/FN1T/Tct8XdJQrd1vXl9GEyTw== +"@ensdomains/mock@2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@ensdomains/mock/-/mock-2.0.7.tgz#657b14635473bbb2c312d8edf781a327b7190aa8" + integrity sha512-f8GiV/iQTBgax/6kHsErhbTzs/TD9uFEDmVDHrqEjB1yP0zlaMzhH+SIlO2mz7zHoEMzoey+R+qYBXE+IEDYNg== dependencies: "@0xproject/utils" "^2.0.2" "@babel/runtime" "^7.4.4" @@ -1415,10 +1415,10 @@ truffle-default-builder "^2.0.0" underscore "^1.8.3" -"@ensdomains/ui@2.0.11": - version "2.0.11" - resolved "https://registry.yarnpkg.com/@ensdomains/ui/-/ui-2.0.11.tgz#9c1b2e3a564e00be99f44cdff12d595dfa34d4c9" - integrity sha512-96o5uVU+R+2/LkOkNlrs07YVFsoTivXNJaf3S5O7i/GvESntnFibRsqG4BtGj8XwMWwafjES7UcMI1Aw9gWzYw== +"@ensdomains/ui@2.0.12": + version "2.0.12" + resolved "https://registry.yarnpkg.com/@ensdomains/ui/-/ui-2.0.12.tgz#3b63ef5642596aafc0b00eae3200dceacd4d476c" + integrity sha512-u6keOxldv/gU0w2/NHSTDWfeiBH7lMNBKTCCZq32bdLOgj11yvvXfvoaiPY85nxw+YJUYjUL7Nmpk+ZGdBiP+Q== dependencies: "@0xproject/utils" "^2.0.2" "@babel/runtime" "^7.4.4"