Skip to content

Commit

Permalink
chore: add alerts to wallet screen
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 19, 2024
1 parent 42159f2 commit f1fb388
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/src/screens/wallet/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default function Receive() {
description="Create a lightning invoice that can be paid by any bitcoin lightning wallet"
/>
{hasChannelManagement &&
parseInt(amount || "0") * 1000 >
parseInt(amount || "0") * 1000 >=
0.8 * balances.lightning.totalReceivable && (
<Alert>
<AlertTriangle className="h-4 w-4" />
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/screens/wallet/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ export default function Send() {
title="Send"
description="Pay a lightning invoice created by any bitcoin lightning wallet"
/>
{invoiceDetails &&
hasChannelManagement &&
invoiceDetails.satoshi * 1000 >
{hasChannelManagement &&
(invoiceDetails?.satoshi || 0) * 1000 >=
0.8 * balances.lightning.totalSpendable && (
<Alert>
<AlertTriangle className="h-4 w-4" />
Expand Down
36 changes: 35 additions & 1 deletion frontend/src/screens/wallet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { ArrowDownIcon, ArrowUpIcon, CreditCard } from "lucide-react";
import {
AlertTriangle,
ArrowDownIcon,
ArrowUpIcon,
CreditCard,
} from "lucide-react";
import { Link } from "react-router-dom";
import AppHeader from "src/components/AppHeader";
import BreezRedeem from "src/components/BreezRedeem";
import ExternalLink from "src/components/ExternalLink";
import Loading from "src/components/Loading";
import TransactionsList from "src/components/TransactionsList";
import {
Alert,
AlertDescription,
AlertTitle,
} from "src/components/ui/alert.tsx";
import { Button } from "src/components/ui/button";
import { useBalances } from "src/hooks/useBalances";
import { useInfo } from "src/hooks/useInfo";
Expand All @@ -20,6 +30,30 @@ function Wallet() {
return (
<>
<AppHeader title="Wallet" description="" />
{!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>
)}
{!balances.lightning.totalReceivable && (
<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>
)}
<BreezRedeem />
<div className="flex flex-col lg:flex-row justify-between lg:items-center gap-5">
<div className="text-5xl font-semibold balance sensitive ph-no-capture">
Expand Down

0 comments on commit f1fb388

Please sign in to comment.