import { TriangleAlertIcon } from "lucide-react"; import ExternalLink from "src/components/ExternalLink"; import { Alert, AlertDescription, AlertTitle } from "src/components/ui/alert"; import { useChannels } from "src/hooks/useChannels"; type PeerAlertProps = { pubkey?: string; name?: string; }; export function DuplicateChannelAlert({ pubkey, name }: PeerAlertProps) { const { data: channels } = useChannels(); if (!pubkey) { return null; } const matchedPeer = channels?.find((p) => p.remotePubkey === pubkey); if (!matchedPeer) { return null; } return ( You already have a channel with{" "} {name && name !== "Custom" ? ( {name} ) : ( "the selected peer" )} There are other options available rather than opening multiple channels with the same counterparty.{" "} Learn more ); }