diff --git a/functions/src/on-create-user.ts b/functions/src/on-create-user.ts index f23d2f5b..71425f2c 100644 --- a/functions/src/on-create-user.ts +++ b/functions/src/on-create-user.ts @@ -4,8 +4,14 @@ import * as utc from 'dayjs/plugin/utc' dayjs.extend(utc) import { getPrivateUser } from './utils' -import { User } from '../../common/user' -import { sendPersonalFollowupEmail, sendWelcomeEmail } from './emails' +import { User } from 'common/user' +import { + sendCreatorGuideEmail, + sendInterestingMarketsEmail, + sendPersonalFollowupEmail, + sendWelcomeEmail, +} from './emails' +import { getTrendingContracts } from './weekly-markets-emails' export const onCreateUser = functions .runWith({ secrets: ['MAILGUN_KEY'] }) @@ -19,4 +25,21 @@ export const onCreateUser = functions const followupSendTime = dayjs().add(48, 'hours').toString() await sendPersonalFollowupEmail(user, privateUser, followupSendTime) + + const guideSendTime = dayjs().add(96, 'hours').toString() + await sendCreatorGuideEmail(user, privateUser, guideSendTime) + + // skip email if weekly email is about to go out + const day = dayjs().utc().day() + if (day === 0 || (day === 1 && dayjs().utc().hour() <= 19)) return + + const contracts = await getTrendingContracts() + const marketsSendTime = dayjs().add(24, 'hours').toString() + + await sendInterestingMarketsEmail( + user, + privateUser, + contracts, + marketsSendTime + ) }) diff --git a/web/components/contract/contract-tabs.tsx b/web/components/contract/contract-tabs.tsx index b5895f60..c1ff2186 100644 --- a/web/components/contract/contract-tabs.tsx +++ b/web/components/contract/contract-tabs.tsx @@ -1,5 +1,5 @@ import { Bet } from 'common/bet' -import { Contract, CPMMBinaryContract } from 'common/contract' +import { Contract } from 'common/contract' import { ContractComment } from 'common/comment' import { PAST_BETS, User } from 'common/user' import { @@ -11,13 +11,9 @@ import { ContractBetsTable, BetsSummary } from '../bets-list' import { Spacer } from '../layout/spacer' import { Tabs } from '../layout/tabs' import { Col } from '../layout/col' -import { tradingAllowed } from 'web/lib/firebase/contracts' import { CommentTipMap } from 'web/hooks/use-tip-txns' import { useComments } from 'web/hooks/use-comments' import { useLiquidity } from 'web/hooks/use-liquidity' -import { BetSignUpPrompt } from '../sign-up-prompt' -import { PlayMoneyDisclaimer } from '../play-money-disclaimer' -import BetButton from '../bet-button' import { capitalize } from 'lodash' import { DEV_HOUSE_LIQUIDITY_PROVIDER_ID, @@ -123,44 +119,28 @@ export function ContractTabs(props: { ) return ( - <> - - {!user ? ( - - - - - ) : ( - outcomeType === 'BINARY' && - tradingAllowed(contract) && ( - - ) - )} - + ) } diff --git a/web/components/feed/feed-answer-comment-group.tsx b/web/components/feed/feed-answer-comment-group.tsx index 958b6d6d..51f1bbc2 100644 --- a/web/components/feed/feed-answer-comment-group.tsx +++ b/web/components/feed/feed-answer-comment-group.tsx @@ -11,7 +11,6 @@ import clsx from 'clsx' import { ContractCommentInput, FeedComment, - getMostRecentCommentableBet, } from 'web/components/feed/feed-comments' import { CopyLinkDateTimeComponent } from 'web/components/feed/copy-link-date-time' import { useRouter } from 'next/router' @@ -49,28 +48,6 @@ export function FeedAnswerCommentGroup(props: { const answerElementId = `answer-${answer.id}` const commentsByCurrentUser = (user && commentsByUserId[user.id]) ?? [] - const isFreeResponseContractPage = !!commentsByCurrentUser - const mostRecentCommentableBet = getMostRecentCommentableBet( - betsByCurrentUser, - commentsByCurrentUser, - user, - answer.number.toString() - ) - const [usersMostRecentBetTimeAtLoad, setUsersMostRecentBetTimeAtLoad] = - useState( - !user ? undefined : mostRecentCommentableBet?.createdTime ?? 0 - ) - - useEffect(() => { - if (user && usersMostRecentBetTimeAtLoad === undefined) - setUsersMostRecentBetTimeAtLoad( - mostRecentCommentableBet?.createdTime ?? 0 - ) - }, [ - mostRecentCommentableBet?.createdTime, - user, - usersMostRecentBetTimeAtLoad, - ]) const scrollAndOpenReplyInput = useEvent( (comment?: ContractComment, answer?: Answer) => { @@ -85,19 +62,6 @@ export function FeedAnswerCommentGroup(props: { } ) - useEffect(() => { - // Only show one comment input for a bet at a time - if ( - betsByCurrentUser.length > 1 && - // inputRef?.textContent?.length === 0 && //TODO: editor.isEmpty - betsByCurrentUser.sort((a, b) => b.createdTime - a.createdTime)[0] - ?.outcome !== answer.number.toString() - ) - setShowReply(false) - // Even if we pass memoized bets this still runs on every render, which we don't want - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [betsByCurrentUser.length, user, answer.number]) - useEffect(() => { if (router.asPath.endsWith(`#${answerElementId}`)) { setHighlighted(true) @@ -105,10 +69,7 @@ export function FeedAnswerCommentGroup(props: { }, [answerElementId, router.asPath]) return ( - + - - {isFreeResponseContractPage && ( -
- -
- )} - - {isFreeResponseContractPage && ( -