import { getGetServerSideProps } from '@/api/ssrApollo'
import { Form, ClientInput, ClientCheckbox, PasswordInput } from '@/components/form'
import { CenterLayout } from '@/components/layout'
import { WalletButtonBar } from '@/components/wallet-card'
import { lnbitsSchema } from '@/lib/validate'
import { WalletSecurityBanner } from '@/components/banners'
import { WalletLogs } from '@/components/wallet-logger'
import { useToast } from '@/components/toast'
import { useRouter } from 'next/router'
import { useWallet, Status } from '@/components/wallet'
export const getServerSideProps = getGetServerSideProps({ authRequired: true })
export default function WalletSettings () {
const toaster = useToast()
const router = useRouter()
const { wallet: name } = router.query
const wallet = useWallet(name)
const initial = wallet.fields.reduce((acc, field) => {
return {
...acc,
[field.name]: wallet.config?.[field.name] || ''
}
}, {
isDefault: wallet.isDefault || false
})
return (
{wallet.card.title}
use {wallet.card.title} for payments
)
}
function WalletFields ({ wallet: { config, fields } }) {
return fields.map(({ name, label, type }, i) => {
const props = {
initialValue: config?.[name],
label,
name,
required: true,
autoFocus: i === 0
}
if (type === 'text') {
return
}
if (type === 'password') {
return
}
return null
})
}