import { gql, useApolloClient, useMutation } from '@apollo/client' import { useShowModal } from './modal' import { useToast } from './toast' import { Button, Dropdown, InputGroup } from 'react-bootstrap' import { Form, InputUserSuggest, SubmitButton } from './form' import { territoryTransferSchema } from '@/lib/validate' import { useCallback } from 'react' import Link from 'next/link' import { useMe } from './me' function TransferObstacle ({ sub, onClose, userName }) { const toaster = useToast() const [transfer] = useMutation( gql` mutation transferTerritory($subName: String!, $userName: String!) { transferTerritory(subName: $subName, userName: $userName) { name user { id } } } ` ) return (
Do you really want to transfer your territory
~{sub.name} {' '}to{' '} @{userName}?
) } function TerritoryTransferForm ({ sub, onClose }) { const showModal = useShowModal() const client = useApolloClient() const { me } = useMe() const schema = territoryTransferSchema({ me, client }) const onSubmit = useCallback(async (values) => { showModal(onClose => ) }, []) return (

transfer territory

@} showValid autoFocus />
transfer
) } export function TerritoryTransferDropdownItem ({ sub }) { const showModal = useShowModal() return ( showModal(onClose => )} > transfer ) }