From 831591b0805697eff369901ca8c3b252c81dd706 Mon Sep 17 00:00:00 2001 From: Milli Date: Wed, 25 May 2022 22:17:38 +0200 Subject: [PATCH] restricted automatic resolution to binary markets --- web/pages/create.tsx | 135 +++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 64 deletions(-) diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 64fdaa3c..f825cd38 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -97,6 +97,7 @@ export function NewContract(props: { question: string; tag?: string }) { const [isSubmitting, setIsSubmitting] = useState(false) const closeTime = closeDate ? dayjs(closeDate).valueOf() : undefined + const resolutionTime = resolutionDate ? dayjs(resolutionDate).valueOf() : undefined const balance = creator?.balance || 0 @@ -152,6 +153,8 @@ export function NewContract(props: { question: string; tag?: string }) { tags: category ? [category] : undefined, min, max, + automaticResolution, + resolutionTime }) ) await router.push(contractPath(result as Contract)) @@ -372,72 +375,76 @@ export function NewContract(props: { question: string; tag?: string }) { )} - -
- - - - - - - - {resolutionType === 'COMBINED' && ( + {outcomeType === 'BINARY' && ( +
+
-
- )} + + + + + +
+ + {resolutionType === 'COMBINED' && ( +
+ + + + + e.stopPropagation()} + onChange={(e) => + setResolutionDate( + dayjs(e.target.value).format('YYYY-MM-DDT23:59') || '' + ) + } + min={Date.parse(closeDate??"")} // TODO: Fix: Market can be created with dates in the past + disabled={isSubmitting} + value={dayjs(resolutionDate).format('YYYY-MM-DD')} + /> +
+ )} +
+ )} -
@@ -508,6 +515,6 @@ export function NewContract(props: { question: string; tag?: string }) { {isSubmitting ? 'Creating...' : 'Create market'}
- + ) }