From 80622dc7ee59269d7d69100984f219a2243184a0 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Thu, 6 Oct 2022 18:23:27 -0500 Subject: [PATCH 1/3] liquidity sort --- web/components/contract-search.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/components/contract-search.tsx b/web/components/contract-search.tsx index 78eacd36..8d871d65 100644 --- a/web/components/contract-search.tsx +++ b/web/components/contract-search.tsx @@ -48,6 +48,7 @@ export const SORTS = [ { label: 'Daily trending', value: 'daily-score' }, { label: '24h volume', value: '24-hour-vol' }, { label: 'Most popular', value: 'most-popular' }, + { label: 'Liquidity', value: 'liquidity' }, { label: 'Last updated', value: 'last-updated' }, { label: 'Closing soon', value: 'close-date' }, { label: 'Resolve date', value: 'resolve-date' }, From 77e0631ea45aba6cff3a1b1e3d7268873faacabd Mon Sep 17 00:00:00 2001 From: James Grugett Date: Thu, 6 Oct 2022 18:03:44 -0500 Subject: [PATCH 2/3] Limit order trade log: '/' to 'of'. Remove 'of' in 'of YES'. --- web/components/feed/feed-bets.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/components/feed/feed-bets.tsx b/web/components/feed/feed-bets.tsx index 900265cb..e164f6fa 100644 --- a/web/components/feed/feed-bets.tsx +++ b/web/components/feed/feed-bets.tsx @@ -64,11 +64,11 @@ export function BetStatusText(props: { }, [challengeSlug, contract.id]) const bought = amount >= 0 ? 'bought' : 'sold' + const money = formatMoney(Math.abs(amount)) const outOfTotalAmount = bet.limitProb !== undefined && bet.orderAmount !== undefined - ? ` / ${formatMoney(bet.orderAmount)}` + ? ` of ${bet.isCancelled ? money : formatMoney(bet.orderAmount)}` : '' - const money = formatMoney(Math.abs(amount)) const hadPoolMatch = (bet.limitProb === undefined || @@ -105,7 +105,6 @@ export function BetStatusText(props: { {!hideOutcome && ( <> {' '} - of{' '} Date: Thu, 6 Oct 2022 18:36:27 -0500 Subject: [PATCH 3/3] Date doc: Toggle to disable creating a prediction market --- functions/src/create-post.ts | 30 +++++++++++++++++------------- web/pages/date-docs/[username].tsx | 20 +++++++++++--------- web/pages/date-docs/create.tsx | 26 +++++++++++++++++++------- 3 files changed, 47 insertions(+), 29 deletions(-) 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 +