diff --git a/.changeset/rotten-toes-glow.md b/.changeset/rotten-toes-glow.md
new file mode 100644
index 0000000000..c575ba3dca
--- /dev/null
+++ b/.changeset/rotten-toes-glow.md
@@ -0,0 +1,5 @@
+---
+"fuels-wallet": patch
+---
+
+fix: nft list getting cut off
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/BalanceNFTs.tsx b/packages/app/src/systems/Account/components/BalanceNFTs/BalanceNFTs.tsx
index 59712e6250..39a8c4d806 100644
--- a/packages/app/src/systems/Account/components/BalanceNFTs/BalanceNFTs.tsx
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/BalanceNFTs.tsx
@@ -1,10 +1,14 @@
import { cssObj } from '@fuel-ui/css';
-import { Accordion, Badge, Box, Copyable, VStack } from '@fuel-ui/react';
+import { Accordion, Badge, Box, Copyable } from '@fuel-ui/react';
import type { CoinAsset } from '@fuel-wallet/types';
-import { useMemo } from 'react';
+import { memo, useMemo } from 'react';
+import { NFTImageLoading } from '~/systems/Account/components/BalanceNFTs/NFTImageLoading';
+import { AssetList } from '~/systems/Asset';
import { AssetListEmpty } from '~/systems/Asset/components/AssetList/AssetListEmpty';
import { shortAddress } from '~/systems/Core';
import { NFTImage } from './NFTImage';
+import { NFTListItemLoading } from './NFTListItemLoading';
+import { NFTTitleLoading } from './NFTTitleLoading';
import {
UNKNOWN_COLLECTION_TITLE,
groupNFTsByCollection,
@@ -12,9 +16,15 @@ import {
interface BalanceNFTsProps {
balances: CoinAsset[] | undefined;
+ isLoading?: boolean;
}
-export const BalanceNFTs = ({ balances = [] }: BalanceNFTsProps) => {
+const EMPTY_ARRAY: CoinAsset[] = [];
+
+export const BalanceNFTs = ({
+ balances = EMPTY_ARRAY,
+ isLoading,
+}: BalanceNFTsProps) => {
const { collections, defaultValue } = useMemo(() => {
const collections = groupNFTsByCollection(balances);
const defaultValue = collections
@@ -27,21 +37,31 @@ export const BalanceNFTs = ({ balances = [] }: BalanceNFTsProps) => {
};
}, [balances]);
- if (collections.length === 0) {
- return (
-
- );
- }
-
return (
-
- {collections.map((collection) => {
- return (
+ {isLoading && !collections.length && (
+
+
+
+
+
+
+
+
+
+
+
+ )}
+ {!isLoading && !collections?.length && (
+
+ )}
+ {!!collections.length && (
+
+ {collections.map((collection) => (
@@ -64,9 +84,9 @@ export const BalanceNFTs = ({ balances = [] }: BalanceNFTsProps) => {
- );
- })}
-
+ ))}
+
+ )}
);
};
@@ -102,7 +122,6 @@ const styles = {
svg: {
width: '$3',
- height: '$3',
},
},
'.fuel_Accordion-content': {
@@ -128,6 +147,17 @@ const styles = {
gridTemplateColumns: 'repeat(3, 1fr)',
gap: '$3',
}),
+ gridLoading: cssObj({
+ display: 'grid',
+ gridTemplateColumns: 'repeat(3, 1fr)',
+ gap: '$3',
+ marginTop: '14px',
+ paddingLeft: '$5',
+ paddingRight: '$2',
+ }),
+ titleLoading: cssObj({
+ marginTop: '16px',
+ }),
name: cssObj({
marginTop: '$1',
gap: '$0',
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/NFTImage.tsx b/packages/app/src/systems/Account/components/BalanceNFTs/NFTImage.tsx
index 6ad543e539..8c04a91722 100644
--- a/packages/app/src/systems/Account/components/BalanceNFTs/NFTImage.tsx
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/NFTImage.tsx
@@ -1,6 +1,7 @@
import { cssObj } from '@fuel-ui/css';
-import { Box, ContentLoader, Icon } from '@fuel-ui/react';
-import { useEffect, useRef, useState } from 'react';
+import { Box, ContentLoader, Icon, Image } from '@fuel-ui/react';
+import { memo, useEffect, useRef, useState } from 'react';
+import { NFTImageLoading } from '~/systems/Account/components/BalanceNFTs/NFTImageLoading';
import { shortAddress } from '~/systems/Core';
interface NFTImageProps {
@@ -8,7 +9,15 @@ interface NFTImageProps {
image: string | undefined;
}
-export const NFTImage = ({ assetId, image }: NFTImageProps) => {
+function Empty() {
+ return (
+
+
+
+ );
+}
+
+const _NFTImage = ({ assetId, image }: NFTImageProps) => {
const imgRef = useRef(null);
const [fallback, setFallback] = useState(false);
@@ -25,31 +34,22 @@ export const NFTImage = ({ assetId, image }: NFTImageProps) => {
}
}, []);
- if (image && !fallback) {
- return (
-
- {isLoading && (
-
-
-
- )}
-
;
+
+ return (
+
+ {image && !fallback && isLoading && }
+ {image && !fallback && (
+ setLoading(false)}
- onError={() => {
- setFallback(true);
- }}
+ onError={() => setFallback(true)}
/>
-
- );
- }
-
- return (
-
-
+ )}
);
};
@@ -59,7 +59,7 @@ const styles = {
aspectRatio: '1 / 1',
borderRadius: '12px',
overflow: 'hidden',
-
+ minHeight: '89px',
img: {
width: '100%',
objectFit: 'cover',
@@ -79,3 +79,7 @@ const styles = {
alignItems: 'center',
}),
};
+
+export const NFTImage = memo(_NFTImage, (a, b) => {
+ return a.assetId === b.assetId && a.image === b.image;
+});
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/NFTImageLoading.tsx b/packages/app/src/systems/Account/components/BalanceNFTs/NFTImageLoading.tsx
new file mode 100644
index 0000000000..ec3f904e31
--- /dev/null
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/NFTImageLoading.tsx
@@ -0,0 +1,19 @@
+import { cssObj } from '@fuel-ui/css';
+import { Box, ContentLoader } from '@fuel-ui/react';
+
+export function NFTImageLoading({ size = 89 }: { size?: number }) {
+ return (
+
+
+
+
+
+ );
+}
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/NFTListItemLoading.tsx b/packages/app/src/systems/Account/components/BalanceNFTs/NFTListItemLoading.tsx
new file mode 100644
index 0000000000..bd9d4007a7
--- /dev/null
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/NFTListItemLoading.tsx
@@ -0,0 +1,19 @@
+import { cssObj } from '@fuel-ui/css';
+import { Box } from '@fuel-ui/react';
+import { NFTImageLoading } from './NFTImageLoading';
+import { NFTTitleLoading } from './NFTTitleLoading';
+
+export function NFTListItemLoading() {
+ return (
+
+
+
+
+ );
+}
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/NFTTitleLoading.tsx b/packages/app/src/systems/Account/components/BalanceNFTs/NFTTitleLoading.tsx
new file mode 100644
index 0000000000..360f3f8f5a
--- /dev/null
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/NFTTitleLoading.tsx
@@ -0,0 +1,23 @@
+import { cssObj } from '@fuel-ui/css';
+import { Box, ContentLoader } from '@fuel-ui/react';
+
+export function NFTTitleLoading({ height = 18 }: { height?: number }) {
+ return (
+
+
+
+
+
+ );
+}
diff --git a/packages/app/src/systems/Account/components/BalanceNFTs/constants.ts b/packages/app/src/systems/Account/components/BalanceNFTs/constants.ts
new file mode 100644
index 0000000000..335b16345e
--- /dev/null
+++ b/packages/app/src/systems/Account/components/BalanceNFTs/constants.ts
@@ -0,0 +1 @@
+export const BALANCE_NFTS_TAB_HEIGHT = 244;
\ No newline at end of file
diff --git a/packages/app/src/systems/Asset/components/AssetList/AssetListEmpty.tsx b/packages/app/src/systems/Asset/components/AssetList/AssetListEmpty.tsx
index e1d3816eba..623981d478 100644
--- a/packages/app/src/systems/Asset/components/AssetList/AssetListEmpty.tsx
+++ b/packages/app/src/systems/Asset/components/AssetList/AssetListEmpty.tsx
@@ -1,5 +1,6 @@
import { cssObj } from '@fuel-ui/css';
-import { Button, Card, Heading, Icon, Text } from '@fuel-ui/react';
+import { Box, Button, Card, Heading, Icon, Text } from '@fuel-ui/react';
+import { BALANCE_NFTS_TAB_HEIGHT } from '~/systems/Account/components/BalanceNFTs/constants';
import { useFundWallet } from '~/systems/FundWallet';
export type AssetListEmptyProps = {
@@ -17,29 +18,34 @@ export function AssetListEmpty({
const showFund = hasFaucet || hasBridge;
return (
-
-
- {!!text && {text}}
- {!!supportText && {supportText}}
- {showFund && !hideFaucet && (
- /**
- * TODO: need to add right faucet icon on @fuel-ui
- */
-
- )}
-
-
+
+
+
+ {!!text && {text}}
+ {!!supportText && {supportText}}
+ {showFund && !hideFaucet && (
+ /**
+ * TODO: need to add right faucet icon on @fuel-ui
+ */
+
+ )}
+
+
+
);
}
const styles = {
+ container: cssObj({
+ minHeight: BALANCE_NFTS_TAB_HEIGHT,
+ }),
empty: cssObj({
h5: {
margin: 0,
diff --git a/packages/app/src/systems/Home/pages/Home/Home.tsx b/packages/app/src/systems/Home/pages/Home/Home.tsx
index 23600b7c05..2df6066dc0 100644
--- a/packages/app/src/systems/Home/pages/Home/Home.tsx
+++ b/packages/app/src/systems/Home/pages/Home/Home.tsx
@@ -7,6 +7,7 @@ import { useBalanceVisibility } from '~/systems/Core/hooks/useVisibility';
import { BalanceAssets } from '~/systems/Account/components/BalanceAssets/BalanceAssets';
import { BalanceNFTs } from '~/systems/Account/components/BalanceNFTs/BalanceNFTs';
+import { BALANCE_NFTS_TAB_HEIGHT } from '~/systems/Account/components/BalanceNFTs/constants';
import { QuickAccountConnect } from '~/systems/Account/components/QuickAccountConnect/QuickAccountConnect';
import { HomeActions } from '../../components';
@@ -52,7 +53,7 @@ export function Home() {
-
+
@@ -69,8 +70,7 @@ const styles = {
},
}),
assetsList: cssObj({
- maxHeight: 200,
- paddingBottom: '$4',
+ height: BALANCE_NFTS_TAB_HEIGHT,
...scrollable(),
overflowY: 'scroll !important',
}),