Skip to content

Commit

Permalink
Language filter only on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
ikprk committed Jul 29, 2024
1 parent 3ea6e5d commit 6e0cce0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 21 deletions.
44 changes: 28 additions & 16 deletions packages/atlas/src/config/contentFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,31 @@ export const singlePublicCryptoVideoFilter: VideoWhereInput = {
},
}

export const getPublicCryptoVideoFilter = (extraWhere?: VideoWhereInput): VideoWhereInput => ({
OR: [
{
...singlePublicCryptoVideoFilter,
isShort_not_eq: true,
isShortDerived_isNull: true,
...(extraWhere ?? {}),
},
{
...singlePublicCryptoVideoFilter,
isShort_isNull: true,
isShortDerived_isNull: true,
...(extraWhere ?? {}),
},
],
})
export const getPublicCryptoVideoFilter = (
extraWhere?: VideoWhereInput,
enableLanguageFiltering = false
): VideoWhereInput => {
const singlePublicCryptoVideoFilterCopy = {
...singlePublicCryptoVideoFilter,
}
if (!enableLanguageFiltering) {
delete singlePublicCryptoVideoFilterCopy.orionLanguage_in
}

return {
OR: [
{
...singlePublicCryptoVideoFilterCopy,
isShort_not_eq: true,
isShortDerived_isNull: true,
...(extraWhere ?? {}),
},
{
...singlePublicCryptoVideoFilterCopy,
isShort_isNull: true,
isShortDerived_isNull: true,
...(extraWhere ?? {}),
},
],
}
}
13 changes: 8 additions & 5 deletions packages/atlas/src/views/viewer/HomeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,15 @@ const useHomeVideos = (categories?: string[]) => {
const { columns, fetchMore, pageInfo, tiles } = useInfiniteVideoGrid({
query: GetBasicVideosConnectionLightweightDocument,
variables: {
where: getPublicCryptoVideoFilter({
id_not_in: avoidIds,
category: {
id_in: categories,
where: getPublicCryptoVideoFilter(
{
id_not_in: avoidIds,
category: {
id_in: categories,
},
},
}),
true
),
orderBy: VideoOrderByInput.VideoRelevanceDesc,
},
options: {
Expand Down

0 comments on commit 6e0cce0

Please sign in to comment.