diff --git a/functions/src/create-post.ts b/functions/src/create-post.ts
index 96e3c66a..d1864ac2 100644
--- a/functions/src/create-post.ts
+++ b/functions/src/create-post.ts
@@ -71,19 +71,23 @@ export const createpost = newEndpoint({}, async (req, auth) => {
if (question) {
const closeTime = Date.now() + DAY_MS * 30 * 3
- const result = await createMarketHelper(
- {
- question,
- closeTime,
- outcomeType: 'BINARY',
- visibility: 'unlisted',
- initialProb: 50,
- // Dating group!
- groupId: 'j3ZE8fkeqiKmRGumy3O1',
- },
- auth
- )
- contractSlug = result.slug
+ try {
+ const result = await createMarketHelper(
+ {
+ question,
+ closeTime,
+ outcomeType: 'BINARY',
+ visibility: 'unlisted',
+ initialProb: 50,
+ // Dating group!
+ groupId: 'j3ZE8fkeqiKmRGumy3O1',
+ },
+ auth
+ )
+ contractSlug = result.slug
+ } catch (e) {
+ console.error(e)
+ }
}
const post: Post = removeUndefinedProps({
diff --git a/web/pages/date-docs/[username].tsx b/web/pages/date-docs/[username].tsx
index dd7d5d73..6f6eaf5e 100644
--- a/web/pages/date-docs/[username].tsx
+++ b/web/pages/date-docs/[username].tsx
@@ -142,15 +142,17 @@ export function DateDocPost(props: {
) : (
)}
-
-
-
+ {contractSlug && (
+
+
+
+ )}
)
}
diff --git a/web/pages/date-docs/create.tsx b/web/pages/date-docs/create.tsx
index ed1df677..a0fe8922 100644
--- a/web/pages/date-docs/create.tsx
+++ b/web/pages/date-docs/create.tsx
@@ -15,6 +15,8 @@ import { MINUTE_MS } from 'common/util/time'
import { Col } from 'web/components/layout/col'
import { MAX_QUESTION_LENGTH } from 'common/contract'
import { NoSEO } from 'web/components/NoSEO'
+import ShortToggle from 'web/components/widgets/short-toggle'
+import { removeUndefinedProps } from 'common/util/object'
export default function CreateDateDocPage() {
const user = useUser()
@@ -26,6 +28,7 @@ export default function CreateDateDocPage() {
const title = `${user?.name}'s Date Doc`
const subtitle = 'Manifold dating docs'
const [birthday, setBirthday] = useState(undefined)
+ const [createMarket, setCreateMarket] = useState(true)
const [question, setQuestion] = useState(
'Will I find a partner in the next 3 months?'
)
@@ -38,7 +41,11 @@ export default function CreateDateDocPage() {
const birthdayTime = birthday ? dayjs(birthday).valueOf() : undefined
const isValid =
- user && birthday && editor && editor.isEmpty === false && question
+ user &&
+ birthday &&
+ editor &&
+ editor.isEmpty === false &&
+ (question || !createMarket)
async function saveDateDoc() {
if (!user || !editor || !birthdayTime) return
@@ -46,15 +53,15 @@ export default function CreateDateDocPage() {
const newPost: Omit<
DateDoc,
'id' | 'creatorId' | 'createdTime' | 'slug' | 'contractSlug'
- > & { question: string } = {
+ > & { question?: string } = removeUndefinedProps({
title,
subtitle,
content: editor.getJSON(),
bounty: 0,
birthday: birthdayTime,
type: 'date-doc',
- question,
- }
+ question: createMarket ? question : undefined,
+ })
const result = await createPost(newPost)
@@ -106,9 +113,13 @@ export default function CreateDateDocPage() {
-
- Finally, we'll create an (unlisted) prediction market!
-
+
+ setCreateMarket(on)}
+ />
+ Create an (unlisted) prediction market attached to the date doc
+