wallet history link on wallet pages

This commit is contained in:
keyan 2021-12-16 14:17:50 -06:00
parent bbc34edf51
commit 54c1c8c41b
3 changed files with 17 additions and 3 deletions

View File

@ -56,7 +56,7 @@ export default {
throw new AuthenticationError('you must be logged in') throw new AuthenticationError('you must be logged in')
} }
const include = new Set(inc.split(',')) const include = new Set(inc?.split(','))
const queries = [] const queries = []
if (include.has('invoice')) { if (include.has('invoice')) {

View File

@ -112,7 +112,7 @@ export default function Satistics ({ data: { walletHistory: { facts, cursor } }
const { data, fetchMore } = useQuery(WALLET_HISTORY, { variables: { inc: router.query.inc } }) const { data, fetchMore } = useQuery(WALLET_HISTORY, { variables: { inc: router.query.inc } })
function filterRoutePush (filter, add) { function filterRoutePush (filter, add) {
const inc = new Set(router.query.inc.split(',')) const inc = new Set(router.query.inc?.split(','))
inc.delete('') inc.delete('')
// depending on addrem, add or remove filter // depending on addrem, add or remove filter
if (add) { if (add) {
@ -126,7 +126,7 @@ export default function Satistics ({ data: { walletHistory: { facts, cursor } }
} }
function included (filter) { function included (filter) {
const inc = new Set(router.query.inc.split(',')) const inc = new Set(router.query.inc?.split(','))
return inc.has(filter) return inc.has(filter)
} }

View File

@ -31,8 +31,19 @@ function YouHaveSats () {
) )
} }
function WalletHistory () {
return (
<div className='pt-4'>
<Link href='/satistics?inc=invoice,withdrawal' passHref>
<a className='text-muted font-weight-bold text-underline'>wallet history</a>
</Link>
</div>
)
}
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'>
@ -44,6 +55,7 @@ export function WalletForm () {
<Link href='/wallet?type=withdraw'> <Link href='/wallet?type=withdraw'>
<Button variant='success'>withdraw</Button> <Button variant='success'>withdraw</Button>
</Link> </Link>
<WalletHistory />
</div> </div>
) )
} }
@ -112,6 +124,7 @@ export function FundForm () {
/> />
<SubmitButton variant='success' className='mt-2'>generate invoice</SubmitButton> <SubmitButton variant='success' className='mt-2'>generate invoice</SubmitButton>
</Form> </Form>
<WalletHistory />
</> </>
) )
} }
@ -180,6 +193,7 @@ export function WithdrawlForm () {
<Link href='/wallet?type=lnurl-withdraw'> <Link href='/wallet?type=lnurl-withdraw'>
<Button variant='grey'>QR code</Button> <Button variant='grey'>QR code</Button>
</Link> </Link>
<WalletHistory />
</> </>
) )
} }