Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

chore: show topup/increase option ony if available #541

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions frontend/src/screens/wallet/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import { Label } from "src/components/ui/label";
import { LoadingButton } from "src/components/ui/loading-button";
import { useToast } from "src/components/ui/use-toast";
import { useBalances } from "src/hooks/useBalances";
import { useInfo } from "src/hooks/useInfo";
import { useCSRF } from "src/hooks/useCSRF";
import { useTransaction } from "src/hooks/useTransaction";
import { copyToClipboard } from "src/lib/clipboard";
import { CreateInvoiceRequest, Transaction } from "src/types";
import { request } from "src/utils/request";

export default function Receive() {
const { hasChannelManagement } = useInfo();
const { data: balances } = useBalances();
const { data: csrf } = useCSRF();
const { toast } = useToast();
Expand Down Expand Up @@ -238,11 +240,13 @@ export default function Receive() {
)}
</div>
</CardContent>
<CardFooter className="flex justify-end">
<Link to="/channels/incoming">
<Button variant="outline">Increase</Button>
</Link>
</CardFooter>
{hasChannelManagement && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I didn't think about this 😱

But we should hide the entire card, right? "Receiving capacity" makes no sense for LNClients without channel management

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, stupid me... :) 😱

<CardFooter className="flex justify-end">
<Link to="/channels/incoming">
<Button variant="outline">Increase</Button>
</Link>
</CardFooter>
)}
</Card>
</div>
</div>
Expand Down
14 changes: 9 additions & 5 deletions frontend/src/screens/wallet/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import { Label } from "src/components/ui/label";
import { LoadingButton } from "src/components/ui/loading-button";
import { useToast } from "src/components/ui/use-toast";
import { useBalances } from "src/hooks/useBalances";
import { useInfo } from "src/hooks/useInfo";
import { useCSRF } from "src/hooks/useCSRF";
import { copyToClipboard } from "src/lib/clipboard";
import { PayInvoiceResponse } from "src/types";
import { request } from "src/utils/request";

export default function Send() {
const { hasChannelManagement } = useInfo();
const { data: balances } = useBalances();
const { data: csrf } = useCSRF();
const { toast } = useToast();
Expand Down Expand Up @@ -222,11 +224,13 @@ export default function Send() {
</div>
)}
</CardContent>
<CardFooter className="flex justify-end">
<Link to="/channels/outgoing">
<Button variant="outline">Top Up</Button>
</Link>
</CardFooter>
{hasChannelManagement && (
<CardFooter className="flex justify-end">
<Link to="/channels/outgoing">
<Button variant="outline">Top Up</Button>
</Link>
</CardFooter>
)}
</Card>
</div>
</div>
Expand Down
26 changes: 15 additions & 11 deletions frontend/src/screens/wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { useBalances } from "src/hooks/useBalances";
import { useInfo } from "src/hooks/useInfo";

function Wallet() {
const { data: info } = useInfo();
const { data: info, hasChannelManagement } = useInfo();
const { data: balances } = useBalances();

if (!info || !balances) {
Expand Down Expand Up @@ -88,11 +88,13 @@ function Wallet() {
</div>
)}
</CardContent>
<CardFooter className="flex justify-end">
<Link to="/channels/outgoing">
<Button variant="outline">Top Up</Button>
</Link>
</CardFooter>
{hasChannelManagement && (
<CardFooter className="flex justify-end">
<Link to="/channels/outgoing">
<Button variant="outline">Top Up</Button>
</Link>
</CardFooter>
)}
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
Expand Down Expand Up @@ -120,11 +122,13 @@ function Wallet() {
)}
</div>
</CardContent>
<CardFooter className="flex justify-end">
<Link to="/channels/incoming">
<Button variant="outline">Increase</Button>
</Link>
</CardFooter>
{hasChannelManagement && (
Copy link
Collaborator

@rolznz rolznz Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one still needs to be updated to hide the whole card

<CardFooter className="flex justify-end">
<Link to="/channels/incoming">
<Button variant="outline">Increase</Button>
</Link>
</CardFooter>
)}
</Card>
</div>

Expand Down
Loading