LSPTermsDialog.tsx raw
1 import { InfoIcon } from "lucide-react";
2 import ExternalLink from "src/components/ExternalLink";
3 import {
4 AlertDialog,
5 AlertDialogCancel,
6 AlertDialogContent,
7 AlertDialogDescription,
8 AlertDialogFooter,
9 AlertDialogHeader,
10 AlertDialogTitle,
11 AlertDialogTrigger,
12 } from "src/components/ui/alert-dialog";
13
14 type LSPTermsDialogProps = {
15 name: string;
16 description: string;
17 contactUrl: string;
18 terms: string | undefined;
19 trigger: React.ReactNode;
20 maximumChannelExpiryBlocks?: number;
21 };
22 export function LSPTermsDialog({
23 name,
24 description,
25 contactUrl,
26 terms,
27 trigger,
28 maximumChannelExpiryBlocks = 12960 /* 3 months */,
29 }: LSPTermsDialogProps) {
30 const months = Math.round((10 * maximumChannelExpiryBlocks) / (60 * 24 * 30));
31
32 return (
33 <AlertDialog>
34 <AlertDialogTrigger asChild>
35 <div className="cursor-pointer inline">{trigger}</div>
36 </AlertDialogTrigger>
37 <AlertDialogContent>
38 <AlertDialogHeader>
39 <AlertDialogTitle>Channel Terms - {name}</AlertDialogTitle>
40 <AlertDialogDescription>
41 <div className="grid gap-4">
42 <p>{description}</p>
43 <p>
44 Learn more about{" "}
45 <ExternalLink to={contactUrl} className="underline">
46 {name}
47 </ExternalLink>
48 </p>
49
50 <div className="flex items-center gap-2">
51 Duration: at least {months} months
52 <ExternalLink to="https://guides.getalby.com/user-guide/alby-hub/faq/how-to-open-a-payment-channel">
53 <InfoIcon className="size-4 text-muted-foreground" />
54 </ExternalLink>
55 </div>
56 {terms && <p>{terms}</p>}
57
58 <p>
59 The duration for which a Lightning Channel remains open is not
60 determined or guaranteed by Alby; we will make reasonable
61 efforts to share information provided by the relevant LSP, but
62 actual availability depends on the Lightning Network and the
63 LSP's operations. Channels may be closed at any time, including
64 by force closure initiated by the network or counterparties.
65 </p>
66
67 <p>The purchase of a payment channel is non-refundable.</p>
68
69 <p>
70 To learn more about opening channels, see{" "}
71 <ExternalLink
72 className="underline"
73 to="https://guides.getalby.com/user-guide/alby-hub/faq/how-to-open-a-payment-channel"
74 >
75 How to open a payment channel?
76 </ExternalLink>
77 </p>
78 </div>
79 </AlertDialogDescription>
80 </AlertDialogHeader>
81 <AlertDialogFooter>
82 <AlertDialogCancel>Close</AlertDialogCancel>
83 </AlertDialogFooter>
84 </AlertDialogContent>
85 </AlertDialog>
86 );
87 }
88