dydx-v4-web/src/components/AssetIcon.tsx
Jared Vu 793b522487
New Market Widget (#234)
* 🚧 New Market Form

* use dev-5 as default

* Additional UI work

* Add mock data

* 💄 More UI items

* 💄 add preview step

* 💄 Disable proposal button if not enough native tokens

* ✏️ Add disclaimer

* ✏️ fix combobox search

* 🚧 clean up components

* Add filters, modify, button

*  feat: Add details to New Market Dialog

* add assetName

* add helper method - spagetti code

* Update NewMarketMessageDetailsDialog, attempt to hook up client call

* 🚨 fix mobile safari overflow

* update init deposit to 10_001 whole token

* reduce delay block to 5

* Update mock data

* 🚧 SO FRIGGIN CLOSE

* 💄 style/ux nits

* add gov to registry

* PLS

* IT FUCKING WORKS

* Add assets

* FIX TICKER

* ADD NEW ASSETICON

* button width

* change default env to dev

* Remove mention of Impersonation dialog

* Market Search entry point

* uncomment feature

* Clean up NewMarketStep components

* Restore env.json

* Add space T.T

* useGlobalCommands fix types

* 🚧 feat: useNextClobPairId hook WIP

* Add potentialMarkets hook to parse CSV and hide new market entrypoints

* Use updated stringKeys

* Update localization, import nits

* bump v4-client

* add gov vars

* new useGovernanceVariables

* Add validator client calls: proposal fetch/submission

* Update token usage, utilize gov vars

* remove console log

* import nits

* NewMarketMessageDetailsDialog: Fix initial_deposit_amount

* NewMarketAgreement Dialog

* confirm flow

* Remove initialDepositAmount from mainnet env

* NewMarket: Add stringParams to step3

* Update csv

* update env.json add localization changes

* cleanup initialDepositAmountBN and decimals

* ^

* use undefined in place of 0 for DiffOutput

* remove hardcoded string

* Remove potentialMarket from csv

* Ensure user is out of liquidity tier modification

* bump localization, add additional details to receipts

* feedback addressed

* Add margin instead of space

* margin/padding nits, shorten filter method, remove ?. chaining

* additional feedback

---------

Co-authored-by: Taehoon Lee <19664986+ttl33@users.noreply.github.com>
2024-01-30 11:59:16 -08:00

90 lines
2.4 KiB
TypeScript

import styled, { type AnyStyledComponent } from 'styled-components';
import { Nullable } from '@/constants/abacus';
export type AssetSymbol = keyof typeof assetIcons;
const assetIcons = {
'1INCH': '/currencies/1inch.png',
AAVE: '/currencies/aave.png',
ADA: '/currencies/ada.png',
ALGO: '/currencies/algo.png',
APE: '/currencies/ape.png',
APT: '/currencies/apt.png',
ARB: '/currencies/arb.png',
ATOM: '/currencies/atom.png',
AVAX: '/currencies/avax.png',
BCH: '/currencies/bch.png',
BLUR: '/currencies/blur.png',
BONK: '/currencies/bonk.png',
BTC: '/currencies/btc.png',
CELO: '/currencies/celo.png',
COMP: '/currencies/comp.png',
CRV: '/currencies/crv.png',
DAI: '/currencies/dai.png',
DOGE: '/currencies/doge.png',
DOT: '/currencies/dot.png',
DYDX: '/currencies/dydx.png',
ENJ: '/currencies/enj.png',
EOS: '/currencies/eos.png',
ETC: '/currencies/etc.png',
ETH: '/currencies/eth.png',
FIL: '/currencies/fil.png',
ICP: '/currencies/icp.png',
LDO: '/currencies/ldo.png',
LINK: '/currencies/link.png',
LTC: '/currencies/ltc.png',
MATIC: '/currencies/matic.png',
MKR: '/currencies/mkr.png',
NEAR: '/currencies/near.png',
OP: '/currencies/op.png',
PEPE: '/currencies/pepe.png',
RUNE: '/currencies/rune.png',
SEI: '/currencies/sei.png',
SHIB: '/currencies/shib.png',
SNX: '/currencies/snx.png',
SOL: '/currencies/sol.png',
SUI: '/currencies/sui.png',
SUSHI: '/currencies/sushi.png',
TIA: '/currencies/tia.png',
TRX: '/currencies/trx.png',
UMA: '/currencies/uma.png',
UNI: '/currencies/uni.png',
USDC: '/currencies/usdc.png',
USDT: '/currencies/usdt.png',
WBTC: '/currencies/wbtc.png',
WETH: '/currencies/weth.png',
WLD: '/currencies/wld.png',
XLM: '/currencies/xlm.png',
XMR: '/currencies/xmr.png',
XRP: '/currencies/xrp.png',
XTZ: '/currencies/xtz.png',
YFI: '/currencies/yfi.png',
ZEC: '/currencies/zec.png',
ZRX: '/currencies/zrx.png',
} as const;
const isAssetSymbol = (symbol: Nullable<string>): symbol is AssetSymbol =>
symbol != null && assetIcons.hasOwnProperty(symbol);
export const AssetIcon = ({
symbol,
className,
}: {
symbol?: Nullable<string>;
className?: string;
}) => (
<Styled.Img
src={isAssetSymbol(symbol) ? assetIcons[symbol] : '/currencies/unavailable.png'}
className={className}
alt={symbol}
/>
);
const Styled: Record<string, AnyStyledComponent> = {};
Styled.Img = styled.img`
width: auto;
height: 1em;
`;