import { Accordion, AccordionButton, AccordionButtonProps, AccordionItem, AccordionPanel, Box, InputGroup, InputRightElement, Link, VStack, } from '@chakra-ui/react' import { Trans, useTranslation } from 'react-i18next' import { BsFillCheckCircleFill, BsFillXCircleFill } from 'react-icons/bs' import { BoltIcon } from '@/components/icons' import { TextInputBox } from '@/components/ui' import Loader from '@/components/ui/Loader' import { RenderSponsorFromTable } from '@/modules/project/forms/components/RenderSponsorFromTable.tsx' import { WalletConnectionOptionInfoBox, WalletConnectionOptionInfoBoxProps, } from '@/modules/project/pages/projectCreation/components/WalletConnectionOptionInfoBox' import { WalletLimitComponent } from '@/modules/project/pages/projectDashboard/components/WalletLimitComponent' import { Body } from '@/shared/components/typography' import { GeyserLightningWalletGuideLink, LIGHTNING_FEE_PERCENTAGE } from '@/shared/constants' import { lightModeColors } from '@/shared/styles' import { LightingWalletForm, Limits, LNAddressEvaluationState } from '@/shared/types/wallet' type Props = { readOnly?: boolean lightningAddress: LightingWalletForm limits: Limits showPromoText?: boolean removeSponsors?: boolean } export const LightningAddressInputField = ({ lightningAddress, readOnly, showPromoText, removeSponsors, limits, ...rest }: { lightningAddress: LightingWalletForm readOnly?: boolean showPromoText?: boolean removeSponsors?: boolean limits: Limits } & Omit) => { const { t } = useTranslation() const renderRightElementContent = () => { if (lightningAddress.evaluating || lightningAddress.state === LNAddressEvaluationState.LOADING) { return } switch (lightningAddress.state) { case LNAddressEvaluationState.FAILED: return case LNAddressEvaluationState.SUCCEEDED: return default: return null } } return ( lightningAddress.setValue(event.target.value)} onBlur={lightningAddress.validate} isInvalid={Boolean(lightningAddress.error)} focusBorderColor="neutral.200" _valid={{ focusBorderColor: 'primary.500' }} error={lightningAddress.error} isDisabled={readOnly} /> {renderRightElementContent()} {lightningAddress.value && lightningAddress.state === LNAddressEvaluationState.SUCCEEDED ? ( ) : null} } promoText={showPromoText ? t(`${LIGHTNING_FEE_PERCENTAGE}% Geyser fee per transaction`) : undefined} secondaryText={ Lightning Addresses { ' are like an email address, but for your Bitcoin. You will receive all on-chain and lightning transactions directly to your lightning wallet. Get your own by looking at our featured and other ' } recommended wallets. } {...rest} > {removeSponsors ? null : ( {t('Featured Wallets')} )} ) } export const WalletConnectionForm = ({ readOnly, lightningAddress, limits, showPromoText = true, removeSponsors, }: Props) => { const { t } = useTranslation() return (

{t('Lightning Address')}

) } const accordionButtonStyles: AccordionButtonProps = { py: '10px', backgroundColor: 'utils.pbg', borderRadius: '8px', border: '1px solid', borderColor: 'neutral1.6', _hover: { borderColor: 'neutral1.8', backgroundColor: 'utils.pbg', }, _expanded: { borderBottomRightRadius: 0, borderBottomLeftRadius: 0, borderBottomWidth: '0px', _hover: { borderColor: 'neutral1.6', }, }, }