import { Form, Input, MarkdownInput, SubmitButton, VariableInput } from '../components/form' import { useRouter } from 'next/router' import { gql, useApolloClient, useMutation } from '@apollo/client' import Countdown from './countdown' import AdvPostForm, { AdvPostInitial } from './adv-post-form' import { MAX_POLL_NUM_CHOICES } from '../lib/constants' import TextareaAutosize from 'react-textarea-autosize' import FeeButton, { EditFeeButton } from './fee-button' import Delete from './delete' import { Button } from 'react-bootstrap' import { pollSchema } from '../lib/validate' export function PollForm ({ item, editThreshold }) { const router = useRouter() const client = useApolloClient() const schema = pollSchema(client) const [upsertPoll] = useMutation( gql` mutation upsertPoll($id: ID, $title: String!, $text: String, $options: [String!]!, $boost: Int, $forward: String) { upsertPoll(id: $id, title: $title, text: $text, options: $options, boost: $boost, forward: $forward) { id } }` ) const initialOptions = item?.poll?.options.map(i => i.option) return (
) }