add alert for lightning address
This commit is contained in:
parent
e288f88ec7
commit
d3c3657a92
@ -9,8 +9,9 @@ import LayoutCenter from '../components/layout-center'
|
|||||||
import InputGroup from 'react-bootstrap/InputGroup'
|
import InputGroup from 'react-bootstrap/InputGroup'
|
||||||
import { WithdrawlSkeleton } from './withdrawals/[id]'
|
import { WithdrawlSkeleton } from './withdrawals/[id]'
|
||||||
import { useMe } from '../components/me'
|
import { useMe } from '../components/me'
|
||||||
import { useEffect } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { requestProvider } from 'webln'
|
import { requestProvider } from 'webln'
|
||||||
|
import { Alert } from 'react-bootstrap'
|
||||||
|
|
||||||
export async function getServerSideProps () {
|
export async function getServerSideProps () {
|
||||||
return {
|
return {
|
||||||
@ -37,7 +38,6 @@ function YouHaveSats () {
|
|||||||
|
|
||||||
export function WalletForm () {
|
export function WalletForm () {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
if (!router.query.type) {
|
if (!router.query.type) {
|
||||||
return (
|
return (
|
||||||
<div className='align-items-center text-center'>
|
<div className='align-items-center text-center'>
|
||||||
@ -66,6 +66,8 @@ export const FundSchema = Yup.object({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export function FundForm () {
|
export function FundForm () {
|
||||||
|
const me = useMe()
|
||||||
|
const [showAlert, setShowAlert] = useState(true)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [createInvoice, { called, error }] = useMutation(gql`
|
const [createInvoice, { called, error }] = useMutation(gql`
|
||||||
mutation createInvoice($amount: Int!) {
|
mutation createInvoice($amount: Int!) {
|
||||||
@ -74,6 +76,10 @@ export function FundForm () {
|
|||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setShowAlert(true || !localStorage.getItem('hideLnAddrAlert'))
|
||||||
|
}, [])
|
||||||
|
|
||||||
if (called && !error) {
|
if (called && !error) {
|
||||||
return <LnQRSkeleton status='generating' />
|
return <LnQRSkeleton status='generating' />
|
||||||
}
|
}
|
||||||
@ -81,6 +87,15 @@ export function FundForm () {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<YouHaveSats />
|
<YouHaveSats />
|
||||||
|
{me && showAlert &&
|
||||||
|
<Alert
|
||||||
|
variant='success' dismissible onClose={() => {
|
||||||
|
localStorage.setItem('hideLnAddrAlert', 'yep')
|
||||||
|
setShowAlert(false)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Your can also fund your account via lightning address with <strong>{`${me.name}@stacker.news`}</strong>
|
||||||
|
</Alert>}
|
||||||
<Form
|
<Form
|
||||||
initial={{
|
initial={{
|
||||||
amount: 1000
|
amount: 1000
|
||||||
|
@ -118,6 +118,11 @@ footer {
|
|||||||
|
|
||||||
.alert-dismissible .close {
|
.alert-dismissible .close {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
|
font-family: 'lightning';
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-dismissible .close::after {
|
||||||
|
content: 'X';
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user