Delete some unused code
This commit is contained in:
parent
deb8397ee9
commit
0ab82a7bd4
|
@ -9,12 +9,10 @@ import {
|
||||||
getUserBetContractsQuery,
|
getUserBetContractsQuery,
|
||||||
listAllContracts,
|
listAllContracts,
|
||||||
trendingContractsQuery,
|
trendingContractsQuery,
|
||||||
getContractsQuery,
|
|
||||||
} from 'web/lib/firebase/contracts'
|
} from 'web/lib/firebase/contracts'
|
||||||
import { QueryClient, useQuery, useQueryClient } from 'react-query'
|
import { QueryClient, useQuery, useQueryClient } from 'react-query'
|
||||||
import { MINUTE_MS } from 'common/util/time'
|
import { MINUTE_MS } from 'common/util/time'
|
||||||
import { query, limit } from 'firebase/firestore'
|
import { query, limit } from 'firebase/firestore'
|
||||||
import { Sort } from 'web/components/contract-search'
|
|
||||||
import { dailyScoreIndex } from 'web/lib/service/algolia'
|
import { dailyScoreIndex } from 'web/lib/service/algolia'
|
||||||
import { CPMMBinaryContract } from 'common/contract'
|
import { CPMMBinaryContract } from 'common/contract'
|
||||||
import { zipObject } from 'lodash'
|
import { zipObject } from 'lodash'
|
||||||
|
@ -66,19 +64,6 @@ export const useTrendingContracts = (maxContracts: number) => {
|
||||||
return result.data
|
return result.data
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useContractsQuery = (
|
|
||||||
sort: Sort,
|
|
||||||
maxContracts: number,
|
|
||||||
filters: { groupSlug?: string } = {},
|
|
||||||
visibility?: 'public'
|
|
||||||
) => {
|
|
||||||
const result = useFirestoreQueryData(
|
|
||||||
['contracts-query', sort, maxContracts, filters],
|
|
||||||
getContractsQuery(sort, maxContracts, filters, visibility)
|
|
||||||
)
|
|
||||||
return result.data
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useInactiveContracts = () => {
|
export const useInactiveContracts = () => {
|
||||||
const [contracts, setContracts] = useState<Contract[] | undefined>()
|
const [contracts, setContracts] = useState<Contract[] | undefined>()
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import { Bet } from 'common/bet'
|
||||||
import { Comment } from 'common/comment'
|
import { Comment } from 'common/comment'
|
||||||
import { ENV_CONFIG } from 'common/envs/constants'
|
import { ENV_CONFIG } from 'common/envs/constants'
|
||||||
import { getBinaryProb } from 'common/contract-details'
|
import { getBinaryProb } from 'common/contract-details'
|
||||||
import { Sort } from 'web/components/contract-search'
|
|
||||||
|
|
||||||
export const contracts = coll<Contract>('contracts')
|
export const contracts = coll<Contract>('contracts')
|
||||||
|
|
||||||
|
@ -321,51 +320,6 @@ export const getTopGroupContracts = async (
|
||||||
return await getValues<Contract>(creatorContractsQuery)
|
return await getValues<Contract>(creatorContractsQuery)
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortToField = {
|
|
||||||
newest: 'createdTime',
|
|
||||||
score: 'popularityScore',
|
|
||||||
'most-traded': 'volume',
|
|
||||||
'24-hour-vol': 'volume24Hours',
|
|
||||||
'prob-change-day': 'probChanges.day',
|
|
||||||
'last-updated': 'lastUpdated',
|
|
||||||
liquidity: 'totalLiquidity',
|
|
||||||
'close-date': 'closeTime',
|
|
||||||
'resolve-date': 'resolutionTime',
|
|
||||||
'prob-descending': 'prob',
|
|
||||||
'prob-ascending': 'prob',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
const sortToDirection = {
|
|
||||||
newest: 'desc',
|
|
||||||
score: 'desc',
|
|
||||||
'most-traded': 'desc',
|
|
||||||
'24-hour-vol': 'desc',
|
|
||||||
'prob-change-day': 'desc',
|
|
||||||
'last-updated': 'desc',
|
|
||||||
liquidity: 'desc',
|
|
||||||
'close-date': 'asc',
|
|
||||||
'resolve-date': 'desc',
|
|
||||||
'prob-ascending': 'asc',
|
|
||||||
'prob-descending': 'desc',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
export const getContractsQuery = (
|
|
||||||
sort: Sort,
|
|
||||||
maxItems: number,
|
|
||||||
filters: { groupSlug?: string } = {},
|
|
||||||
visibility?: 'public'
|
|
||||||
) => {
|
|
||||||
const { groupSlug } = filters
|
|
||||||
return query(
|
|
||||||
contracts,
|
|
||||||
where('isResolved', '==', false),
|
|
||||||
...(visibility ? [where('visibility', '==', visibility)] : []),
|
|
||||||
...(groupSlug ? [where('groupSlugs', 'array-contains', groupSlug)] : []),
|
|
||||||
orderBy(sortToField[sort], sortToDirection[sort]),
|
|
||||||
limit(maxItems)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getRecommendedContracts = async (
|
export const getRecommendedContracts = async (
|
||||||
contract: Contract,
|
contract: Contract,
|
||||||
excludeBettorId: string,
|
excludeBettorId: string,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user