Skip to content

Commit

Permalink
Merge branch 'ui/diamond' of https://github.com/bojan07/ubiquity-dollar
Browse files Browse the repository at this point in the history
… into ui/diamond
  • Loading branch information
bojan07 committed Oct 23, 2023
2 parents ddd16bb + cc7962f commit fd7f8a0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
26 changes: 14 additions & 12 deletions packages/dapp/components/layout/inventory.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Tippy from "@tippyjs/react";
import { BaseContract, BigNumber, ethers } from "ethers";
import { useEffect } from "react";
import { useState } from "react";
import useEffectAsync from "../lib/hooks/use-effect-async";

import useWeb3 from "@/lib/hooks/use-web-3";
import icons from "@/ui/icons";
Expand All @@ -17,8 +18,12 @@ const Inventory = () => {
const [balances, refreshBalances] = useBalances();
const protocolContracts = useProtocolContracts();
const namedContracts = useNamedContracts();
const [contracts, setContracts] = useState<ProtocolContracts>();

useEffectAsync(async () => {
const contract = await protocolContracts;
setContracts(contract);

useEffect(() => {
if (walletAddress) {
refreshBalances();
}
Expand Down Expand Up @@ -65,17 +70,14 @@ const Inventory = () => {
}

const balance = balances[key];
(async function () {
const contracts = await protocolContracts;
if (Number(balance) && contracts) {
let selectedContract = contracts[id as keyof ProtocolContracts] as BaseContract;
if (!selectedContract && namedContracts) {
selectedContract = namedContracts[key as keyof typeof namedContracts];
}

return <Token token={name} balance={balance} accountAddr={walletAddress as string} tokenAddr={selectedContract.address} decimals={usdcFix()} />;
if (Number(balance) && contracts) {
let selectedContract = contracts[id as keyof ProtocolContracts] as BaseContract;
if (!selectedContract && namedContracts) {
selectedContract = namedContracts[key as keyof typeof namedContracts];
}
})();

return <Token token={name} balance={balance} accountAddr={walletAddress as string} tokenAddr={selectedContract.address} decimals={usdcFix()} />;
}
}
};

Expand Down
3 changes: 3 additions & 0 deletions packages/dapp/pages/styles/queries.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,7 @@
#Staking > tbody > tr > td:nth-child(4) {
display: none;
}
#Inventory {
bottom: 0;
}
}
2 changes: 1 addition & 1 deletion packages/dapp/pages/styles/ubiquity.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ video {
text-align: center;
position: absolute;
left: 0;
bottom: 0;
bottom: 32px;
width: 100%;
}
#Inventory > div:nth-child(2) > div > div > div {
Expand Down

0 comments on commit fd7f8a0

Please sign in to comment.