Skip to content

Commit 0325ad5

Browse files
authored
feat: improve Alby Account connection card (#899)
- improve budget copy - add tooltip that explains budget - update alby account settings link when account is linked
1 parent 41bc428 commit 0325ad5

File tree

2 files changed

+54
-11
lines changed

2 files changed

+54
-11
lines changed

frontend/src/components/connections/AlbyConnectionCard.tsx

+51-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import {
33
CircleX,
44
EditIcon,
55
ExternalLinkIcon,
6+
InfoIcon,
67
Link2Icon,
8+
User2Icon,
79
ZapIcon,
810
} from "lucide-react";
911
import { FormEvent, useState } from "react";
@@ -34,6 +36,12 @@ import {
3436
} from "src/components/ui/dialog";
3537
import { LoadingButton } from "src/components/ui/loading-button";
3638
import { Separator } from "src/components/ui/separator";
39+
import {
40+
Tooltip,
41+
TooltipContent,
42+
TooltipProvider,
43+
TooltipTrigger,
44+
} from "src/components/ui/tooltip";
3745
import { useAlbyMe } from "src/hooks/useAlbyMe";
3846
import { LinkStatus, useLinkAccount } from "src/hooks/useLinkAccount";
3947
import { App, BudgetRenewalType } from "src/types";
@@ -149,15 +157,25 @@ function AlbyConnectionCard({ connection }: { connection?: App }) {
149157
</Button>
150158
)
151159
)}
152-
<ExternalLink
153-
to="https://www.getalby.com/node"
154-
className="w-full sm:w-auto"
155-
>
156-
<Button variant="outline" className="w-full sm:w-auto">
157-
<ExternalLinkIcon className="w-4 h-4 mr-2" />
158-
Alby Account Settings
159-
</Button>
160-
</ExternalLink>
160+
{!connection && (
161+
<ExternalLink
162+
to="https://www.getalby.com/node"
163+
className="w-full sm:w-auto"
164+
>
165+
<Button variant="outline" className="w-full sm:w-auto">
166+
<ExternalLinkIcon className="w-4 h-4 mr-2" />
167+
Alby Account Settings
168+
</Button>
169+
</ExternalLink>
170+
)}
171+
{connection && (
172+
<Link to="/settings/alby-account" className="w-full sm:w-auto">
173+
<Button variant="outline" className="w-full sm:w-auto">
174+
<User2Icon className="w-4 h-4 mr-2" />
175+
Alby Account Settings
176+
</Button>
177+
</Link>
178+
)}
161179
</div>
162180
</div>
163181
{connection && (
@@ -168,7 +186,30 @@ function AlbyConnectionCard({ connection }: { connection?: App }) {
168186
>
169187
<EditIcon className="w-4 h-4 hidden group-hover:inline text-muted-foreground hover:text-card-foreground" />
170188
</Link>
171-
<AppCardConnectionInfo connection={connection} />
189+
<AppCardConnectionInfo
190+
connection={connection}
191+
budgetRemainingText={
192+
<span className="flex items-center gap-2 justify-end">
193+
Left in Alby Account budget
194+
<TooltipProvider>
195+
<Tooltip>
196+
<TooltipTrigger>
197+
<div className="flex flex-row items-center">
198+
<InfoIcon className="h-4 w-4 shrink-0 text-muted-foreground" />
199+
</div>
200+
</TooltipTrigger>
201+
<TooltipContent className="max-w-sm">
202+
Control what access your Alby Account has to your Hub
203+
by editing the budget. Every app you access through
204+
your Alby Account (such as your lightning address,
205+
Alby Extension, podcasting 2.0 apps) will handle
206+
payments via your Hub.
207+
</TooltipContent>
208+
</Tooltip>
209+
</TooltipProvider>
210+
</span>
211+
}
212+
/>
172213
</div>
173214
)}
174215
</div>

frontend/src/components/connections/AppCardConnectionInfo.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import { App, BudgetRenewalType } from "src/types";
88

99
type AppCardConnectionInfoProps = {
1010
connection: App;
11+
budgetRemainingText?: string | React.ReactNode;
1112
};
1213

1314
export function AppCardConnectionInfo({
1415
connection,
16+
budgetRemainingText = "Left in budget",
1517
}: AppCardConnectionInfoProps) {
1618
function getBudgetRenewalLabel(renewalType: BudgetRenewalType): string {
1719
switch (renewalType) {
@@ -63,7 +65,7 @@ export function AppCardConnectionInfo({
6365
<div className="flex flex-row justify-between">
6466
<div className="mb-2">
6567
<p className="text-xs text-secondary-foreground font-medium">
66-
Left in budget
68+
{budgetRemainingText}
6769
</p>
6870
<p className="text-xl font-medium">
6971
{new Intl.NumberFormat().format(

0 commit comments

Comments
 (0)