Merge branch 'main' of https://github.com/manifoldmarkets/manifold
This commit is contained in:
commit
26281556f7
|
@ -17,7 +17,7 @@ import { SiteLink } from '../site-link'
|
||||||
import { firestoreConsolePath } from 'common/envs/constants'
|
import { firestoreConsolePath } from 'common/envs/constants'
|
||||||
import { deleteField } from 'firebase/firestore'
|
import { deleteField } from 'firebase/firestore'
|
||||||
import ShortToggle from '../widgets/short-toggle'
|
import ShortToggle from '../widgets/short-toggle'
|
||||||
import { DuplicateContractButton } from '../copy-contract-button'
|
import { DuplicateContractButton } from '../duplicate-contract-button'
|
||||||
import { Row } from '../layout/row'
|
import { Row } from '../layout/row'
|
||||||
import { BETTORS, User } from 'common/user'
|
import { BETTORS, User } from 'common/user'
|
||||||
import { Button } from '../button'
|
import { Button } from '../button'
|
||||||
|
|
|
@ -40,6 +40,7 @@ function duplicateContractHref(contract: Contract) {
|
||||||
closeTime,
|
closeTime,
|
||||||
description: descriptionString,
|
description: descriptionString,
|
||||||
outcomeType: contract.outcomeType,
|
outcomeType: contract.outcomeType,
|
||||||
|
visibility: contract.visibility,
|
||||||
} as Record<string, any>
|
} as Record<string, any>
|
||||||
|
|
||||||
if (contract.outcomeType === 'PSEUDO_NUMERIC') {
|
if (contract.outcomeType === 'PSEUDO_NUMERIC') {
|
|
@ -42,7 +42,6 @@ import ItalicIcon from 'web/lib/icons/italic-icon'
|
||||||
import LinkIcon from 'web/lib/icons/link-icon'
|
import LinkIcon from 'web/lib/icons/link-icon'
|
||||||
import { getUrl } from 'common/util/parse'
|
import { getUrl } from 'common/util/parse'
|
||||||
import { TiptapSpoiler } from 'common/util/tiptap-spoiler'
|
import { TiptapSpoiler } from 'common/util/tiptap-spoiler'
|
||||||
import { useWarnUnsavedChanges } from 'web/hooks/use-warn-unsaved-changes'
|
|
||||||
|
|
||||||
const DisplayImage = Image.configure({
|
const DisplayImage = Image.configure({
|
||||||
HTMLAttributes: {
|
HTMLAttributes: {
|
||||||
|
@ -151,9 +150,6 @@ export function useTextEditor(props: {
|
||||||
editor?.setEditable(!disabled)
|
editor?.setEditable(!disabled)
|
||||||
}, [editor, disabled])
|
}, [editor, disabled])
|
||||||
|
|
||||||
const isEditorFilled = editor != null && !editor.isEmpty
|
|
||||||
useWarnUnsavedChanges(isEditorFilled)
|
|
||||||
|
|
||||||
return { editor, upload }
|
return { editor, upload }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ import { ExternalLinkIcon } from '@heroicons/react/outline'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
import { Button } from 'web/components/button'
|
import { Button } from 'web/components/button'
|
||||||
import { AddFundsModal } from 'web/components/add-funds-modal'
|
import { AddFundsModal } from 'web/components/add-funds-modal'
|
||||||
|
import ShortToggle from 'web/components/widgets/short-toggle'
|
||||||
|
|
||||||
export const getServerSideProps = redirectIfLoggedOut('/', async (_, creds) => {
|
export const getServerSideProps = redirectIfLoggedOut('/', async (_, creds) => {
|
||||||
return { props: { auth: await getUserAndPrivateUser(creds.uid) } }
|
return { props: { auth: await getUserAndPrivateUser(creds.uid) } }
|
||||||
|
@ -50,6 +51,7 @@ type NewQuestionParams = {
|
||||||
description: string
|
description: string
|
||||||
closeTime: string
|
closeTime: string
|
||||||
outcomeType: string
|
outcomeType: string
|
||||||
|
visibility: string
|
||||||
// Params for PSEUDO_NUMERIC outcomeType
|
// Params for PSEUDO_NUMERIC outcomeType
|
||||||
min?: string
|
min?: string
|
||||||
max?: string
|
max?: string
|
||||||
|
@ -136,7 +138,9 @@ export function NewContract(props: {
|
||||||
const [maxString, setMaxString] = useState(params?.max ?? '')
|
const [maxString, setMaxString] = useState(params?.max ?? '')
|
||||||
const [isLogScale, setIsLogScale] = useState<boolean>(!!params?.isLogScale)
|
const [isLogScale, setIsLogScale] = useState<boolean>(!!params?.isLogScale)
|
||||||
const [initialValueString, setInitialValueString] = useState(initValue)
|
const [initialValueString, setInitialValueString] = useState(initValue)
|
||||||
|
const [visibility, setVisibility] = useState<visibility>(
|
||||||
|
(params?.visibility as visibility) ?? 'public'
|
||||||
|
)
|
||||||
// for multiple choice, init to 3 empty answers
|
// for multiple choice, init to 3 empty answers
|
||||||
const [answers, setAnswers] = useState(['', '', ''])
|
const [answers, setAnswers] = useState(['', '', ''])
|
||||||
|
|
||||||
|
@ -168,7 +172,6 @@ export function NewContract(props: {
|
||||||
undefined
|
undefined
|
||||||
)
|
)
|
||||||
const [showGroupSelector, setShowGroupSelector] = useState(true)
|
const [showGroupSelector, setShowGroupSelector] = useState(true)
|
||||||
const [visibility, setVisibility] = useState<visibility>('public')
|
|
||||||
|
|
||||||
const [fundsModalOpen, setFundsModalOpen] = useState(false)
|
const [fundsModalOpen, setFundsModalOpen] = useState(false)
|
||||||
|
|
||||||
|
@ -414,14 +417,9 @@ export function NewContract(props: {
|
||||||
|
|
||||||
<Row className="form-control my-2 items-center gap-2 text-sm">
|
<Row className="form-control my-2 items-center gap-2 text-sm">
|
||||||
<span>Display this market on homepage</span>
|
<span>Display this market on homepage</span>
|
||||||
<input
|
<ShortToggle
|
||||||
type="checkbox"
|
on={visibility === 'public'}
|
||||||
checked={visibility === 'public'}
|
setOn={(on) => setVisibility(on ? 'public' : 'unlisted')}
|
||||||
disabled={isSubmitting}
|
|
||||||
className="cursor-pointer"
|
|
||||||
onChange={(e) =>
|
|
||||||
setVisibility(e.target.checked ? 'public' : 'unlisted')
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user