Default feed skips annoying markets
This commit is contained in:
parent
e4064b89ff
commit
43ce91a537
|
@ -25,6 +25,22 @@ export const getAllContractInfo = async () => {
|
||||||
return { contracts, recentComments, folds }
|
return { contracts, recentComments, folds }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultSkippedTags = [
|
||||||
|
'meta',
|
||||||
|
'test',
|
||||||
|
'trolling',
|
||||||
|
'spam',
|
||||||
|
'transaction',
|
||||||
|
'personal',
|
||||||
|
]
|
||||||
|
const includedWithDefaultFeed = (contract: Contract) => {
|
||||||
|
const { tags } = contract
|
||||||
|
|
||||||
|
if (tags.length === 0) return false
|
||||||
|
if (tags.some((tag) => defaultSkippedTags.includes(tag))) return false
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
export const useFilterYourContracts = (
|
export const useFilterYourContracts = (
|
||||||
user: User | undefined | null,
|
user: User | undefined | null,
|
||||||
folds: Fold[],
|
folds: Fold[],
|
||||||
|
@ -54,8 +70,9 @@ export const useFilterYourContracts = (
|
||||||
// Show no contracts before your info is loaded.
|
// Show no contracts before your info is loaded.
|
||||||
let yourContracts: Contract[] = []
|
let yourContracts: Contract[] = []
|
||||||
if (yourBetContracts && followedFoldIds) {
|
if (yourBetContracts && followedFoldIds) {
|
||||||
// Show all contracts if no folds are followed.
|
// Show default contracts if no folds are followed.
|
||||||
if (followedFoldIds.length === 0) yourContracts = contracts
|
if (followedFoldIds.length === 0)
|
||||||
|
yourContracts = contracts.filter(includedWithDefaultFeed)
|
||||||
else
|
else
|
||||||
yourContracts = contracts.filter(
|
yourContracts = contracts.filter(
|
||||||
(contract) =>
|
(contract) =>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user