Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fork from initial repo #32

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 34 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,54 @@ jobs:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: build
run: |
yarn --frozen-lockfile
yarn build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.MERGE_RELEASE_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
uses: mikeal/merge-release@master

deploy-website:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install, build & prepare
run: |
yarn --frozen-lockfile
yarn build
yarn link
cd gallery
yarn link @aragon/ui
yarn --frozen-lockfile
yarn build
echo 'ui.aragon.org' > dist/CNAME
cp public/favicon.svg dist
- name: Push to gh-pages
- name: save build away
id: temp
run: |
TEMP=$(mktemp -d)
cp -R gallery/dist/* $TEMP
echo "::set-output name=temp::$TEMP"
- name: Checkout pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: pages
- name: copy build
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.GH_PAGES_ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./gallery/dist
uses: peaceiris/actions-gh-pages@v2
TEMP: ${{ steps.temp.outputs.temp }}
run: |
cp -R $TEMP/* ./pages/
- name: commit and push
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'gh-pages'
directory: './pages'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dist/
/lib/
dist/
node_modules/
npm-debug.log
package-lock.json
Expand Down
6 changes: 3 additions & 3 deletions devbox/apps/DataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const DEMOS = new Map([
]}
renderEntryActions={entry => (
<ContextMenu>
<ContextMenuItem>Open on Etherscan</ContextMenuItem>
<ContextMenuItem>Open on Explorer</ContextMenuItem>
</ContextMenu>
)}
/>
Expand Down Expand Up @@ -285,7 +285,7 @@ const DEMOS = new Map([
]}
renderEntryActions={() => (
<ContextMenu>
<ContextMenuItem>Open on Etherscan</ContextMenuItem>
<ContextMenuItem>Open on Explorer</ContextMenuItem>
</ContextMenu>
)}
renderEntryExpansion={([_, entities]) => {
Expand Down Expand Up @@ -359,7 +359,7 @@ const DEMOS = new Map([
]}
renderEntryActions={() => (
<ContextMenu>
<ContextMenuItem>Open on Etherscan</ContextMenuItem>
<ContextMenuItem>Open on Explorer</ContextMenuItem>
</ContextMenu>
)}
renderEntryExpansion={([action, entities, manager, height]) => (
Expand Down
2 changes: 1 addition & 1 deletion devbox/apps/DataView/DataViewExpansion.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function DataViewExpansion(props) {
]}
renderEntryActions={() => (
<ContextMenu>
<ContextMenuItem>Open on Etherscan</ContextMenuItem>
<ContextMenuItem>Open on Explorer</ContextMenuItem>
</ContextMenu>
)}
renderEntryExpansion={([_, entities]) => {
Expand Down
6 changes: 3 additions & 3 deletions devbox/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3187,9 +3187,9 @@ [email protected]:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.3.4, ini@^1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

internal-ip@^4.3.0:
version "4.3.0"
Expand Down
6 changes: 3 additions & 3 deletions gallery/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3128,9 +3128,9 @@ [email protected]:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=

ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
version "1.3.5"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==
version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

internal-ip@^4.3.0:
version "4.3.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aragon/ui",
"version": "1.7.0",
"version": "1.9.3",
"author": "Aragon Association <[email protected]>",
"license": "MIT",
"repository": "github:aragon/aragon-ui",
Expand Down
9 changes: 8 additions & 1 deletion src/components/Accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import React, { useCallback, useMemo } from 'react'
import PropTypes from 'prop-types'
import DataView from '../DataView/DataView'

const Accordion = React.memo(function Accordion({ items, className, style }) {
const Accordion = React.memo(function Accordion({
items,
className,
style,
mode,
}) {
const fields = useMemo(() => [null], [])
const renderEntry = useCallback(([row]) => [row], [])
const renderEntryExpansion = useCallback(
Expand All @@ -19,6 +24,7 @@ const Accordion = React.memo(function Accordion({ items, className, style }) {
renderEntry={renderEntry}
renderEntryExpansion={renderEntryExpansion}
style={style}
mode={mode}
/>
)
})
Expand All @@ -31,6 +37,7 @@ Accordion.propTypes = {
className: PropTypes.string,
items: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.node)).isRequired,
style: PropTypes.object,
mode: PropTypes.oneOf(['adaptive', 'table', 'list']),
}

export default Accordion
2 changes: 1 addition & 1 deletion src/components/AppBadge/AppBadgePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const AppBadgePopover = React.memo(function AppBadgePopover({
)}
</ImageExists>
}
link={etherscanUrl && <Link href={etherscanUrl}>See on Etherscan</Link>}
link={etherscanUrl && <Link href={etherscanUrl}>See on Explorer</Link>}
onClose={onClose}
opener={opener}
popoverAction={popoverAction}
Expand Down
12 changes: 12 additions & 0 deletions src/components/DateRangePicker/MonthDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,16 @@ function WrappedMonthDay({ onClick, ...props }) {
}
}

WrappedMonthDay.propTypes = {
children: PropTypes.node,
disabled: PropTypes.bool,
selected: PropTypes.bool,
inRange: PropTypes.bool,
rangeBoundaryBegin: PropTypes.bool,
rangeBoundaryEnd: PropTypes.bool,
today: PropTypes.bool,
weekDay: PropTypes.bool,
onClick: PropTypes.func,
}

export default WrappedMonthDay
2 changes: 1 addition & 1 deletion src/components/IdentityBadge/IdentityBadgePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const IdentityBadgePopover = React.memo(function IdentityBadgePopover({
return (
<BadgePopoverBase
addressField={<AddressField address={address} />}
link={etherscanUrl && <Link href={etherscanUrl}>See on Etherscan</Link>}
link={etherscanUrl && <Link href={etherscanUrl}>See on Explorer</Link>}
onClose={onClose}
opener={opener}
popoverAction={popoverAction}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Input/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class Checkbox extends React.PureComponent {
if (checked) return 'true'
return 'false'
}
handleClick = () => {
handleKeyPress = e => {
e.preventDefault()
}
handleClick = e => {
const { onChange, checked, indeterminate } = this.props
onChange(indeterminate ? false : !checked)
}
Expand Down Expand Up @@ -95,6 +98,7 @@ class Checkbox extends React.PureComponent {
tabIndex={tabIndex}
aria-checked={this.getAriaChecked()}
onClick={this.handleClick}
onKeyPress={this.handleKeyPress}
onFocus={onFocus}
disabled={disabled}
css={`
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenBadge/TokenBadgePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const TokenBadgePopover = React.memo(function TokenBadgePopover({
<AddressField address={address} />
)
}
link={etherscanUrl && <Link href={etherscanUrl}>See on Etherscan</Link>}
link={etherscanUrl && <Link href={etherscanUrl}>See on Explorer</Link>}
onClose={onClose}
opener={opener}
title={title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionProgress/TransactionProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const TransactionProgress = React.memo(function TransactionProgress({
</div>
)}
<Link href={transactionHashUrl} css="text-decoration: none">
See on Etherscan
See on Explorer
</Link>
</div>
</section>
Expand Down
66 changes: 30 additions & 36 deletions src/utils/web3.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,43 @@ const ADDRESS_REGEX = /^0x[0-9a-fA-F]{40}$/
const TRUST_WALLET_BASE_URL =
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum'

const ETHERSCAN_NETWORK_TYPES = new Map([
['main', ''],
['kovan', 'kovan.'],
['rinkeby', 'rinkeby.'],
['ropsten', 'ropsten.'],
['goerli', 'goerli.'],
const ETHERSCAN_URL = 'etherscan.io'
const POLYGON_URL = 'polygonscan.com'

const NETWORK_TYPES_URLS = new Map([
['main', ETHERSCAN_URL],
['kovan', `kovan.${ETHERSCAN_URL}`],
['rinkeby', `rinkeby.${ETHERSCAN_URL}`],
['ropsten', `ropsten.${ETHERSCAN_URL}`],
['goerli', `goerli.${ETHERSCAN_URL}`],
['matic', POLYGON_URL],
['mumbai', `mumbai.${POLYGON_URL}`],
['harmony', `explorer.harmony.one`],
['harmonyTest', `explorer.pops.one`],
])
const ETHERSCAN_TYPES = new Map([

const URL_TYPES = new Map([
['block', 'block'],
['transaction', 'tx'],
['address', 'address'],
['token', 'token'],
])

const BLOCK_EXPLORERS = {
etherscan: ({ type, value, networkType }) => {
if (networkType === 'private') {
return ''
}
function _getBlockExplorer({ type, value, networkType }) {
if (networkType === 'private') {
return ''
}

if (!ETHERSCAN_NETWORK_TYPES.has(networkType)) {
throw new Error('provider not supported.')
}
if (!ETHERSCAN_TYPES.has(type)) {
throw new Error('type not supported.')
}
if (!NETWORK_TYPES_URLS.has(networkType)) {
throw new Error('network type not supported.')
}
if (!URL_TYPES.has(type)) {
throw new Error('type not supported.')
}

const subdomain = ETHERSCAN_NETWORK_TYPES.get(networkType)
const typePart = ETHERSCAN_TYPES.get(type)
return `https://${subdomain}etherscan.io/${typePart}/${value}`
},
const subdomain = NETWORK_TYPES_URLS.get(networkType)
const typePart = URL_TYPES.get(type)
return `https://${subdomain}/${typePart}/${value}`
}

/**
Expand Down Expand Up @@ -155,23 +161,11 @@ export function isTransaction(transaction) {
* @param {string} value Identifier of the object, depending on the type (block number, transaction hash, …).
* @param {object} options The optional parameters.
* @param {string} options.networkType The Ethereum network type (main, kovan, rinkeby, ropsten, goerli, or private).
* @param {string} options.provider The explorer provider (e.g. etherscan).
* @returns {string} The generated URL, or an empty string if the parameters are invalid.
*/
export function blockExplorerUrl(
type,
value,
{ networkType = 'main', provider = 'etherscan' } = {}
) {
const explorer = BLOCK_EXPLORERS[provider]

if (!explorer) {
warn('blockExplorerUrl(): provider not supported.')
return ''
}

export function blockExplorerUrl(type, value, { networkType = 'main' } = {}) {
try {
return explorer({ type, value, networkType })
return _getBlockExplorer({ type, value, networkType })
} catch (err) {
warn(`blockExplorerUrl(): ${err.message}`)
return ''
Expand Down
Loading