11 changed files with 364 additions and 150 deletions
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
import { |
||||
AlertDialog, |
||||
AlertDialogAction, |
||||
AlertDialogCancel, |
||||
AlertDialogContent, |
||||
AlertDialogDescription, |
||||
AlertDialogFooter, |
||||
AlertDialogHeader, |
||||
AlertDialogTitle, |
||||
AlertDialogTrigger |
||||
} from '@/components/ui/alert-dialog' |
||||
import { Button } from '@/components/ui/button' |
||||
import { useZap } from '@/providers/ZapProvider' |
||||
import { disconnect, launchModal } from '@getalby/bitcoin-connect-react' |
||||
import { useTranslation } from 'react-i18next' |
||||
import DefaultZapAmountInput from './DefaultZapAmountInput' |
||||
import DefaultZapCommentInput from './DefaultZapCommentInput' |
||||
import QuickZapSwitch from './QuickZapSwitch' |
||||
import IncludePublicZapReceiptSwitch from './IncludePublicZapReceiptSwitch' |
||||
|
||||
export default function WalletZapSendingSettings() { |
||||
const { t } = useTranslation() |
||||
const { isWalletConnected, walletInfo } = useZap() |
||||
|
||||
if (isWalletConnected) { |
||||
return ( |
||||
<> |
||||
<div> |
||||
{walletInfo?.node.alias && ( |
||||
<div className="mb-2"> |
||||
{t('Connected to')} <strong>{walletInfo.node.alias}</strong> |
||||
</div> |
||||
)} |
||||
<AlertDialog> |
||||
<AlertDialogTrigger asChild> |
||||
<Button variant="destructive">{t('Disconnect Wallet')}</Button> |
||||
</AlertDialogTrigger> |
||||
<AlertDialogContent> |
||||
<AlertDialogHeader> |
||||
<AlertDialogTitle>{t('Are you absolutely sure?')}</AlertDialogTitle> |
||||
<AlertDialogDescription> |
||||
{t('You will not be able to send zaps to others.')} |
||||
</AlertDialogDescription> |
||||
</AlertDialogHeader> |
||||
<AlertDialogFooter> |
||||
<AlertDialogCancel>{t('Cancel')}</AlertDialogCancel> |
||||
<AlertDialogAction variant="destructive" onClick={() => disconnect()}> |
||||
{t('Disconnect')} |
||||
</AlertDialogAction> |
||||
</AlertDialogFooter> |
||||
</AlertDialogContent> |
||||
</AlertDialog> |
||||
</div> |
||||
<DefaultZapAmountInput /> |
||||
<DefaultZapCommentInput /> |
||||
<QuickZapSwitch /> |
||||
<IncludePublicZapReceiptSwitch /> |
||||
</> |
||||
) |
||||
} |
||||
|
||||
return ( |
||||
<div> |
||||
<Button |
||||
className="bg-foreground hover:bg-foreground/90" |
||||
onClick={() => { |
||||
launchModal() |
||||
}} |
||||
> |
||||
{t('Connect Wallet')} |
||||
</Button> |
||||
</div> |
||||
) |
||||
} |
||||
Loading…
Reference in new issue