-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from novasamatech/feat/ui_assets
Feat: Assets page
- Loading branch information
Showing
78 changed files
with
1,169 additions
and
638 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
export const POLKADOT = '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'; | ||
export const KUSAMA = '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe'; | ||
export const POLKADOT_ASSET_HUB = '0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f'; | ||
export const WESTEND = '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e'; | ||
|
||
export const DEFAULT_CONNECTED_CHAINS: Record<ChainId, AssetId[]> = { | ||
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': [0], // POLKADOT | ||
'0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe': [0], // KUSAMA | ||
'0x68d56f15f85d3136970ec16946040bc1752654e906147f7e43e9d539d7c3de2f': [1], // DOT_ASSET_HUB | ||
'0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e': [0], // WESTEND | ||
[POLKADOT]: [0], | ||
[KUSAMA]: [0], | ||
[POLKADOT_ASSET_HUB]: [1], | ||
[WESTEND]: [0], | ||
}; | ||
|
||
export const DEFAULT_CHAINS_ORDER: Record<ChainId, Record<AssetId, number>> = { | ||
[POLKADOT]: { | ||
0: 0, // DOT - index_0 | ||
}, | ||
[KUSAMA]: { | ||
0: 1, // KSM - index_1 | ||
}, | ||
[POLKADOT_ASSET_HUB]: { | ||
1: 2, // USDT - index_2 | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { Shimmering } from '../Shimmering/Shimmering'; | ||
|
||
import { cnTw } from '@/common/utils'; | ||
import { useToggle } from '@/common/utils/hooks'; | ||
import { Shimmering } from '@/components'; | ||
|
||
type Props = { | ||
src?: string; | ||
src: string; | ||
size?: number; | ||
className?: string; | ||
}; | ||
|
||
const AssetIcon = ({ src, size = 32, className }: Props) => { | ||
export const AssetIcon = ({ src, size = 32, className }: Props) => { | ||
const [isImgLoaded, toggleImgLoaded] = useToggle(); | ||
|
||
return ( | ||
<div className={cnTw('rounded-full', isImgLoaded && 'bg-icon-on-neutral', className)}> | ||
{!isImgLoaded && <Shimmering circle width={size} height={size} className={className} />} | ||
<img | ||
alt="" | ||
src={src} | ||
className={cnTw(!isImgLoaded && 'opacity-0')} | ||
style={{ width: size, height: size }} | ||
onLoad={toggleImgLoaded} | ||
/> | ||
</div> | ||
); | ||
}; | ||
useEffect(() => { | ||
const image = new Image(); | ||
image.src = src; | ||
image.onload = toggleImgLoaded; | ||
}, []); | ||
|
||
export default AssetIcon; | ||
if (!isImgLoaded) { | ||
return ( | ||
// Asset SVG icon has empty space between border and real icon | ||
<div | ||
className={cnTw('flex items-center justify-center', className)} | ||
style={{ width: `${size}px`, height: `${size}px` }} | ||
> | ||
<Shimmering circle width={Math.round(size * 0.75)} /> | ||
</div> | ||
); | ||
} | ||
|
||
return <img alt="" src={src} className={className} style={{ width: size, height: size }} />; | ||
}; |
Oops, something went wrong.