-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAssetListSection.tsx
More file actions
60 lines (54 loc) · 1.5 KB
/
AssetListSection.tsx
File metadata and controls
60 lines (54 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import { Text, Box } from '@interchain-ui/react';
import { useChain } from '@interchain-kit/react';
import AssetsOverview from './AssetsOverview';
import { useAssets } from '@/hooks';
interface AssetListSectionProps {
chainName: string;
children?: React.ReactNode;
}
export const AssetListSection = ({ chainName }: AssetListSectionProps) => {
const { address } = useChain(chainName);
const { data, isLoading, refetch } = useAssets(chainName);
if (!address) {
return (
<Box maxWidth="768px" marginX="auto" marginBottom="60px">
<Text
fontSize="$xl"
fontWeight="$semibold"
attributes={{ marginBottom: '$10' }}
>
My assets
</Text>
<Box
height="160px"
bg="$cardBg"
borderRadius="$md"
p="$6"
display="flex"
justifyContent="center"
alignItems="center"
>
<Text fontSize="$md" color="$textSecondary">
Connect the wallet to see the assets
</Text>
</Box>
</Box>
);
}
return (
<Box maxWidth="$containerMd" marginX="auto" marginBottom="$17">
<AssetsOverview
isLoading={isLoading || !data}
assets={data?.assets ?? []}
prices={Object.fromEntries(
Object.entries(data?.prices ?? {}).filter(
([, value]) => value != null
)
)}
selectedChainName={chainName}
refetch={refetch}
/>
</Box>
);
};