Skip to content

Commit

Permalink
refactor: refine overview placeholder of contract account
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Aug 27, 2022
1 parent 0d75ad3 commit ed1b253
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
21 changes: 12 additions & 9 deletions components/AccountOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,19 @@ const overviewPlaceHolderCount = (account: AccountOverviewProps['account']) => {
case GraphQLSchema.AccountType.PolyjuiceCreator:
return 1
case GraphQLSchema.AccountType.PolyjuiceContract:
const isVerified = !!account.smart_contract?.contract_source_code
if (!!account.smart_contract?.deployment_tx_hash && isVerified) {
return 2
} else if (!!account.smart_contract?.deployment_tx_hash && !isVerified) {
return 3
} else if (!account.smart_contract?.deployment_tx_hash && isVerified) {
return 0
} else {
return 1
let count = 1
if (account.udt?.id) {
count++
}

if (!account.smart_contract?.contract_source_code) {
count++
}

if (!account.udt?.icon && !account.udt?.description && !account.udt?.official_site) {
count++
}
return count
case GraphQLSchema.AccountType.MetaContract:
return 6
case GraphQLSchema.AccountType.EthAddrReg:
Expand Down
57 changes: 29 additions & 28 deletions components/SmartContractInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useTranslation } from 'next-i18next'
import NextLink from 'next/link'
import { Skeleton } from '@mui/material'
import Tooltip from 'components/Tooltip'
import InfoList from '../InfoList'
import { client, GraphQLSchema } from 'utils'
Expand Down Expand Up @@ -66,34 +67,34 @@ const SmartContract: React.FC<{
field: t('type'),
content: 'Smart Contract',
},
deployer
? {
field: t('deployer'),
content: (
<Tooltip title={deployer} placement="top">
<span>
<NextLink href={`/account/${deployer}`}>
<a className="mono-font">{deployer}</a>
</NextLink>
</span>
</Tooltip>
),
}
: null,
deployTxHash
? {
field: t('deployTx'),
content: (
<Tooltip title={deployTxHash} placement="top">
<span>
<NextLink href={`/tx/${deployTxHash}`}>
<a className="mono-font">{deployTxHash}</a>
</NextLink>
</span>
</Tooltip>
),
}
: null,
{
field: t('deployer'),
content: deployer ? (
<Tooltip title={deployer} placement="top">
<span>
<NextLink href={`/account/${deployer}`}>
<a className="mono-font">{deployer}</a>
</NextLink>
</span>
</Tooltip>
) : (
<Skeleton animation="wave" />
),
},
{
field: t('deployTx'),
content: deployTxHash ? (
<Tooltip title={deployTxHash} placement="top">
<span>
<NextLink href={`/tx/${deployTxHash}`}>
<a className="mono-font">{deployTxHash}</a>
</NextLink>
</span>
</Tooltip>
) : (
<Skeleton animation="wave" />
),
},
udt?.id
? {
field: t('token'),
Expand Down

1 comment on commit ed1b253

@vercel
Copy link

@vercel vercel bot commented on ed1b253 Aug 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.