Skip to content

Commit

Permalink
Show message for unconnected wallet in Portfolio (#1495)
Browse files Browse the repository at this point in the history
* Show message for unconnected wallet in Portfolio

* remove unused variable
  • Loading branch information
DannyDelott authored Sep 12, 2024
1 parent 5e8b2b5 commit a9261f7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ import { usePortfolioLongsData } from "src/ui/portfolio/usePortfolioLongsData";
import { useAccount } from "wagmi";

export function OpenLongsContainer(): ReactElement {
const { address: account } = useAccount();
const { openLongPositions, openLongPositionsStatus } =
usePortfolioLongsData();
if (!account) {
return (
<div className="my-28 flex w-[1036px] flex-col gap-10">
<NonIdealState
heading="No wallet connected"
action={<ConnectWalletButton />}
/>
</div>
);
}

if (openLongPositionsStatus === "loading") {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ function YouReceiveStat({
lpSharesBalanceOf,
lpSharesOut,
lpSharesTotalSupply,
hyperdrive,
baseToken,
});
return (
Expand Down Expand Up @@ -534,13 +533,11 @@ function calculatePoolShare({
lpSharesBalanceOf,
lpSharesOut,
lpSharesTotalSupply,
hyperdrive,
baseToken,
}: {
lpSharesBalanceOf: bigint | undefined;
lpSharesOut: bigint | undefined;
lpSharesTotalSupply: bigint | undefined;
hyperdrive: HyperdriveConfig;
baseToken: TokenConfig;
}) {
if (!lpSharesOut || !lpSharesTotalSupply || lpSharesBalanceOf === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ import { WithdrawalQueueCell } from "./WithdrawalQueueCell";

export function LpAndWithdrawalSharesContainer(): ReactElement {
const { openLpPositions, openLpPositionStatus } = usePortfolioLpData();
const { address: account } = useAccount();
if (!account) {
return (
<div className="my-28 flex w-[1036px] flex-col gap-10">
<NonIdealState
heading="No wallet connected"
action={<ConnectWalletButton />}
/>
</div>
);
}

if (openLpPositionStatus === "loading") {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ import { useAccount } from "wagmi";
export function OpenShortsContainer(): ReactElement {
const { openShortPositions, openShortPositionsStatus } =
usePortfolioShortsData();
const { address: account } = useAccount();
if (!account) {
return (
<div className="my-28 flex w-[1036px] flex-col gap-10">
<NonIdealState
heading="No wallet connected"
action={<ConnectWalletButton />}
/>
</div>
);
}

if (openShortPositionsStatus === "loading") {
return (
Expand Down

0 comments on commit a9261f7

Please sign in to comment.