Skip to content

Commit

Permalink
Fix: wrapped label and the basic info width (#726)
Browse files Browse the repository at this point in the history
* fix wrapped label and the basic info width
  • Loading branch information
alexsupa597 authored Nov 18, 2022
1 parent beaa0e1 commit 8b1988f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
38 changes: 22 additions & 16 deletions components/AccountOverview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,14 @@ const AccountOverview: React.FC<AccountOverviewProps & { refetch: () => Promise<
),
})

return (
<div className={styles.container} data-account-type={account.type}>
{account.type === GraphQLSchema.AccountType.MetaContract ? (
<MetaContract {...(account.script as MetaContract['script'])} />
) : null}
{account.type === GraphQLSchema.AccountType.EthUser ? (
<User nonce={account.nonce} isLoading={isOverviewLoading} />
) : null}
{account.type === GraphQLSchema.AccountType.EthAddrReg ? <EthAddrReg /> : null}
{account.type === GraphQLSchema.AccountType.PolyjuiceContract ? (
const getInfoBlock = account => {
const { type } = account

const blockMap = {
[`${GraphQLSchema.AccountType.MetaContract}`]: <MetaContract {...(account.script as MetaContract['script'])} />,
[`${GraphQLSchema.AccountType.EthUser}`]: <User nonce={account.nonce} isLoading={isOverviewLoading} />,
[`${GraphQLSchema.AccountType.EthAddrReg}`]: <EthAddrReg />,
[`${GraphQLSchema.AccountType.PolyjuiceContract}`]: (
<SmartContract
deployer={deployerAddr}
deployTxHash={account.smart_contract?.deployment_tx_hash!}
Expand All @@ -286,15 +284,23 @@ const AccountOverview: React.FC<AccountOverviewProps & { refetch: () => Promise<
refetch={refetch}
isLoading={isOverviewLoading}
/>
) : null}
{account.type === GraphQLSchema.AccountType.PolyjuiceCreator ? (
),
[`${GraphQLSchema.AccountType.PolyjuiceCreator}`]: (
<Polyjuice script={account.script as PolyjuiceCreator['script']} scriptHash={account.script_hash} />
) : null}
{account.type === GraphQLSchema.AccountType.Udt && account.udt ? (
),
[`${GraphQLSchema.AccountType.Udt}`]: account.udt ? (
<SUDT udt={account.udt} script={account.script} script_hash={account.script_hash} />
) : null}
{account.type === GraphQLSchema.AccountType.Unknown ? <UnknownAccount nonce={account.nonce} /> : null}
) : null,
[`${GraphQLSchema.AccountType.Unknown}`]: <UnknownAccount nonce={account.nonce} />,
}
const infoBlock = blockMap[type]

return infoBlock ? <div className={`${styles['info-width']}`}>{infoBlock}</div> : null
}

return (
<div className={styles.container} data-account-type={account.type}>
{getInfoBlock(account)}
<InfoList title={t('overview')} list={infoList} />
</div>
)
Expand Down
6 changes: 6 additions & 0 deletions components/AccountOverview/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@
}
}
}

@media screen and (min-width: 1024px) {
.info-width {
width: calc(50% - 32px);
}
}
1 change: 1 addition & 0 deletions pages/token/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ const Token: React.FC<Props> = () => {
</PageTitle>
<div className={styles.overview}>
<InfoList
className={styles['info-width']}
title={
<div className={styles.infoTitle}>
{t(`tokenInfo`)}
Expand Down
5 changes: 5 additions & 0 deletions pages/token/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
display: none;
}
}
@media screen and (min-width: 1024px) {
.info-width {
width: calc(50% - 32px);
}
}
}

.list {
Expand Down

0 comments on commit 8b1988f

Please sign in to comment.