import Layout from '@/components/layout' import { useQuery } from '@apollo/client' import UserHeader from '@/components/user-header' import Button from 'react-bootstrap/Button' import styles from '@/styles/user.module.css' import { useState } from 'react' import ItemFull from '@/components/item-full' import { Form, MarkdownInput } from '@/components/form' import { useMe } from '@/components/me' import { USER_FULL } from '@/fragments/users' import { getGetServerSideProps } from '@/api/ssrApollo' import { FeeButtonProvider } from '@/components/fee-button' import { bioSchema } from '@/lib/validate' import { useRouter } from 'next/router' import PageLoading from '@/components/page-loading' import { ItemButtonBar } from '@/components/post' import useItemSubmit from '@/components/use-item-submit' import { UPSERT_BIO } from '@/fragments/paidAction' export const getServerSideProps = getGetServerSideProps({ query: USER_FULL, notFound: data => !data.user }) export function BioForm ({ handleDone, bio, me }) { const onSubmit = useItemSubmit(UPSERT_BIO, { navigateOnSubmit: false, paidMutationOptions: { update (cache, { data: { upsertBio: { result, invoice } } }) { if (!result) return cache.modify({ id: `User:${me.id}`, fields: { bio () { return result.text } } }) } }, onSuccessfulSubmit: (data, { resetForm }) => { handleDone?.() } }) return (