Skip to content

Commit

Permalink
Refactor for checks, already imported value
Browse files Browse the repository at this point in the history
  • Loading branch information
abtestingalpha committed Oct 7, 2024
1 parent af4f8ae commit 91653c9
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions docs/bridge/src/components/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { BRIDGABLE_TOKENS, CHAINS } from '@synapsecns/synapse-constants'

const CHAINS_BY_ID = {}

for (const { chainImg, id, name } of Object.values(CHAINS)) {
if (id && name) {
CHAINS_BY_ID[id] = { name, chainImg }
}
}

export default () =>
Object.entries(BRIDGABLE_TOKENS).map(([id, tokens]) => {
const chain = CHAINS_BY_ID[id]
const chain = CHAINS.CHAINS_BY_ID[id]
const chainImg = chain.chainImg

return (
<section key={id}>
<h2
Expand All @@ -26,13 +19,6 @@ export default () =>
{chain.name} <code>{id}</code>
</h2>
{Object.values(tokens).map((token) => {
const tokenImg =
typeof token.icon === 'string' ? (
<img width="16" height="16" src={token.icon} />
) : (
token.icon({ width: 16, height: 16 })
)

return (
<span
key={token.addresses[id]}
Expand All @@ -43,7 +29,8 @@ export default () =>
padding: '.25rem .5rem',
}}
>
{tokenImg} {token.symbol}
<img width="16" height="16" src={token.icon} alt={token.symbol} />{' '}
{token.symbol}
</span>
)
})}
Expand Down

0 comments on commit 91653c9

Please sign in to comment.