Commit 2fe444f9 authored by lynn's avatar lynn Committed by GitHub

fix: make addresses clickable (#5040)

* init

* fix

* change color to primary

* fix

* respond to comments
parent 155bf2e8
...@@ -98,7 +98,7 @@ export const eventTime = style([ ...@@ -98,7 +98,7 @@ export const eventTime = style([
]) ])
export const addressCell = style([ export const addressCell = style([
subhead, buttonTextMedium,
sprinkles({ sprinkles({
color: 'textPrimary', color: 'textPrimary',
height: 'full', height: 'full',
......
...@@ -39,6 +39,7 @@ interface ActivityProps { ...@@ -39,6 +39,7 @@ interface ActivityProps {
contractAddress: string contractAddress: string
rarityVerified: boolean rarityVerified: boolean
collectionName: string collectionName: string
chainId?: number
} }
const initialFilterState = { const initialFilterState = {
...@@ -54,7 +55,7 @@ const reduceFilters = (state: typeof initialFilterState, action: { eventType: Ac ...@@ -54,7 +55,7 @@ const reduceFilters = (state: typeof initialFilterState, action: { eventType: Ac
const baseHref = (event: ActivityEvent) => `/#/nfts/asset/${event.collectionAddress}/${event.tokenId}?origin=activity` const baseHref = (event: ActivityEvent) => `/#/nfts/asset/${event.collectionAddress}/${event.tokenId}?origin=activity`
export const Activity = ({ contractAddress, rarityVerified, collectionName }: ActivityProps) => { export const Activity = ({ contractAddress, rarityVerified, collectionName, chainId }: ActivityProps) => {
const [activeFilters, filtersDispatch] = useReducer(reduceFilters, initialFilterState) const [activeFilters, filtersDispatch] = useReducer(reduceFilters, initialFilterState)
const { const {
...@@ -162,8 +163,8 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName }: Ac ...@@ -162,8 +163,8 @@ export const Activity = ({ contractAddress, rarityVerified, collectionName }: Ac
eventTransactionHash={event.transactionHash} eventTransactionHash={event.transactionHash}
/> />
<PriceCell marketplace={event.marketplace} price={event.price} /> <PriceCell marketplace={event.marketplace} price={event.price} />
<AddressCell address={event.fromAddress} /> <AddressCell address={event.fromAddress} chainId={chainId} />
<AddressCell address={event.toAddress} desktopLBreakpoint /> <AddressCell address={event.toAddress} chainId={chainId} desktopLBreakpoint />
<BuyCell <BuyCell
event={event} event={event}
collectionName={collectionName} collectionName={collectionName}
......
import { ChainId } from '@uniswap/smart-order-router'
import { MouseoverTooltip } from 'components/Tooltip' import { MouseoverTooltip } from 'components/Tooltip'
import { Box } from 'nft/components/Box' import { Box } from 'nft/components/Box'
import { Column, Row } from 'nft/components/Flex' import { Column, Row } from 'nft/components/Flex'
...@@ -26,9 +27,31 @@ import { getTimeDifference, isValidDate } from 'nft/utils/date' ...@@ -26,9 +27,31 @@ import { getTimeDifference, isValidDate } from 'nft/utils/date'
import { putCommas } from 'nft/utils/putCommas' import { putCommas } from 'nft/utils/putCommas'
import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity' import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity'
import { MouseEvent, useMemo, useState } from 'react' import { MouseEvent, useMemo, useState } from 'react'
import styled from 'styled-components/macro'
import { ExternalLink } from 'theme'
import { ExplorerDataType, getExplorerLink } from 'utils/getExplorerLink'
import * as styles from './Activity.css' import * as styles from './Activity.css'
const AddressLink = styled(ExternalLink)`
color: ${({ theme }) => theme.textPrimary};
text-decoration: none;
a {
color: ${({ theme }) => theme.textPrimary};
text-decoration: none;
}
a:hover {
color: ${({ theme }) => theme.textPrimary};
text-decoration: none;
opacity: ${({ theme }) => theme.opacity.hover};
}
a:focus {
color: ${({ theme }) => theme.textPrimary};
text-decoration: none;
opacity: ${({ theme }) => theme.opacity.click};
}
`
const formatListingStatus = (status: OrderStatus): string => { const formatListingStatus = (status: OrderStatus): string => {
switch (status) { switch (status) {
case OrderStatus.EXECUTED: case OrderStatus.EXECUTED:
...@@ -102,15 +125,21 @@ export const BuyCell = ({ ...@@ -102,15 +125,21 @@ export const BuyCell = ({
interface AddressCellProps { interface AddressCellProps {
address?: string address?: string
desktopLBreakpoint?: boolean desktopLBreakpoint?: boolean
chainId?: number
} }
export const AddressCell = ({ address, desktopLBreakpoint }: AddressCellProps) => { export const AddressCell = ({ address, desktopLBreakpoint, chainId }: AddressCellProps) => {
return ( return (
<Column <Column
display={{ sm: 'none', xl: desktopLBreakpoint ? 'none' : 'flex', xxl: 'flex' }} display={{ sm: 'none', xl: desktopLBreakpoint ? 'none' : 'flex', xxl: 'flex' }}
className={styles.addressCell} className={styles.addressCell}
> >
<Box>{address ? shortenAddress(address, 2, 4) : '-'}</Box> <AddressLink
href={getExplorerLink(chainId ?? ChainId.MAINNET, address ?? '', ExplorerDataType.ADDRESS)}
style={{ textDecoration: 'none' }}
>
<Box onClick={(e) => e.stopPropagation()}>{address ? shortenAddress(address, 2, 4) : '-'}</Box>
</AddressLink>
</Column> </Column>
) )
} }
......
...@@ -76,13 +76,13 @@ globalStyle(`${description} a[href]`, { ...@@ -76,13 +76,13 @@ globalStyle(`${description} a[href]`, {
globalStyle(`${description} a[href]:hover`, { globalStyle(`${description} a[href]:hover`, {
color: `${themeVars.colors.textSecondary}`, color: `${themeVars.colors.textSecondary}`,
opacity: '0.6', opacity: `${themeVars.opacity.hover}`,
textDecoration: 'none', textDecoration: 'none',
}) })
globalStyle(`${description} a[href]:active`, { globalStyle(`${description} a[href]:focus`, {
color: `${themeVars.colors.textSecondary}`, color: `${themeVars.colors.textSecondary}`,
opacity: '0.4', opacity: `${themeVars.opacity.pressed}`,
textDecoration: 'none', textDecoration: 'none',
}) })
......
...@@ -37,6 +37,11 @@ const themeContractValues = { ...@@ -37,6 +37,11 @@ const themeContractValues = {
deep: '', deep: '',
shallow: '', shallow: '',
}, },
opacity: {
hover: '0.6',
pressed: '0.4',
},
} }
export type Theme = typeof themeContractValues export type Theme = typeof themeContractValues
......
...@@ -124,6 +124,7 @@ const Collection = () => { ...@@ -124,6 +124,7 @@ const Collection = () => {
contractAddress={contractAddress} contractAddress={contractAddress}
rarityVerified={collectionStats?.rarityVerified ?? false} rarityVerified={collectionStats?.rarityVerified ?? false}
collectionName={collectionStats?.name ?? ''} collectionName={collectionStats?.name ?? ''}
chainId={chainId}
/> />
) )
: contractAddress && : contractAddress &&
......
...@@ -35,4 +35,8 @@ export const darkTheme: Theme = { ...@@ -35,4 +35,8 @@ export const darkTheme: Theme = {
deep: '12px 16px 24px rgba(0, 0, 0, 0.24), 12px 8px 12px rgba(0, 0, 0, 0.24), 4px 4px 8px rgba(0, 0, 0, 0.32)', deep: '12px 16px 24px rgba(0, 0, 0, 0.24), 12px 8px 12px rgba(0, 0, 0, 0.24), 4px 4px 8px rgba(0, 0, 0, 0.32)',
shallow: '4px 4px 10px rgba(0, 0, 0, 0.24), 2px 2px 4px rgba(0, 0, 0, 0.12), 1px 2px 2px rgba(0, 0, 0, 0.12)', shallow: '4px 4px 10px rgba(0, 0, 0, 0.24), 2px 2px 4px rgba(0, 0, 0, 0.12), 1px 2px 2px rgba(0, 0, 0, 0.12)',
}, },
opacity: {
hover: '0.6',
pressed: '0.4',
},
} }
...@@ -35,4 +35,8 @@ export const lightTheme: Theme = { ...@@ -35,4 +35,8 @@ export const lightTheme: Theme = {
deep: '8px 12px 20px rgba(51, 53, 72, 0.04), 4px 6px 12px rgba(51, 53, 72, 0.02), 4px 4px 8px rgba(51, 53, 72, 0.04)', deep: '8px 12px 20px rgba(51, 53, 72, 0.04), 4px 6px 12px rgba(51, 53, 72, 0.02), 4px 4px 8px rgba(51, 53, 72, 0.04)',
shallow: '4px 4px 10px rgba(0, 0, 0, 0.24), 2px 2px 4px rgba(0, 0, 0, 0.12), 1px 2px 2px rgba(0, 0, 0, 0.12)', shallow: '4px 4px 10px rgba(0, 0, 0, 0.24), 2px 2px 4px rgba(0, 0, 0, 0.12), 1px 2px 2px rgba(0, 0, 0, 0.12)',
}, },
opacity: {
hover: '0.6',
pressed: '0.4',
},
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment