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

Commit

Permalink
fix: add info for apps without budgets (#524)
Browse files Browse the repository at this point in the history
Co-authored-by: Roland Bewick <[email protected]>
  • Loading branch information
reneaaron and rolznz authored Jun 28, 2024
1 parent b54ed57 commit 3206b62
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion frontend/src/components/connections/AppCardConnectionInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import dayjs from "dayjs";
import { PlusCircle } from "lucide-react";
import { Button } from "src/components/ui/button";
import { Progress } from "src/components/ui/progress";
import { formatAmount } from "src/lib/utils";
import { App } from "src/types";
Expand All @@ -12,7 +14,7 @@ export function AppCardConnectionInfo({
}: AppCardConnectionInfoProps) {
return (
<>
{connection.maxAmount > 0 && (
{connection.maxAmount > 0 ? (
<>
<div className="flex flex-row justify-between">
<div className="mb-2">
Expand Down Expand Up @@ -53,6 +55,41 @@ export function AppCardConnectionInfo({
</div>
)}
</>
) : connection.requestMethods.indexOf("pay_invoice") > -1 ? (
<>
<div className="flex flex-row justify-between">
<div className="mb-2">
<p className="text-xs text-secondary-foreground font-medium">
You've spent
</p>
<p className="text-xl font-medium">
{new Intl.NumberFormat().format(connection.budgetUsage)} sats
</p>
</div>
</div>
<div className="flex flex-row justify-end items-center">
<Button variant="outline">
<PlusCircle className="w-4 h-4 mr-2" />
Set Budget
</Button>
</div>
</>
) : (
<>
<div className="flex flex-row justify-between h-full">
<div className="mb-2">
<p className="text-xs text-secondary-foreground font-medium">
Read only
</p>
</div>
</div>
<div className="flex flex-1 flex-row justify-end items-center">
<Button variant="outline">
<PlusCircle className="w-4 h-4 mr-2" />
Enable Payments
</Button>
</div>
</>
)}
</>
);
Expand Down

0 comments on commit 3206b62

Please sign in to comment.