-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from tom2drum/blockscout/v1
feat: Integration with Blockscout explorer
- Loading branch information
Showing
33 changed files
with
1,095 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/content/blockscout/components/ExplorerLink/index.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.container { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.icon { | ||
width: 20px; | ||
height: 20px; | ||
margin-right: 8px; | ||
} | ||
|
||
.name { | ||
color: var(--chakra-colors-link); | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
color: var(--chakra-colors-link_hovered); | ||
} | ||
} | ||
|
||
.arrow { | ||
width: 16px; | ||
height: 16px; | ||
color: var(--chakra-colors-gray-400); | ||
flex-shrink: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { type FC } from 'react' | ||
|
||
import styles from './index.module.less' | ||
|
||
interface Props { | ||
iconUrl: string | ||
name: string | ||
href: string | ||
} | ||
|
||
const ExplorerLink: FC<Props> = props => { | ||
return ( | ||
<a href={props.href} target="_blank" className={styles.container}> | ||
<img | ||
src={props.iconUrl} | ||
alt={props.name + ' explorer'} | ||
className={styles.icon} | ||
/> | ||
<span className={styles.name}>{props.name}</span> | ||
<svg className={styles.arrow}> | ||
<use href="/icons/sprite.svg#arrows/north-east"></use> | ||
</svg> | ||
</a> | ||
) | ||
} | ||
|
||
export default ExplorerLink |
23 changes: 23 additions & 0 deletions
23
src/content/blockscout/components/MainAddressLabel/index.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.container { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.implementation { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.arrow { | ||
width: 20px; | ||
height: 20px; | ||
transform: rotate(180deg); | ||
} | ||
|
||
:global(.ant-tag) a.link { | ||
color: var(--chakra-colors-link); | ||
|
||
&:hover { | ||
color: var(--chakra-colors-link_hovered); | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/content/blockscout/components/MainAddressLabel/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { type FC } from 'react' | ||
import { Tooltip } from 'antd' | ||
import cls from 'classnames' | ||
|
||
import type { AddressLabel } from '@common/api/types' | ||
import { TokenSymbol } from '@common/components' | ||
import styles from './index.module.less' | ||
|
||
import { Tag } from '../index' | ||
import { address } from '../../utils' | ||
|
||
const BUG_REPORT_URL = | ||
'https://docs.google.com/forms/d/e/1FAIpQLSfWk-74XOBL6sU7SgFRIuDzbFwaUt0wf7C4KE8U_E5FUcboog/viewform?usp=pp_url&entry.1591633300=Bug/Label+Reports' | ||
|
||
interface Props { | ||
data: AddressLabel | ||
} | ||
|
||
const MainAddressLabel: FC<Props> = ({ | ||
data: { label, implementLabel, implementAddress, implementLogo } | ||
}) => { | ||
return ( | ||
<Tooltip | ||
title={ | ||
<a href={BUG_REPORT_URL} target="_blank" className={cls(styles.link)}> | ||
Report | ||
</a> | ||
} | ||
> | ||
<div> | ||
<Tag icon={<TokenSymbol color="var(--chakra-colors-gray-500)" />}> | ||
<div className={cls(styles.container)}> | ||
{label.startsWith('0x') ? address.truncate(label) : label} | ||
{implementLabel?.trim() && implementAddress && ( | ||
<div className={cls(styles.implementation)}> | ||
<svg className={styles.arrow}> | ||
<use href="/icons/sprite.svg#arrows/east-mini"></use> | ||
</svg> | ||
<TokenSymbol | ||
logo={implementLogo} | ||
color="var(--chakra-colors-gray-500)" | ||
/> | ||
<a | ||
href={`/address/${implementAddress}`} | ||
target="_blank" | ||
className={cls(styles.link)} | ||
> | ||
{' '} | ||
{implementLabel.startsWith('0x') | ||
? address.truncate(implementAddress) | ||
: implementLabel} | ||
</a> | ||
</div> | ||
)} | ||
</div> | ||
</Tag> | ||
</div> | ||
</Tooltip> | ||
) | ||
} | ||
|
||
export default MainAddressLabel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.container:global(.ant-tag):global(.ant-tag-borderless) { | ||
display: flex; | ||
align-items: center; | ||
font-size: var(--chakra-fontSizes-sm); | ||
line-height: var(--chakra-lineHeights-5); | ||
padding: 2px 8px; | ||
border-radius: var(--chakra-radii-sm); | ||
border: none; | ||
margin: 0; | ||
} | ||
|
||
:global(.chakra-ui-dark) { | ||
.container:global(.ant-tag):global(.ant-tag-borderless) { | ||
background-color: var(--chakra-colors-whiteAlpha-400); | ||
color: var(--chakra-colors-gray-50); | ||
} | ||
} | ||
|
||
:global(.chakra-ui-light) { | ||
.container:global(.ant-tag):global(.ant-tag-borderless) { | ||
background-color: var(--chakra-colors-blackAlpha-100); | ||
color: var(--chakra-colors-chakra-body-text); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { type FC } from 'react' | ||
import { Tag as AntdTag } from 'antd' | ||
import cls from 'classnames' | ||
import styles from './index.module.less' | ||
|
||
interface Props { | ||
className?: string | ||
children: React.ReactNode | ||
icon?: React.ReactNode | ||
} | ||
|
||
const Tag: FC<Props> = ({ className, children, icon }) => { | ||
return ( | ||
<AntdTag | ||
icon={icon} | ||
bordered={false} | ||
className={cls(styles.container, className)} | ||
> | ||
{children} | ||
</AntdTag> | ||
) | ||
} | ||
|
||
export default Tag |
26 changes: 26 additions & 0 deletions
26
src/content/blockscout/components/TransactionExplanation/button.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.btn { | ||
display: flex; | ||
align-items: center; | ||
margin: 2px 0; | ||
|
||
@media screen and (max-width: 1000px) { | ||
margin: 0 0 0 28px; | ||
} | ||
|
||
&:global(.ant-btn-default):global(.ant-btn) { | ||
font-weight: 600; | ||
line-height: 20px; | ||
border-width: 2px; | ||
border-radius: 8px; | ||
padding: 4px 6px; | ||
color: var(--chakra-colors-link); | ||
border-color: var(--chakra-colors-link); | ||
background-color: transparent; | ||
|
||
&:hover { | ||
color: var(--chakra-colors-link_hovered) !important; | ||
border-color: var(--chakra-colors-link_hovered) !important; | ||
background-color: transparent !important; | ||
} | ||
} | ||
} |
Oops, something went wrong.