diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index a8bd43f9..b4538767 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -1,7 +1,7 @@ import Link from 'next/link' import { keyBy, groupBy, mapValues, sortBy, partition, sumBy } from 'lodash' import dayjs from 'dayjs' -import { useEffect, useMemo, useState } from 'react' +import { useMemo, useState } from 'react' import clsx from 'clsx' import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/solid' @@ -34,8 +34,6 @@ import { resolvedPayout, getContractBetNullMetrics, } from 'common/calculate' -import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render' -import { trackLatency } from 'web/lib/firebase/tracking' import { NumericContract } from 'common/contract' import { formatNumericProbability } from 'common/pseudo-numeric' import { useUser } from 'web/hooks/use-user' @@ -84,13 +82,6 @@ export function BetsList(props: { user: User }) { const start = page * CONTRACTS_PER_PAGE const end = start + CONTRACTS_PER_PAGE - const getTime = useTimeSinceFirstRender() - useEffect(() => { - if (bets && contractsById && signedInUser) { - trackLatency(signedInUser.id, 'portfolio', getTime()) - } - }, [signedInUser, bets, contractsById, getTime]) - if (!bets || !contractsById) { return } diff --git a/web/hooks/use-time-since-first-render.ts b/web/hooks/use-time-since-first-render.ts deleted file mode 100644 index da132146..00000000 --- a/web/hooks/use-time-since-first-render.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { useCallback, useEffect, useRef } from 'react' - -export function useTimeSinceFirstRender() { - const startTimeRef = useRef(0) - useEffect(() => { - startTimeRef.current = Date.now() - }, []) - - return useCallback(() => { - if (!startTimeRef.current) return 0 - return Date.now() - startTimeRef.current - }, []) -} diff --git a/web/lib/firebase/tracking.ts b/web/lib/firebase/tracking.ts deleted file mode 100644 index d1828e01..00000000 --- a/web/lib/firebase/tracking.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { doc, collection, setDoc } from 'firebase/firestore' - -import { db } from './init' -import { ClickEvent, LatencyEvent, View } from 'common/tracking' - -export async function trackView(userId: string, contractId: string) { - const ref = doc(collection(db, 'private-users', userId, 'views')) - - const view: View = { - contractId, - timestamp: Date.now(), - } - - return await setDoc(ref, view) -} - -export async function trackClick(userId: string, contractId: string) { - const ref = doc(collection(db, 'private-users', userId, 'events')) - - const clickEvent: ClickEvent = { - type: 'click', - contractId, - timestamp: Date.now(), - } - - return await setDoc(ref, clickEvent) -} - -export async function trackLatency( - userId: string, - type: 'feed' | 'portfolio', - latency: number -) { - const ref = doc(collection(db, 'private-users', userId, 'latency')) - - const latencyEvent: LatencyEvent = { - type, - latency, - timestamp: Date.now(), - } - - return await setDoc(ref, latencyEvent) -}