2021-12-14 01:07:28 +00:00
|
|
|
import router from 'next/router'
|
2021-12-16 03:58:28 +00:00
|
|
|
import { useEffect, useState } from 'react'
|
2022-01-05 05:51:26 +00:00
|
|
|
import clsx from 'clsx'
|
|
|
|
import dayjs from 'dayjs'
|
2022-01-06 08:45:30 +00:00
|
|
|
import Textarea from 'react-expanding-textarea'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { Spacer } from 'web/components/layout/spacer'
|
|
|
|
import { useUser } from 'web/hooks/use-user'
|
|
|
|
import { Contract, contractPath } from 'web/lib/firebase/contracts'
|
2022-06-06 19:46:06 +00:00
|
|
|
import { createMarket } from 'web/lib/firebase/api-call'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { FIXED_ANTE, MINIMUM_ANTE } from 'common/antes'
|
|
|
|
import { InfoTooltip } from 'web/components/info-tooltip'
|
|
|
|
import { Page } from 'web/components/page'
|
|
|
|
import { Row } from 'web/components/layout/row'
|
2022-05-26 21:37:51 +00:00
|
|
|
import {
|
|
|
|
MAX_DESCRIPTION_LENGTH,
|
|
|
|
MAX_QUESTION_LENGTH,
|
|
|
|
outcomeType,
|
|
|
|
} from 'common/contract'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { formatMoney } from 'common/util/format'
|
|
|
|
import { useHasCreatedContractToday } from 'web/hooks/use-has-created-contract-today'
|
2022-05-23 12:35:50 +00:00
|
|
|
import { removeUndefinedProps } from 'common/util/object'
|
2022-05-13 23:42:48 +00:00
|
|
|
import { CATEGORIES } from 'common/categories'
|
2022-05-23 12:35:50 +00:00
|
|
|
import { ChoicesToggleGroup } from 'web/components/choices-toggle-group'
|
2022-06-15 03:00:36 +00:00
|
|
|
import { track } from 'web/lib/service/analytics'
|
2022-06-15 21:34:34 +00:00
|
|
|
import { useTracking } from 'web/hooks/use-tracking'
|
2022-06-15 20:12:16 +00:00
|
|
|
import { useWarnUnsavedChanges } from 'web/hooks/use-warn-unsaved-changes'
|
2022-01-21 18:33:58 +00:00
|
|
|
|
|
|
|
export default function Create() {
|
|
|
|
const [question, setQuestion] = useState('')
|
|
|
|
|
2022-06-15 21:34:34 +00:00
|
|
|
useTracking('view create page')
|
|
|
|
|
2022-01-21 18:33:58 +00:00
|
|
|
return (
|
|
|
|
<Page>
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="mx-auto w-full max-w-2xl">
|
2022-06-05 02:28:27 +00:00
|
|
|
<div className="rounded-lg px-6 py-4 sm:py-0">
|
2022-01-21 18:33:58 +00:00
|
|
|
<form>
|
|
|
|
<div className="form-control w-full">
|
|
|
|
<label className="label">
|
2022-05-23 12:35:50 +00:00
|
|
|
<span className="mb-1">
|
|
|
|
Question<span className={'text-red-700'}>*</span>
|
|
|
|
</span>
|
2022-01-21 18:33:58 +00:00
|
|
|
</label>
|
|
|
|
|
|
|
|
<Textarea
|
|
|
|
placeholder="e.g. Will the Democrats win the 2024 US presidential election?"
|
|
|
|
className="input input-bordered resize-none"
|
2022-04-19 16:04:07 +00:00
|
|
|
autoFocus
|
2022-05-26 21:37:51 +00:00
|
|
|
maxLength={MAX_QUESTION_LENGTH}
|
2022-01-21 18:33:58 +00:00
|
|
|
value={question}
|
|
|
|
onChange={(e) => setQuestion(e.target.value || '')}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</form>
|
2022-06-05 02:28:27 +00:00
|
|
|
<Spacer h={6} />
|
2022-01-21 18:33:58 +00:00
|
|
|
<NewContract question={question} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|
2021-12-14 01:07:28 +00:00
|
|
|
|
2021-12-10 17:54:16 +00:00
|
|
|
// Allow user to create a new contract
|
2022-06-13 04:42:41 +00:00
|
|
|
export function NewContract(props: { question: string }) {
|
|
|
|
const { question } = props
|
2021-12-10 17:54:16 +00:00
|
|
|
const creator = useUser()
|
|
|
|
|
2021-12-16 03:58:28 +00:00
|
|
|
useEffect(() => {
|
2021-12-16 07:00:35 +00:00
|
|
|
if (creator === null) router.push('/')
|
2022-01-05 18:23:58 +00:00
|
|
|
}, [creator])
|
|
|
|
|
2022-02-17 23:00:19 +00:00
|
|
|
const [outcomeType, setOutcomeType] = useState<outcomeType>('BINARY')
|
2022-06-09 20:26:46 +00:00
|
|
|
const [initialProb] = useState(50)
|
2022-05-19 17:42:03 +00:00
|
|
|
const [minString, setMinString] = useState('')
|
|
|
|
const [maxString, setMaxString] = useState('')
|
2021-12-14 01:07:28 +00:00
|
|
|
const [description, setDescription] = useState('')
|
2022-05-12 15:07:10 +00:00
|
|
|
|
|
|
|
const [category, setCategory] = useState<string>('')
|
|
|
|
// const [tagText, setTagText] = useState<string>(tag ?? '')
|
|
|
|
// const tags = parseWordsAsTags(tagText)
|
2022-01-05 05:51:26 +00:00
|
|
|
|
2022-06-13 04:42:41 +00:00
|
|
|
const [ante, _setAnte] = useState(FIXED_ANTE)
|
2022-04-28 23:01:50 +00:00
|
|
|
|
2022-05-23 14:43:11 +00:00
|
|
|
const mustWaitForDailyFreeMarketStatus = useHasCreatedContractToday(creator)
|
2022-06-15 03:00:36 +00:00
|
|
|
const isFree =
|
|
|
|
mustWaitForDailyFreeMarketStatus != 'loading' &&
|
|
|
|
!mustWaitForDailyFreeMarketStatus
|
2022-04-28 23:01:50 +00:00
|
|
|
|
2022-04-09 18:51:22 +00:00
|
|
|
// useEffect(() => {
|
|
|
|
// if (ante === null && creator) {
|
|
|
|
// const initialAnte = creator.balance < 100 ? MINIMUM_ANTE : 100
|
|
|
|
// setAnte(initialAnte)
|
|
|
|
// }
|
|
|
|
// }, [ante, creator])
|
2022-01-14 23:39:17 +00:00
|
|
|
|
2022-04-09 18:51:22 +00:00
|
|
|
// const [anteError, setAnteError] = useState<string | undefined>()
|
2022-01-21 18:33:58 +00:00
|
|
|
// By default, close the market a week from today
|
2022-05-25 17:54:28 +00:00
|
|
|
const weekFromToday = dayjs().add(7, 'day').format('YYYY-MM-DD')
|
2022-01-31 05:20:27 +00:00
|
|
|
const [closeDate, setCloseDate] = useState<undefined | string>(weekFromToday)
|
2022-05-25 17:54:28 +00:00
|
|
|
const [closeHoursMinutes, setCloseHoursMinutes] = useState<string>('23:59')
|
|
|
|
const [marketInfoText, setMarketInfoText] = useState('')
|
2021-12-14 01:07:28 +00:00
|
|
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
2022-01-03 05:21:25 +00:00
|
|
|
|
2022-05-25 17:54:28 +00:00
|
|
|
const closeTime = closeDate
|
|
|
|
? dayjs(`${closeDate}T${closeHoursMinutes}`).valueOf()
|
|
|
|
: undefined
|
2022-01-05 05:51:26 +00:00
|
|
|
|
2022-01-15 23:30:48 +00:00
|
|
|
const balance = creator?.balance || 0
|
2022-01-03 05:21:25 +00:00
|
|
|
|
2022-05-19 17:42:03 +00:00
|
|
|
const min = minString ? parseFloat(minString) : undefined
|
|
|
|
const max = maxString ? parseFloat(maxString) : undefined
|
2022-05-25 17:54:28 +00:00
|
|
|
// get days from today until the end of this year:
|
|
|
|
const daysLeftInTheYear = dayjs().endOf('year').diff(dayjs(), 'day')
|
2022-05-19 17:42:03 +00:00
|
|
|
|
2022-06-15 22:19:14 +00:00
|
|
|
const hasUnsavedChanges = !isSubmitting && Boolean(question || description)
|
2022-06-15 20:12:16 +00:00
|
|
|
useWarnUnsavedChanges(hasUnsavedChanges)
|
|
|
|
|
2022-01-03 05:21:25 +00:00
|
|
|
const isValid =
|
2022-05-25 17:54:28 +00:00
|
|
|
(outcomeType === 'BINARY' ? initialProb >= 5 && initialProb <= 95 : true) &&
|
2022-01-03 05:21:25 +00:00
|
|
|
question.length > 0 &&
|
2022-01-14 23:39:17 +00:00
|
|
|
ante !== undefined &&
|
2022-02-06 01:02:13 +00:00
|
|
|
ante !== null &&
|
2022-01-14 23:39:17 +00:00
|
|
|
ante >= MINIMUM_ANTE &&
|
2022-05-23 14:43:11 +00:00
|
|
|
(ante <= balance ||
|
|
|
|
(mustWaitForDailyFreeMarketStatus != 'loading' &&
|
|
|
|
!mustWaitForDailyFreeMarketStatus)) &&
|
2022-01-24 22:33:02 +00:00
|
|
|
// closeTime must be in the future
|
2022-01-12 05:40:41 +00:00
|
|
|
closeTime &&
|
2022-05-19 17:42:03 +00:00
|
|
|
closeTime > Date.now() &&
|
|
|
|
(outcomeType !== 'NUMERIC' ||
|
|
|
|
(min !== undefined &&
|
|
|
|
max !== undefined &&
|
|
|
|
isFinite(min) &&
|
|
|
|
isFinite(max) &&
|
|
|
|
min < max &&
|
|
|
|
max - min > 0.01))
|
2021-12-14 01:07:28 +00:00
|
|
|
|
2022-05-23 12:35:50 +00:00
|
|
|
function setCloseDateInDays(days: number) {
|
2022-05-25 17:54:28 +00:00
|
|
|
const newCloseDate = dayjs().add(days, 'day').format('YYYY-MM-DD')
|
2022-05-23 12:35:50 +00:00
|
|
|
setCloseDate(newCloseDate)
|
|
|
|
}
|
|
|
|
|
2021-12-14 01:07:28 +00:00
|
|
|
async function submit() {
|
2022-01-03 05:21:25 +00:00
|
|
|
// TODO: Tell users why their contract is invalid
|
|
|
|
if (!creator || !isValid) return
|
2021-12-14 01:07:28 +00:00
|
|
|
|
|
|
|
setIsSubmitting(true)
|
|
|
|
|
2022-05-19 22:04:34 +00:00
|
|
|
try {
|
2022-06-06 19:46:06 +00:00
|
|
|
const result = await createMarket(
|
2022-05-19 22:04:34 +00:00
|
|
|
removeUndefinedProps({
|
|
|
|
question,
|
|
|
|
outcomeType,
|
|
|
|
description,
|
|
|
|
initialProb,
|
|
|
|
ante,
|
|
|
|
closeTime,
|
|
|
|
tags: category ? [category] : undefined,
|
|
|
|
min,
|
|
|
|
max,
|
|
|
|
})
|
|
|
|
)
|
2022-06-15 03:00:36 +00:00
|
|
|
|
|
|
|
track('create market', {
|
|
|
|
slug: result.slug,
|
|
|
|
initialProb,
|
|
|
|
category,
|
|
|
|
isFree,
|
|
|
|
})
|
|
|
|
|
2022-05-20 21:58:14 +00:00
|
|
|
await router.push(contractPath(result as Contract))
|
2022-05-19 22:04:34 +00:00
|
|
|
} catch (e) {
|
|
|
|
console.log('error creating contract', e)
|
2022-01-05 05:51:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-17 23:00:19 +00:00
|
|
|
const descriptionPlaceholder =
|
|
|
|
outcomeType === 'BINARY'
|
2022-05-23 12:35:50 +00:00
|
|
|
? `e.g. This question resolves to "YES" if they receive the majority of votes...`
|
2022-02-17 23:00:19 +00:00
|
|
|
: `e.g. I will choose the answer according to...`
|
2021-12-10 17:54:16 +00:00
|
|
|
|
2021-12-16 03:58:28 +00:00
|
|
|
if (!creator) return <></>
|
|
|
|
|
2021-12-10 17:54:16 +00:00
|
|
|
return (
|
2022-01-23 00:38:34 +00:00
|
|
|
<div>
|
2022-06-05 02:28:27 +00:00
|
|
|
<label className="label">
|
|
|
|
<span className="mb-1">Answer type</span>
|
2022-02-17 23:00:19 +00:00
|
|
|
</label>
|
2022-05-25 17:54:28 +00:00
|
|
|
<ChoicesToggleGroup
|
|
|
|
currentChoice={outcomeType}
|
|
|
|
setChoice={(choice) => {
|
2022-06-02 19:27:01 +00:00
|
|
|
if (choice === 'FREE_RESPONSE')
|
2022-05-25 17:54:28 +00:00
|
|
|
setMarketInfoText(
|
|
|
|
'Users can submit their own answers to this market.'
|
|
|
|
)
|
|
|
|
else setMarketInfoText('')
|
2022-06-02 19:27:01 +00:00
|
|
|
setOutcomeType(choice as 'BINARY' | 'FREE_RESPONSE')
|
2022-05-25 17:54:28 +00:00
|
|
|
}}
|
|
|
|
choicesMap={{
|
|
|
|
'Yes / No': 'BINARY',
|
|
|
|
'Free response': 'FREE_RESPONSE',
|
|
|
|
}}
|
|
|
|
isSubmitting={isSubmitting}
|
|
|
|
className={'col-span-4'}
|
|
|
|
/>
|
|
|
|
{marketInfoText && (
|
2022-06-05 02:28:27 +00:00
|
|
|
<div className="mt-3 ml-1 text-sm text-indigo-700">
|
2022-05-25 17:54:28 +00:00
|
|
|
{marketInfoText}
|
|
|
|
</div>
|
|
|
|
)}
|
2022-06-05 02:28:27 +00:00
|
|
|
|
|
|
|
<Spacer h={6} />
|
2022-01-30 21:51:30 +00:00
|
|
|
|
2022-05-19 17:42:03 +00:00
|
|
|
{outcomeType === 'NUMERIC' && (
|
|
|
|
<div className="form-control items-start">
|
|
|
|
<label className="label gap-2">
|
|
|
|
<span className="mb-1">Range</span>
|
|
|
|
<InfoTooltip text="The minimum and maximum numbers across the numeric range." />
|
|
|
|
</label>
|
|
|
|
|
|
|
|
<Row className="gap-2">
|
|
|
|
<input
|
|
|
|
type="number"
|
|
|
|
className="input input-bordered"
|
|
|
|
placeholder="MIN"
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
onChange={(e) => setMinString(e.target.value)}
|
|
|
|
min={Number.MIN_SAFE_INTEGER}
|
|
|
|
max={Number.MAX_SAFE_INTEGER}
|
|
|
|
disabled={isSubmitting}
|
|
|
|
value={minString ?? ''}
|
|
|
|
/>
|
|
|
|
<input
|
|
|
|
type="number"
|
|
|
|
className="input input-bordered"
|
|
|
|
placeholder="MAX"
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
onChange={(e) => setMaxString(e.target.value)}
|
|
|
|
min={Number.MIN_SAFE_INTEGER}
|
|
|
|
max={Number.MAX_SAFE_INTEGER}
|
|
|
|
disabled={isSubmitting}
|
|
|
|
value={maxString}
|
|
|
|
/>
|
|
|
|
</Row>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="form-control max-w-sm items-start">
|
2022-02-06 23:14:07 +00:00
|
|
|
<label className="label gap-2">
|
2022-05-12 15:07:10 +00:00
|
|
|
<span className="mb-1">Category</span>
|
2022-02-06 23:14:07 +00:00
|
|
|
</label>
|
|
|
|
|
2022-05-12 15:07:10 +00:00
|
|
|
<select
|
|
|
|
className="select select-bordered w-full max-w-xs"
|
2022-05-13 23:42:48 +00:00
|
|
|
value={category}
|
|
|
|
onChange={(e) => setCategory(e.currentTarget.value ?? '')}
|
2022-05-12 15:07:10 +00:00
|
|
|
>
|
2022-05-17 15:56:43 +00:00
|
|
|
<option value={''}>(none)</option>
|
2022-05-13 23:42:48 +00:00
|
|
|
{Object.entries(CATEGORIES).map(([id, name]) => (
|
|
|
|
<option key={id} value={id}>
|
|
|
|
{name}
|
2022-05-12 15:07:10 +00:00
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</select>
|
|
|
|
</div>
|
2022-02-06 23:14:07 +00:00
|
|
|
|
2022-06-05 02:28:27 +00:00
|
|
|
<Spacer h={6} />
|
2022-02-06 23:14:07 +00:00
|
|
|
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="form-control mb-1 items-start">
|
|
|
|
<label className="label mb-1 gap-2">
|
2022-06-05 02:28:27 +00:00
|
|
|
<span>Question closes in</span>
|
2022-05-25 17:54:28 +00:00
|
|
|
<InfoTooltip text="Betting will be halted after this time (local timezone)." />
|
2022-01-21 18:33:58 +00:00
|
|
|
</label>
|
2022-05-23 12:35:50 +00:00
|
|
|
<Row className={'w-full items-center gap-2'}>
|
|
|
|
<ChoicesToggleGroup
|
2022-05-25 17:54:28 +00:00
|
|
|
currentChoice={dayjs(`${closeDate}T23:59`).diff(dayjs(), 'day')}
|
|
|
|
setChoice={(choice) => {
|
|
|
|
setCloseDateInDays(choice as number)
|
|
|
|
}}
|
|
|
|
choicesMap={{
|
|
|
|
'A day': 1,
|
|
|
|
'A week': 7,
|
|
|
|
'30 days': 30,
|
|
|
|
'This year': daysLeftInTheYear,
|
|
|
|
}}
|
2022-05-23 12:35:50 +00:00
|
|
|
isSubmitting={isSubmitting}
|
2022-05-25 17:54:28 +00:00
|
|
|
className={'col-span-4 sm:col-span-2'}
|
2022-05-23 12:35:50 +00:00
|
|
|
/>
|
|
|
|
</Row>
|
2022-05-25 17:54:28 +00:00
|
|
|
<Row>
|
2022-05-23 12:35:50 +00:00
|
|
|
<input
|
|
|
|
type={'date'}
|
|
|
|
className="input input-bordered mt-4"
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
onChange={(e) =>
|
2022-05-25 17:54:28 +00:00
|
|
|
setCloseDate(dayjs(e.target.value).format('YYYY-MM-DD') || '')
|
2022-05-23 12:35:50 +00:00
|
|
|
}
|
|
|
|
min={Date.now()}
|
|
|
|
disabled={isSubmitting}
|
|
|
|
value={dayjs(closeDate).format('YYYY-MM-DD')}
|
|
|
|
/>
|
2022-05-25 17:54:28 +00:00
|
|
|
<input
|
|
|
|
type={'time'}
|
|
|
|
className="input input-bordered mt-4 ml-2"
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
onChange={(e) => setCloseHoursMinutes(e.target.value)}
|
|
|
|
min={'00:00'}
|
|
|
|
disabled={isSubmitting}
|
|
|
|
value={closeHoursMinutes}
|
|
|
|
/>
|
|
|
|
</Row>
|
2022-01-21 18:33:58 +00:00
|
|
|
</div>
|
2022-01-16 01:02:01 +00:00
|
|
|
|
2022-06-05 02:28:27 +00:00
|
|
|
<Spacer h={6} />
|
2022-01-16 01:02:01 +00:00
|
|
|
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="form-control mb-1 items-start">
|
|
|
|
<label className="label mb-1 gap-2">
|
2022-06-05 02:28:27 +00:00
|
|
|
<span className="mb-1">Description</span>
|
|
|
|
<InfoTooltip text="Optional. Describe how you will resolve this question." />
|
2022-01-21 18:33:58 +00:00
|
|
|
</label>
|
2022-06-05 02:28:27 +00:00
|
|
|
<Textarea
|
|
|
|
className="textarea textarea-bordered w-full resize-none"
|
|
|
|
rows={3}
|
|
|
|
maxLength={MAX_DESCRIPTION_LENGTH}
|
|
|
|
placeholder={descriptionPlaceholder}
|
|
|
|
value={description}
|
2022-01-21 18:33:58 +00:00
|
|
|
disabled={isSubmitting}
|
2022-06-05 02:28:27 +00:00
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
onChange={(e) => setDescription(e.target.value || '')}
|
|
|
|
/>
|
2022-01-21 18:33:58 +00:00
|
|
|
</div>
|
2022-01-16 01:02:01 +00:00
|
|
|
|
2022-06-05 02:28:27 +00:00
|
|
|
<Spacer h={6} />
|
|
|
|
|
|
|
|
<Row className="items-end justify-between">
|
|
|
|
<div className="form-control mb-1 items-start">
|
|
|
|
<label className="label mb-1 gap-2">
|
|
|
|
<span>Cost</span>
|
|
|
|
{mustWaitForDailyFreeMarketStatus != 'loading' &&
|
|
|
|
mustWaitForDailyFreeMarketStatus && (
|
|
|
|
<InfoTooltip
|
|
|
|
text={`Cost to create your question. This amount is used to subsidize betting.`}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</label>
|
|
|
|
{mustWaitForDailyFreeMarketStatus != 'loading' &&
|
|
|
|
!mustWaitForDailyFreeMarketStatus ? (
|
|
|
|
<div className="label-text text-primary pl-1">
|
|
|
|
<span className={'label-text text-neutral line-through '}>
|
|
|
|
{formatMoney(ante)}
|
|
|
|
</span>{' '}
|
|
|
|
FREE
|
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
mustWaitForDailyFreeMarketStatus != 'loading' && (
|
|
|
|
<div className="label-text text-neutral pl-1">
|
|
|
|
{formatMoney(ante)}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
{mustWaitForDailyFreeMarketStatus != 'loading' &&
|
|
|
|
mustWaitForDailyFreeMarketStatus &&
|
|
|
|
ante > balance && (
|
|
|
|
<div className="mb-2 mt-2 mr-auto self-center whitespace-nowrap text-xs font-medium tracking-wide">
|
|
|
|
<span className="mr-2 text-red-500">Insufficient balance</span>
|
|
|
|
<button
|
|
|
|
className="btn btn-xs btn-primary"
|
|
|
|
onClick={() => (window.location.href = '/add-funds')}
|
|
|
|
>
|
2022-06-13 04:25:57 +00:00
|
|
|
Get M$
|
2022-06-05 02:28:27 +00:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2022-01-21 18:33:58 +00:00
|
|
|
|
|
|
|
<button
|
|
|
|
type="submit"
|
|
|
|
className={clsx(
|
2022-06-05 02:28:27 +00:00
|
|
|
'btn btn-primary normal-case',
|
2022-01-21 18:33:58 +00:00
|
|
|
isSubmitting && 'loading disabled'
|
|
|
|
)}
|
|
|
|
disabled={isSubmitting || !isValid}
|
|
|
|
onClick={(e) => {
|
|
|
|
e.preventDefault()
|
|
|
|
submit()
|
|
|
|
}}
|
|
|
|
>
|
2022-05-25 17:54:28 +00:00
|
|
|
{isSubmitting ? 'Creating...' : 'Create question'}
|
2022-01-21 18:33:58 +00:00
|
|
|
</button>
|
2022-06-05 02:28:27 +00:00
|
|
|
</Row>
|
2022-01-23 00:38:34 +00:00
|
|
|
</div>
|
2021-12-10 17:54:16 +00:00
|
|
|
)
|
|
|
|
}
|