import { CheckCircle2Icon, CircleXIcon, EditIcon, InfoIcon, Link2Icon, User2Icon, ZapIcon, } from "lucide-react"; import { FormEvent, useState } from "react"; import { Link } from "react-router"; import BudgetAmountSelect from "src/components/BudgetAmountSelect"; import BudgetRenewalSelect from "src/components/BudgetRenewalSelect"; import Loading from "src/components/Loading"; import UserAvatar from "src/components/UserAvatar"; import { AppCardConnectionInfo } from "src/components/connections/AppCardConnectionInfo"; import { AppCardNotice } from "src/components/connections/AppCardNotice"; import { Button } from "src/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "src/components/ui/card"; import { LoadingButton } from "src/components/ui/custom/loading-button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTrigger, } from "src/components/ui/dialog"; import { Separator } from "src/components/ui/separator"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "src/components/ui/tooltip"; import { useAlbyMe } from "src/hooks/useAlbyMe"; import { LinkStatus, useLinkAccount } from "src/hooks/useLinkAccount"; import { BudgetRenewalType } from "src/types"; import AlbyAccountDarkSVG from "public/images/illustrations/alby-account-dark.svg"; import AlbyAccountLightSVG from "public/images/illustrations/alby-account-light.svg"; import { LinkButton } from "src/components/ui/custom/link-button"; import { ALBY_ACCOUNT_APP_NAME } from "src/constants"; import { useApps } from "src/hooks/useApps"; function AlbyConnectionCard() { const { data: linkedAlbyAccountAppsData, mutate: reloadAlbyAccountApp } = useApps(undefined, undefined, { name: ALBY_ACCOUNT_APP_NAME, }); const albyAccountApp = linkedAlbyAccountAppsData?.apps[0]; const { data: albyMe } = useAlbyMe(); const { loading, linkStatus, loadingLinkStatus, linkAccount } = useLinkAccount(reloadAlbyAccountApp); const [maxAmountSat, setMaxAmountSat] = useState(250_000); const [budgetRenewal, setBudgetRenewal] = useState("weekly"); function onSubmit(e: FormEvent) { e.preventDefault(); linkAccount(maxAmountSat, budgetRenewal); } return ( Linked Alby Account {albyAccountApp && } Link Your Alby Account to use your lightning address with Alby Hub and use apps that you connected to your Alby Account.
{albyMe?.name || albyMe?.email}
{albyMe?.lightning_address}
{loadingLinkStatus && } {!albyAccountApp || linkStatus === LinkStatus.SharedNode || linkStatus === LinkStatus.Unlinked ? ( {!loading && } Link your Alby Account
Link to Alby Account After you link your account, your lightning address and every app you access through your Alby Account will handle payments via the Hub. You can add a budget that will restrict how much can be spent from the Hub with your Alby Account.
Link to Alby Account
) : linkStatus === LinkStatus.ThisNode ? ( ) : ( linkStatus === LinkStatus.OtherNode && ( ) )} Alby Account Settings
{albyAccountApp && (
Left in Alby Account budget
Control what access your Alby Account has to your Hub by editing the budget. Every app you access through your Alby Account (such as your lightning address, Alby Extension, podcasting 2.0 apps) will handle payments via your Hub.
} />
)}
); } export default AlbyConnectionCard;