import { useQuery } from '@apollo/client'
import LayoutCenter from '../../components/layout-center'
import { CopyInput, Input, InputSkeleton } from '../../components/form'
import InputGroup from 'react-bootstrap/InputGroup'
import InvoiceStatus from '../../components/invoice-status'
import { useRouter } from 'next/router'
import { WITHDRAWL } from '../../fragments/wallet'
import Link from 'next/link'
export default function Withdrawl () {
return (
)
}
export function WithdrawlSkeleton ({ status }) {
return (
<>
>
)
}
function LoadWithdrawl () {
const router = useRouter()
const { loading, error, data } = useQuery(WITHDRAWL, {
variables: { id: router.query.id },
pollInterval: 1000
})
if (error) return error
if (!data || loading) {
return
}
const TryMaxFee = () =>
try increasing max fee
let status = 'pending'
let variant = 'default'
switch (data.withdrawl.status) {
case 'CONFIRMED':
status = `sent ${data.withdrawl.satsPaid} sats with ${data.withdrawl.satsFeePaid} sats in routing fees`
variant = 'confirmed'
break
case 'INSUFFICIENT_BALANCE':
status = <>insufficient balance contact keyan!>
variant = 'failed'
break
case 'INVALID_PAYMENT':
status = 'invalid invoice'
variant = 'failed'
break
case 'PATHFINDING_TIMEOUT':
status = <>timed out finding route >
variant = 'failed'
break
case 'ROUTE_NOT_FOUND':
status = <>no route >
variant = 'failed'
break
case 'UNKNOWN_FAILURE':
status = <>unknown error>
variant = 'failed'
break
default:
break
}
return (
<>
sats}
/>
>
)
}