diff --git a/web/components/contract/contract-info-dialog.tsx b/web/components/contract/contract-info-dialog.tsx index bfa7b0cc..4cec9ab5 100644 --- a/web/components/contract/contract-info-dialog.tsx +++ b/web/components/contract/contract-info-dialog.tsx @@ -1,4 +1,4 @@ -import { DotsHorizontalIcon, PencilIcon } from '@heroicons/react/outline' +import { DotsHorizontalIcon, PencilIcon, CheckIcon } from '@heroicons/react/outline' import clsx from 'clsx' import dayjs from 'dayjs' import { uniqBy } from 'lodash' @@ -83,23 +83,16 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[]; isC {autoResolutionTime && autoResolution && ( <> + - Automatic resolution - - - - Default resolution - + Auto resolution + {contract.autoResolution} )} @@ -173,12 +166,13 @@ const getTweetText = (contract: Contract, isCreator: boolean) => { } export function EditableTime(props: { + title: string time: number contract: Contract isCreator: boolean dateType: contractField }) { - const { time, contract, isCreator, dateType } = props + const { title, time, contract, isCreator, dateType } = props const [isEditing, setIsEditing] = useState(false) const [timeString, setTimeString] = useState(time && formatTime(time)) @@ -194,83 +188,37 @@ export function EditableTime(props: { } return ( - - {isEditing ? ( -
- e.stopPropagation()} - onChange={(e) => setTimeString(e.target.value || '')} - min={contract.closeTime} - value={timeString} - /> -
- ) : ( -
{timeString}
- )} - {isCreator && - (isEditing ? ( - - ) : ( - + + + {title} + {isCreator && ( + isEditing ? ( + + ):( + ))} - - ) -} - -export function EditableString(props: { - value: string - contract: Contract - isCreator: boolean - dateType: contractField -}) { - const { value, contract, isCreator, dateType } = props - - const [isEditing, setIsEditing] = useState(false) - const [newValue, setTimeString] = useState(value) - const onSave = () => { - if (newValue === value) setIsEditing(false) - else { - updateContract(contract.id, { - [dateType]: newValue - }) - setIsEditing(false) - } - } - - return ( - - {isEditing ? ( - e.stopPropagation()} - onChange={(e) => setTimeString(e.target.value || '')} - min={contract.closeTime} - value={newValue} - /> - ) : ( - <>{newValue} - )} - {isCreator && - (isEditing ? ( - - ) : ( - - ))} - + + + {isEditing ? ( +
+ e.stopPropagation()} + onChange={(e) => setTimeString(e.target.value || '')} + min={contract.closeTime} + value={timeString} + /> +
+ ) : ( +
{timeString}
+ )} + + ) } diff --git a/web/components/layout/modal.tsx b/web/components/layout/modal.tsx index d61a38dd..4817d072 100644 --- a/web/components/layout/modal.tsx +++ b/web/components/layout/modal.tsx @@ -45,7 +45,7 @@ export function Modal(props: { leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" > -
+
{children}