Skip to content

Commit

Permalink
feat: show channel reserves alert on wallet page (#582)
Browse files Browse the repository at this point in the history
* feat: show channel reserves alert on wallet page

* chore: only show low receiving capacity alert if migrate card not visible

* feat: different alert on wallet page if user has no channels
  • Loading branch information
rolznz authored Sep 3, 2024
1 parent 8ff9085 commit 274f937
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions frontend/src/screens/wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,50 @@ function Wallet() {
</div>
</div>
)}
{hasChannelManagement && !balances.lightning.totalSpendable && (
<Alert>
<AlertTriangle className="h-4 w-4" />
<AlertTitle>Low spending balance</AlertTitle>
<AlertDescription>
You won't be able to make payments until you{" "}
<Link className="underline" to="/channels/outgoing">
increase your spending balance.
</Link>
</AlertDescription>
</Alert>
)}
{hasChannelManagement && !balances.lightning.totalReceivable && (
{hasChannelManagement &&
!!channels?.length &&
channels?.every(
(channel) =>
channel.localBalance < channel.unspendablePunishmentReserve
) &&
!showMigrateCard && (
<Alert>
<AlertTriangle className="h-4 w-4" />
<AlertTitle>Channel Reserves Unmet</AlertTitle>
<AlertDescription>
You won't be able to make payments until you fill your channel
reserve.{" "}
<Link to="/channels" className="underline">
View channel reserves
</Link>
</AlertDescription>
</Alert>
)}
{hasChannelManagement &&
!!channels?.length &&
!balances.lightning.totalReceivable &&
!showMigrateCard && (
<Alert>
<AlertTriangle className="h-4 w-4" />
<AlertTitle>Low receiving capacity</AlertTitle>
<AlertDescription>
You won't be able to receive payments until you{" "}
<Link className="underline" to="/channels/incoming">
increase your receiving capacity.
</Link>
</AlertDescription>
</Alert>
)}
{hasChannelManagement && !channels?.length && !showMigrateCard && (
<Alert>
<AlertTriangle className="h-4 w-4" />
<AlertTitle>Low receiving capacity</AlertTitle>
<AlertTitle>Open Your First Channel</AlertTitle>
<AlertDescription>
You won't be able to receive payments until you{" "}
<Link className="underline" to="/channels/incoming">
increase your receiving capacity.
You won't be able to receive or send payments until you{" "}
<Link className="underline" to="/channels/first">
open your first channel
</Link>
.
</AlertDescription>
</Alert>
)}
Expand Down

0 comments on commit 274f937

Please sign in to comment.