Local search filters on groups, exclude contractIds
This commit is contained in:
parent
60ebadbbe5
commit
ced404eb74
|
@ -20,6 +20,8 @@ export default function ContractSearchFirestore(props: {
|
||||||
additionalFilter?: {
|
additionalFilter?: {
|
||||||
creatorId?: string
|
creatorId?: string
|
||||||
tag?: string
|
tag?: string
|
||||||
|
excludeContractIds?: string[]
|
||||||
|
groupSlug?: string
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const contracts = useContracts()
|
const contracts = useContracts()
|
||||||
|
@ -63,7 +65,7 @@ export default function ContractSearchFirestore(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalFilter) {
|
if (additionalFilter) {
|
||||||
const { creatorId, tag } = additionalFilter
|
const { creatorId, tag, groupSlug, excludeContractIds } = additionalFilter
|
||||||
|
|
||||||
if (creatorId) {
|
if (creatorId) {
|
||||||
matches = matches.filter((c) => c.creatorId === creatorId)
|
matches = matches.filter((c) => c.creatorId === creatorId)
|
||||||
|
@ -74,6 +76,14 @@ export default function ContractSearchFirestore(props: {
|
||||||
c.lowercaseTags.includes(tag.toLowerCase())
|
c.lowercaseTags.includes(tag.toLowerCase())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (groupSlug) {
|
||||||
|
matches = matches.filter((c) => c.groupSlugs?.includes(groupSlug))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excludeContractIds) {
|
||||||
|
matches = matches.filter((c) => !excludeContractIds.includes(c.id))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matches = matches.slice(0, MAX_CONTRACTS_RENDERED)
|
matches = matches.slice(0, MAX_CONTRACTS_RENDERED)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user