diff --git a/web/pages/make-predictions.tsx b/web/pages/make-predictions.tsx index 31a947d9..6017705f 100644 --- a/web/pages/make-predictions.tsx +++ b/web/pages/make-predictions.tsx @@ -1,6 +1,9 @@ import clsx from 'clsx' +import dayjs from 'dayjs' import Link from 'next/link' import { useState } from 'react' +import { AmountInput } from '../components/amount-input' +import { InfoTooltip } from '../components/info-tooltip' import { Col } from '../components/layout/col' import { Row } from '../components/layout/row' @@ -100,6 +103,14 @@ export default function MakePredictions() { const [isSubmitting, setIsSubmitting] = useState(false) const [createdContracts, setCreatedContracts] = useState([]) + const [ante, setAnte] = useState(100) + const [anteError, setAnteError] = useState() + // By default, close the market a week from today + const weekFromToday = dayjs().add(7, 'day').format('YYYY-MM-DDT23:59') + const [closeDate, setCloseDate] = useState(weekFromToday) + + const closeTime = closeDate ? dayjs(closeDate).valueOf() : undefined + const bulkPlaceholder = `e.g. ${TEST_VALUE} ... @@ -138,6 +149,8 @@ ${TEST_VALUE} question: prediction.question, description: prediction.description, initialProb: prediction.initialProb, + ante, + closeTime, }).then((r) => (r.data as any).contract) setCreatedContracts((prev) => [...prev, contract]) @@ -173,7 +186,7 @@ ${TEST_VALUE}
+
+ + e.stopPropagation()} + onChange={(e) => setCloseDate(e.target.value || '')} + min={Date.now()} + disabled={isSubmitting} + value={closeDate} + /> +
+ + + +
+ + +
+ {predictions.length > 0 && (
@@ -226,3 +275,13 @@ ${TEST_VALUE} ) } + +// Given a date string like '2022-04-02', +// return the time just before midnight on that date (in the user's local time), as millis since epoch +function dateToMillis(date: string) { + return dayjs(date) + .set('hour', 23) + .set('minute', 59) + .set('second', 59) + .valueOf() +}