import Layout from '../../components/layout' import { gql, useMutation, 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, SubmitButton } from '../../components/form' import { useMe } from '../../components/me' import { USER_FULL } from '../../fragments/users' import { ITEM_FIELDS } from '../../fragments/items' import { getGetServerSideProps } from '../../api/ssrApollo' import FeeButton, { EditFeeButton } from '../../components/fee-button' import { bioSchema } from '../../lib/validate' import CancelButton from '../../components/cancel-button' import { useRouter } from 'next/router' import PageLoading from '../../components/page-loading' export const getServerSideProps = getGetServerSideProps(USER_FULL, null, data => !data.user) export function BioForm ({ handleDone, bio }) { const [upsertBio] = useMutation( gql` ${ITEM_FIELDS} mutation upsertBio($bio: String!) { upsertBio(bio: $bio) { id bio { ...ItemFields text } } }`, { update (cache, { data: { upsertBio } }) { cache.modify({ id: `User:${upsertBio.id}`, fields: { bio () { return upsertBio.bio } } }) } } ) return (