* Wallet flow * Prepopulate fields of complementary protocol * Remove TODO about one mutation for save We need to save protocols in separate mutations so we can use the wallet id returned by the first protocol save for the following protocol saves and save them all to the same wallet. * Fix badges not updated on wallet delete * Fix useProtocol call * Fix lightning address save via prompt * Don't pass share as attribute to DOM * Fix useCallback dependency * Progress numbers as SVGs * Fix progress line margins * Remove unused saveWallet arguments * Update cache with settings response * Fix line does not connect with number 1 * Don't reuse page nav arrows in form nav * Fix missing SVG hover style * Fix missing space in wallet save log message * Reuse CSS from nav.module.css * align buttons and their icons/text * center form progress line * increase top padding of form on smaller screens * provide margin above button bar on settings form --------- Co-authored-by: k00b <k00b@stacker.news>
34 lines
1.4 KiB
JavaScript
34 lines
1.4 KiB
JavaScript
import { getGetServerSideProps } from '@/api/ssrApollo'
|
|
import { useData } from '@/components/use-data'
|
|
import { WalletMultiStepForm } from '@/wallets/client/components'
|
|
import { WALLET } from '@/wallets/client/fragments'
|
|
import { useDecryptedWallet } from '@/wallets/client/hooks'
|
|
import { unurlify } from '@/wallets/lib/util'
|
|
import { useQuery } from '@apollo/client'
|
|
import { useRouter } from 'next/router'
|
|
|
|
const variablesFunc = params => {
|
|
const id = Number(params.type)
|
|
return !Number.isNaN(id) ? { id } : { name: unurlify(params.type) }
|
|
}
|
|
export const getServerSideProps = getGetServerSideProps({ query: WALLET, variables: variablesFunc, authRequired: true })
|
|
|
|
export default function Wallet ({ ssrData }) {
|
|
const router = useRouter()
|
|
const variables = variablesFunc(router.query)
|
|
// this will print the following warning in the console:
|
|
// Warning: fragment with name WalletTemplateFields already exists.
|
|
// graphql-tag enforces all fragment names across your application to be unique
|
|
// this is not a problem because the warning is only meant to avoid overwriting fragments but we're reusing it
|
|
const { data } = useQuery(WALLET, { variables })
|
|
const dat = useData(data, ssrData)
|
|
|
|
const decryptedWallet = useDecryptedWallet(dat?.wallet)
|
|
const wallet = decryptedWallet ?? ssrData?.wallet
|
|
if (!wallet) {
|
|
return null
|
|
}
|
|
|
|
return <WalletMultiStepForm wallet={wallet} />
|
|
}
|