Merge branch 'manifoldmarkets:main' into main
This commit is contained in:
commit
f9870ba512
|
@ -5,7 +5,6 @@ import { Contract } from 'common/contract'
|
|||
import { formatMoney } from 'common/util/format'
|
||||
import { groupBy, mapValues, sumBy, sortBy, keyBy } from 'lodash'
|
||||
import { useState, useMemo, useEffect } from 'react'
|
||||
import { CommentTipMap } from 'web/hooks/use-tip-txns'
|
||||
import { listUsers, User } from 'web/lib/firebase/users'
|
||||
import { FeedBet } from '../feed/feed-bets'
|
||||
import { FeedComment } from '../feed/feed-comments'
|
||||
|
@ -66,9 +65,8 @@ export function ContractTopTrades(props: {
|
|||
contract: Contract
|
||||
bets: Bet[]
|
||||
comments: ContractComment[]
|
||||
tips: CommentTipMap
|
||||
}) {
|
||||
const { contract, bets, comments, tips } = props
|
||||
const { contract, bets, comments } = props
|
||||
const commentsById = keyBy(comments, 'id')
|
||||
const betsById = keyBy(bets, 'id')
|
||||
|
||||
|
@ -105,7 +103,6 @@ export function ContractTopTrades(props: {
|
|||
<FeedComment
|
||||
contract={contract}
|
||||
comment={commentsById[topCommentId]}
|
||||
tips={tips[topCommentId]}
|
||||
/>
|
||||
</div>
|
||||
<Spacer h={16} />
|
||||
|
|
|
@ -11,9 +11,9 @@ import { ContractBetsTable, BetsSummary } from '../bets-list'
|
|||
import { Spacer } from '../layout/spacer'
|
||||
import { Tabs } from '../layout/tabs'
|
||||
import { Col } from '../layout/col'
|
||||
import { CommentTipMap } from 'web/hooks/use-tip-txns'
|
||||
import { useComments } from 'web/hooks/use-comments'
|
||||
import { useLiquidity } from 'web/hooks/use-liquidity'
|
||||
import { useTipTxns } from 'web/hooks/use-tip-txns'
|
||||
import { capitalize } from 'lodash'
|
||||
import {
|
||||
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
|
@ -26,12 +26,12 @@ export function ContractTabs(props: {
|
|||
user: User | null | undefined
|
||||
bets: Bet[]
|
||||
comments: ContractComment[]
|
||||
tips: CommentTipMap
|
||||
}) {
|
||||
const { contract, user, bets, tips } = props
|
||||
const { contract, user, bets } = props
|
||||
const { outcomeType } = contract
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const tips = useTipTxns({ contractId: contract.id })
|
||||
const lps = useLiquidity(contract.id)
|
||||
|
||||
const userBets =
|
||||
|
@ -47,9 +47,7 @@ export function ContractTabs(props: {
|
|||
l.amount > 0
|
||||
)
|
||||
|
||||
// Load comments here, so the badge count will be correct
|
||||
const updatedComments = useComments(contract.id)
|
||||
const comments = updatedComments ?? props.comments
|
||||
const comments = useComments(contract.id) ?? props.comments
|
||||
|
||||
const betActivity = lps != null && (
|
||||
<ContractBetsActivity
|
||||
|
@ -107,18 +105,10 @@ export function ContractTabs(props: {
|
|||
|
||||
return (
|
||||
<Tabs
|
||||
currentPageForAnalytics="contract"
|
||||
currentPageForAnalytics={'contract'}
|
||||
tabs={[
|
||||
{
|
||||
title: 'Comments',
|
||||
content: commentActivity,
|
||||
badge: `${comments.length}`,
|
||||
},
|
||||
{
|
||||
title: capitalize(PAST_BETS),
|
||||
content: betActivity,
|
||||
badge: `${visibleBets.length + visibleLps.length}`,
|
||||
},
|
||||
{ title: 'Comments', content: commentActivity },
|
||||
{ title: capitalize(PAST_BETS), content: betActivity },
|
||||
...(!user || !userBets?.length
|
||||
? []
|
||||
: [
|
||||
|
|
|
@ -106,7 +106,7 @@ export function FeedAnswerCommentGroup(props: {
|
|||
indent={true}
|
||||
contract={contract}
|
||||
comment={comment}
|
||||
tips={tips[comment.id]}
|
||||
tips={tips[comment.id] ?? {}}
|
||||
onReplyClick={scrollAndOpenReplyInput}
|
||||
/>
|
||||
))}
|
||||
|
|
|
@ -47,7 +47,7 @@ export function FeedCommentThread(props: {
|
|||
indent={commentIdx != 0}
|
||||
contract={contract}
|
||||
comment={comment}
|
||||
tips={tips[comment.id]}
|
||||
tips={tips[comment.id] ?? {}}
|
||||
onReplyClick={scrollAndOpenReplyInput}
|
||||
/>
|
||||
))}
|
||||
|
@ -74,7 +74,7 @@ export function FeedCommentThread(props: {
|
|||
export function FeedComment(props: {
|
||||
contract: Contract
|
||||
comment: ContractComment
|
||||
tips: CommentTips
|
||||
tips?: CommentTips
|
||||
indent?: boolean
|
||||
onReplyClick?: (comment: ContractComment) => void
|
||||
}) {
|
||||
|
@ -170,7 +170,7 @@ export function FeedComment(props: {
|
|||
smallImage
|
||||
/>
|
||||
<Row className="mt-2 items-center gap-6 text-xs text-gray-500">
|
||||
<Tipper comment={comment} tips={tips ?? {}} />
|
||||
{tips && <Tipper comment={comment} tips={tips} />}
|
||||
{onReplyClick && (
|
||||
<button
|
||||
className="font-bold hover:underline"
|
||||
|
|
|
@ -31,7 +31,6 @@ import { useBets } from 'web/hooks/use-bets'
|
|||
import { CPMMBinaryContract } from 'common/contract'
|
||||
import { AlertBox } from 'web/components/alert-box'
|
||||
import { useTracking } from 'web/hooks/use-tracking'
|
||||
import { useTipTxns } from 'web/hooks/use-tip-txns'
|
||||
import { useSaveReferral } from 'web/hooks/use-save-referral'
|
||||
import { User } from 'common/user'
|
||||
import { ContractComment } from 'common/comment'
|
||||
|
@ -196,8 +195,6 @@ export function ContractPageContent(
|
|||
[bets]
|
||||
)
|
||||
|
||||
const tips = useTipTxns({ contractId: contract.id })
|
||||
|
||||
const [showConfetti, setShowConfetti] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -278,7 +275,6 @@ export function ContractPageContent(
|
|||
contract={contract}
|
||||
bets={bets}
|
||||
comments={comments}
|
||||
tips={tips}
|
||||
/>
|
||||
</div>
|
||||
<Spacer h={12} />
|
||||
|
@ -289,7 +285,6 @@ export function ContractPageContent(
|
|||
contract={contract}
|
||||
user={user}
|
||||
bets={bets}
|
||||
tips={tips}
|
||||
comments={comments}
|
||||
/>
|
||||
{!user ? (
|
||||
|
|
|
@ -3,6 +3,7 @@ import { Col } from 'web/components/layout/col'
|
|||
import { Page } from 'web/components/page'
|
||||
import { Title } from 'web/components/title'
|
||||
import { useProbChangesAlgolia } from 'web/hooks/use-prob-changes'
|
||||
import { useTracking } from 'web/hooks/use-tracking'
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
|
||||
export default function DailyMovers() {
|
||||
|
@ -10,6 +11,8 @@ export default function DailyMovers() {
|
|||
|
||||
const changes = useProbChangesAlgolia(user?.id ?? '')
|
||||
|
||||
useTracking('view daily movers')
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<Col className="pm:mx-10 gap-4 sm:px-4 sm:pb-4">
|
||||
|
|
Loading…
Reference in New Issue
Block a user