From 589bf9651da9a0a3155b70af68b2e9c8bf2f18f5 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Tue, 20 Sep 2022 17:40:28 -0500 Subject: [PATCH 1/3] Track viewing full daily movers --- web/pages/daily-movers.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/pages/daily-movers.tsx b/web/pages/daily-movers.tsx index a925a425..3b709d89 100644 --- a/web/pages/daily-movers.tsx +++ b/web/pages/daily-movers.tsx @@ -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 ( From be4def49a202e245b4afa431d3b75bb08d647973 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Tue, 20 Sep 2022 15:53:35 -0700 Subject: [PATCH 2/3] Kill counts of comments and trades on contract page (#900) --- web/components/contract/contract-tabs.tsx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/web/components/contract/contract-tabs.tsx b/web/components/contract/contract-tabs.tsx index e3153dbb..a9953bbe 100644 --- a/web/components/contract/contract-tabs.tsx +++ b/web/components/contract/contract-tabs.tsx @@ -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 && ( Date: Tue, 20 Sep 2022 15:58:47 -0700 Subject: [PATCH 3/3] Don't always require tips to render comments (#898) --- web/components/contract/contract-leaderboard.tsx | 5 +---- web/components/contract/contract-tabs.tsx | 6 +++--- web/components/feed/feed-answer-comment-group.tsx | 2 +- web/components/feed/feed-comments.tsx | 6 +++--- web/pages/[username]/[contractSlug].tsx | 5 ----- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/web/components/contract/contract-leaderboard.tsx b/web/components/contract/contract-leaderboard.tsx index a863f1bf..4d25ffa4 100644 --- a/web/components/contract/contract-leaderboard.tsx +++ b/web/components/contract/contract-leaderboard.tsx @@ -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: { diff --git a/web/components/contract/contract-tabs.tsx b/web/components/contract/contract-tabs.tsx index a9953bbe..b1364fbf 100644 --- a/web/components/contract/contract-tabs.tsx +++ b/web/components/contract/contract-tabs.tsx @@ -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 = diff --git a/web/components/feed/feed-answer-comment-group.tsx b/web/components/feed/feed-answer-comment-group.tsx index 84f1e8c5..27f0f731 100644 --- a/web/components/feed/feed-answer-comment-group.tsx +++ b/web/components/feed/feed-answer-comment-group.tsx @@ -106,7 +106,7 @@ export function FeedAnswerCommentGroup(props: { indent={true} contract={contract} comment={comment} - tips={tips[comment.id]} + tips={tips[comment.id] ?? {}} onReplyClick={scrollAndOpenReplyInput} /> ))} diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index 027b377f..acb48ec1 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -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 /> - + {tips && } {onReplyClick && (