configuration of auto resolution on market creation
This commit is contained in:
parent
60739c7853
commit
e1591fd0a9
|
@ -89,16 +89,16 @@ export function NewContract(props: { question: string; tag?: string }) {
|
||||||
// const [anteError, setAnteError] = useState<string | undefined>()
|
// const [anteError, setAnteError] = useState<string | undefined>()
|
||||||
// By default, close the market a week from today
|
// By default, close the market a week from today
|
||||||
const [closeDate, setCloseDate] = useState<undefined | string>(weekFrom(dayjs()))
|
const [closeDate, setCloseDate] = useState<undefined | string>(weekFrom(dayjs()))
|
||||||
const [resolutionDate, setResolutionDate] = useState<undefined | string>(weekFrom(closeDate))
|
|
||||||
const [closeHoursMinutes, setCloseHoursMinutes] = useState<string>('23:59')
|
const [closeHoursMinutes, setCloseHoursMinutes] = useState<string>('23:59')
|
||||||
|
const [resolutionDate, setResolutionDate] = useState<undefined | string>(weekFrom(closeDate))
|
||||||
|
const [resolutionHoursMinutes, setResolutionHoursMinutes] = useState<string>('23:59')
|
||||||
const [probErrorText, setProbErrorText] = useState('')
|
const [probErrorText, setProbErrorText] = useState('')
|
||||||
const [marketInfoText, setMarketInfoText] = useState('')
|
const [marketInfoText, setMarketInfoText] = useState('')
|
||||||
|
const [resolutionInfoText, setResolutionInfoText] = useState('')
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||||
|
|
||||||
const closeTime = closeDate
|
const closeTime = closeDate ? dayjs(`${closeDate}T${closeHoursMinutes}`).valueOf() : undefined
|
||||||
? dayjs(`${closeDate}T${closeHoursMinutes}`).valueOf()
|
const automaticResolutionTime = resolutionDate ? dayjs(`${resolutionDate}TT${resolutionHoursMinutes}`).valueOf() : undefined
|
||||||
: undefined
|
|
||||||
const automaticResolutionTime = resolutionDate ? dayjs(resolutionDate).valueOf() : undefined
|
|
||||||
|
|
||||||
const balance = creator?.balance || 0
|
const balance = creator?.balance || 0
|
||||||
|
|
||||||
|
@ -376,49 +376,38 @@ export function NewContract(props: { question: string; tag?: string }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{outcomeType === 'BINARY' && (
|
{outcomeType === 'BINARY' && (
|
||||||
<div>
|
|
||||||
<Spacer h={4} />
|
|
||||||
<div className="form-control mb-1 items-start">
|
<div className="form-control mb-1 items-start">
|
||||||
<label className="label mt-1 gap-2">
|
<Spacer h={4} />
|
||||||
|
<label className="label mb-1 gap-2">
|
||||||
<span>Resolution type</span>
|
<span>Resolution type</span>
|
||||||
<InfoTooltip text="Combined markets can be resolved manually but will be resolved automatically under given conditions." />
|
<InfoTooltip text="Combined markets can be resolved manually but will be resolved automatically under given conditions." />
|
||||||
</label>
|
</label>
|
||||||
<Row className="form-control gap-2">
|
<ChoicesToggleGroup
|
||||||
<label className="label cursor-pointer gap-2">
|
currentChoice={resolutionType}
|
||||||
<input
|
setChoice={(choice) => {
|
||||||
className="radio"
|
setResolutionInfoText((choice === 'COMBINED' ? 'Automatic resolution is still experimental.' : ''))
|
||||||
type="radio"
|
setResolutionType(choice as resolutionType)
|
||||||
name="res"
|
}}
|
||||||
checked={resolutionType === 'MANUAL'}
|
choicesMap={{
|
||||||
value="MANUAL"
|
'Manual': 'MANUAL',
|
||||||
onChange={() => setResolutionType('MANUAL')}
|
'Combined': 'COMBINED',
|
||||||
disabled={isSubmitting}
|
}}
|
||||||
|
isSubmitting={isSubmitting}
|
||||||
|
className={'col-span-4 sm:col-span-3'}
|
||||||
/>
|
/>
|
||||||
<span className="label-text">Manual</span>
|
{resolutionInfoText && (
|
||||||
</label>
|
<div className="mt-2 ml-1 text-sm text-indigo-700">
|
||||||
|
{resolutionInfoText}
|
||||||
<label className="label cursor-pointer gap-2">
|
|
||||||
<input
|
|
||||||
className="radio"
|
|
||||||
type="radio"
|
|
||||||
name="res"
|
|
||||||
checked={resolutionType === 'COMBINED'}
|
|
||||||
value="COMBINED"
|
|
||||||
onChange={() => setResolutionType('COMBINED')}
|
|
||||||
disabled={isSubmitting}
|
|
||||||
/>
|
|
||||||
<span className="label-text">Combined (experimental)</span>
|
|
||||||
</label>
|
|
||||||
</Row>
|
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{resolutionType === 'COMBINED' && (
|
{resolutionType === 'COMBINED' && (
|
||||||
<div className="form-control">
|
<div className="form-control mb-1 items-start">
|
||||||
<Row className="label justify-start">
|
<Spacer h={4} />
|
||||||
|
<label className="label mb-1 gap-2">
|
||||||
<span>Question resolves automatically as:</span>
|
<span>Question resolves automatically as:</span>
|
||||||
<InfoTooltip text="The market will be resolved automatically on this date (local timezone)." />
|
<InfoTooltip text="The market will be resolved automatically on this date (local timezone)." />
|
||||||
</Row>
|
</label>
|
||||||
<Row className={'justify-start'}>
|
|
||||||
<ChoicesToggleGroup
|
<ChoicesToggleGroup
|
||||||
currentChoice={automaticResolution}
|
currentChoice={automaticResolution}
|
||||||
setChoice={(choice) => setAutomaticResolution(choice as resolution)}
|
setChoice={(choice) => setAutomaticResolution(choice as resolution)}
|
||||||
|
@ -431,25 +420,32 @@ export function NewContract(props: { question: string; tag?: string }) {
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
className={'col-span-4 sm:col-span-3'}
|
className={'col-span-4 sm:col-span-3'}
|
||||||
/>
|
/>
|
||||||
</Row>
|
<Row>
|
||||||
<input
|
<input
|
||||||
type={'date'}
|
type={'date'}
|
||||||
className="input input-bordered mt-4"
|
className="input input-bordered mt-4"
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setResolutionDate(
|
setResolutionDate(dayjs(e.target.value).format('YYYY-MM-DDT23:59') || '')
|
||||||
dayjs(e.target.value).format('YYYY-MM-DDT23:59') || ''
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
min={Date.parse(closeDate??"")} // TODO: Fix: Market can be created with dates in the past
|
min={Date.parse(closeDate??"")} // TODO: Fix: Market can be created with dates in the past
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
value={dayjs(resolutionDate).format('YYYY-MM-DD')}
|
value={dayjs(resolutionDate).format('YYYY-MM-DD')}
|
||||||
/>
|
/>
|
||||||
|
<input
|
||||||
|
type={'time'}
|
||||||
|
className="input input-bordered mt-4 ml-2"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
onChange={(e) => setResolutionHoursMinutes(e.target.value)}
|
||||||
|
min={'00:00'}
|
||||||
|
disabled={isSubmitting}
|
||||||
|
value={closeHoursMinutes}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Spacer h={4} />
|
<Spacer h={4} />
|
||||||
|
|
||||||
<div className="form-control mb-1 items-start">
|
<div className="form-control mb-1 items-start">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user