import AccordianItem from './accordian-item' import * as Yup from 'yup' import { Input } from './form' import { InputGroup } from 'react-bootstrap' import { BOOST_MIN } from '../lib/constants' import { NAME_QUERY } from '../fragments/users' export function AdvPostSchema (client) { return { boost: Yup.number().typeError('must be a number') .min(BOOST_MIN, `must be blank or at least ${BOOST_MIN}`).integer('must be whole'), forward: Yup.string() .test({ name: 'name', test: async name => { if (!name || !name.length) return true const { data } = await client.query({ query: NAME_QUERY, variables: { name }, fetchPolicy: 'network-only' }) return !data.nameAvailable }, message: 'user does not exist' }) } } export const AdvPostInitial = { boost: '', forward: '' } export default function AdvPostForm () { return ( options} body={ <> boost} name='boost' hint={ranks posts higher temporarily based on the amount} append={sats} /> forward sats to} name='forward' hint={100% of sats will be sent to this user} prepend=@ showValid /> } /> ) }