Skip to content

Commit

Permalink
fix(web): use proper render condition on nfts state (#77)
Browse files Browse the repository at this point in the history
It fixes #76
  • Loading branch information
gershon authored Feb 9, 2023
1 parent afb136d commit 10dcce2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 20 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import L1TokenList from './L1TokenList';
import L2TokenList from './L2TokenList';
import L1TokenList from '../ui/L1TokenList';
import L2TokenList from '../ui/L2TokenList';

export default function Page() {
return (
Expand Down
9 changes: 6 additions & 3 deletions apps/web/app/L1TokenList.tsx → apps/web/ui/L1TokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ export default function L1TokenList() {
async function fetchNfts() {
const res = await fetch(`/api/l1-nfts/${address}`);
const { nfts } = await res.json();
setNfts(nfts);

if (nfts && nfts.length) {
setNfts(nfts);
}
}

fetchNfts();
}, [address]);

if (!nfts) {
return null;
if (!nfts.length) {
return <div className="font-medium">L1 wallet has no tokens</div>;
}

if (!address) {
Expand Down
File renamed without changes.
53 changes: 38 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,29 @@
resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz"
integrity sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==

"@safe-global/safe-apps-provider@^0.15.2":
version "0.15.2"
resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.15.2.tgz#fa5c30140134e72bb969da76b80a16c545323e3a"
integrity sha512-BaoGAuY7h6jLBL7P+M6b7hd+1QfTv8uMyNF3udhiNUwA0XwfzH2ePQB13IEV3Mn7wdcIMEEUDS5kHbtAsj60qQ==
dependencies:
"@safe-global/safe-apps-sdk" "7.9.0"
events "^3.3.0"

"@safe-global/safe-apps-sdk@7.9.0", "@safe-global/safe-apps-sdk@^7.9.0":
version "7.9.0"
resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-7.9.0.tgz#0c79a7760470bfdaf4cce9aa5bceef56898c7037"
integrity sha512-S2EI+JL8ocSgE3uGNaDZCzKmwfhtxXZFDUP76vN0FeaY35itFMyi8F0Vhxu0XnZm3yLzJE3tp5px6GhuQFLU6w==
dependencies:
"@safe-global/safe-gateway-typescript-sdk" "^3.5.3"
ethers "^5.7.2"

"@safe-global/safe-gateway-typescript-sdk@^3.5.3":
version "3.7.0"
resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.7.0.tgz#2af52f1bc73759b1b6a549fed598781c8c5fce72"
integrity sha512-3BvlUgp0oZ1Zkn7nG3wY1jvCEE4t530BjKcaa3r0qsf0whf/ez/0gmQwk7DTOGmVmvOfjj6HHikxnrUCCX+/3Q==
dependencies:
cross-fetch "^3.1.5"

"@scure/base@~1.1.0":
version "1.1.1"
resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz"
Expand Down Expand Up @@ -3433,28 +3456,28 @@
"@walletconnect/window-getters" "^1.0.1"
tslib "1.14.1"

"@web3modal/core@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@web3modal/core/-/core-2.0.0.tgz#151bc60702fb5e8367a06a97a8fe39a81226409d"
integrity sha512-ZoM3U5DndBAVnnkBJ3hIkOKO81VtWfyda458D1vdN/T6q8IoWzWZR5QHZNc1qNKqm7ecXfEpsPj2YMS3bgOY2A==
"@web3modal/core@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@web3modal/core/-/core-2.1.1.tgz#e1ebe8faaae6e4b74df911fd5ac6023f280b12c1"
integrity sha512-GAZAvfkPHoX2/fghQmf+y36uDspk9wBJxG7qLPUNTHzvIfRoNHWbTt3iEvRdPmUZwbTGDn1jvz9z0uU67gvZdw==
dependencies:
buffer "6.0.3"
valtio "1.9.0"

"@web3modal/standalone@^2.0.0-rc.2":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@web3modal/standalone/-/standalone-2.0.0.tgz#359aa42e31020bf3d608d8668329ab4e2fdbcaf6"
integrity sha512-/YcAWgnVtTFeVFrHlhYemS1NU9ds9nbMuV1njjbS9+yDirOXfUenPORi6X1AGs5pUrDnR4IwDgQzdd5wqg6kZw==
version "2.1.1"
resolved "https://registry.yarnpkg.com/@web3modal/standalone/-/standalone-2.1.1.tgz#e496e54af5ecf6e282ff7f287eebce7f1ac90bd2"
integrity sha512-K06VkZqltLIBKpnLeM2oszRDSdLnwXJWCcItWEOkH4LDFQIiq8lSeLhcamuadRxRKF4ZyTSLHHJ5MFcMfZEHQQ==
dependencies:
"@web3modal/core" "2.0.0"
"@web3modal/ui" "2.0.0"
"@web3modal/core" "2.1.1"
"@web3modal/ui" "2.1.1"

"@web3modal/ui@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@web3modal/ui/-/ui-2.0.0.tgz#a06127bc09bb0da2a914f51f91bd54b636b4ff88"
integrity sha512-kNSXD/YI+Sl92hxMzsjkRWUj8H+CyV89WDS0Ywy2YV9HxVzC6MzntnsYZ4rti5//IzeDlxPhTKKaiBWE68Gwzw==
"@web3modal/ui@2.1.1":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@web3modal/ui/-/ui-2.1.1.tgz#300dceeee8a54be70aad74fb4a781ac22439eded"
integrity sha512-0jRDxgPc/peaE5KgqnzzriXhdVu5xNyCMP5Enqdpd77VkknJIs7h16MYKidxgFexieyHpCOssWySsryWcP2sXA==
dependencies:
"@web3modal/core" "2.0.0"
"@web3modal/core" "2.1.1"
lit "2.6.1"
motion "10.15.5"
qrcode "1.5.1"
Expand Down Expand Up @@ -7397,7 +7420,7 @@ ethereumjs-wallet@0.6.5:
utf8 "^3.0.0"
uuid "^3.3.2"

ethers@5.7.2, ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7, ethers@^5.5.2:
ethers@5.7.2, ethers@^5.0.1, ethers@^5.0.2, ethers@^5.4.7, ethers@^5.5.2, ethers@^5.7.2:
version "5.7.2"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e"
integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==
Expand Down

0 comments on commit 10dcce2

Please sign in to comment.