import { AlertTriangleIcon, ArrowDownIcon, ArrowUpIcon } from "lucide-react"; import { Link } from "react-router"; import { FormattedBitcoinAmount } from "src/components/FormattedBitcoinAmount"; import FormattedFiatAmount from "src/components/FormattedFiatAmount"; import LowReceivingCapacityAlert from "src/components/LowReceivingCapacityAlert"; import TransactionsList from "src/components/TransactionsList"; import { Alert, AlertDescription, AlertTitle, } from "src/components/ui/alert.tsx"; import { LinkButton } from "src/components/ui/custom/link-button"; import { BalanceSwitcher } from "src/components/wallet/BalanceSwitcher"; import { useBalances } from "src/hooks/useBalances"; import { useChannels } from "src/hooks/useChannels"; import { useInfo } from "src/hooks/useInfo"; export default function Lightning() { const { data: info, hasChannelManagement } = useInfo(); const { data: balances } = useBalances(true); const { data: channels } = useChannels(); if (!balances) { return null; } const hasChannelsOpen = !!channels?.length; const allChannelsBelowReserve = hasChannelsOpen && channels?.every( (channel) => channel.localBalanceMsat < channel.unspendablePunishmentReserveSat * 1000 ); const lowReceivingCapacity = hasChannelsOpen && balances.lightning.totalReceivableMsat < balances.lightning.totalSpendableMsat * 0.1; const showOpenFirstChannel = hasChannelManagement && channels && !hasChannelsOpen && !(info?.jitChannelsEnabled && info?.jitChannelsLiquiditySource); return ( <> {hasChannelManagement && allChannelsBelowReserve && ( Channel Reserves Unmet You won't be able to make payments until you fill your channel reserve.{" "} View channel reserves )} {hasChannelManagement && lowReceivingCapacity && ( )} {showOpenFirstChannel && ( Open Your First Channel You won't be able to receive or send payments until you{" "} open your first channel . )}
{hasChannelManagement && }
Receive Send
); }