This repository was archived by the owner on May 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +30
-7
lines changed Expand file tree Collapse file tree 6 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export default function FavoriteCookbooks() {
16
16
const { data, loading, error } = useQuery < {
17
17
user : { cookbooks : AssistantCookbook [ ] } ;
18
18
} > ( GET_USER_SUBSCRIBED_COOKBOOKS , {
19
- variables : GET_USER_SUBSCRIBED_COOKBOOKS_VARIABLES ,
19
+ variables : {
20
+ ...GET_USER_SUBSCRIBED_COOKBOOKS_VARIABLES ,
21
+ name : filters . searchTerm ,
22
+ } ,
20
23
} ) ;
21
24
22
25
const userCookbooks = data ?. user ?. cookbooks || [ ] ;
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export default function MySnippets() {
16
16
const { data, loading, error } = useQuery < {
17
17
user : { recipes : AssistantRecipeWithStats [ ] } ;
18
18
} > ( GET_USER_SUBSCRIBED_RECIPES , {
19
- variables : GET_USER_SUBSCRIBED_RECIPES_VARIABLES ,
19
+ variables : {
20
+ ...GET_USER_SUBSCRIBED_RECIPES_VARIABLES ,
21
+ name : filters . searchTerm ,
22
+ } ,
20
23
} ) ;
21
24
22
25
const userFavoriteRecipes = data ?. user ?. recipes || [ ] ;
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export default function MyCookbooks() {
16
16
const { data, loading, error } = useQuery < {
17
17
user : { cookbooks : AssistantCookbook [ ] } ;
18
18
} > ( GET_USER_COOKBOOKS , {
19
- variables : GET_USER_COOKBOOKS_VARIABLES ,
19
+ variables : {
20
+ ...GET_USER_COOKBOOKS_VARIABLES ,
21
+ name : filters . searchTerm ,
22
+ } ,
20
23
} ) ;
21
24
22
25
const userCookbooks = data ?. user ?. cookbooks || [ ] ;
Original file line number Diff line number Diff line change @@ -16,7 +16,12 @@ export default function MySnippets() {
16
16
const { data, loading, error } = useQuery < {
17
17
user : { recipes : AssistantRecipeWithStats [ ] } ;
18
18
} > ( GET_USER_RECIPES , {
19
- variables : GET_USER_RECIPES_VARIABLES ,
19
+ variables : {
20
+ ...GET_USER_RECIPES_VARIABLES ,
21
+ name : filters . searchTerm ,
22
+ language : filters . language ,
23
+ tag : filters . tags ,
24
+ } ,
20
25
} ) ;
21
26
22
27
const userRecipes = data ?. user ?. recipes || [ ] ;
Original file line number Diff line number Diff line change @@ -16,15 +16,17 @@ export default function TeamCookbooks() {
16
16
const { data, loading, error } = useQuery < {
17
17
cookbooks : AssistantCookbook [ ] ;
18
18
} > ( GET_SHARED_COOKBOOKS , {
19
- variables : GET_SHARED_COOKBOOKS_VARIABLES ,
19
+ variables : {
20
+ ...GET_SHARED_COOKBOOKS_VARIABLES ,
21
+ name : filters . searchTerm ,
22
+ } ,
20
23
} ) ;
21
24
22
25
const userCookbooks = data ?. cookbooks || [ ] ;
23
26
24
27
// check the recipe against the search filters
25
28
const filteredCookbooks = userCookbooks . filter ( ( cookbook ) => {
26
29
if ( ! filterBy . name ( filters , cookbook . name ) ) return false ;
27
- // if (!filterBy.language(filters, cookbook.language)) return false;
28
30
if ( ! filterBy . privacy ( filters , cookbook . isPublic ) ) return false ;
29
31
if ( ! filterBy . isSubscribed ( filters , cookbook . isSubscribed ) ) return false ;
30
32
return true ;
Original file line number Diff line number Diff line change @@ -9,14 +9,21 @@ import SnippetTableEmptyFiltereed from 'renderer/components/SnippetTable/Snippet
9
9
import SnippetTable from 'renderer/components/SnippetTable/SnippetTable' ;
10
10
import filterBy from 'renderer/components/Filters/filterBy' ;
11
11
import { useFilters } from 'renderer/components/FiltersContext' ;
12
+ import { Language } from 'renderer/lib/constants' ;
12
13
13
14
export default function TeamSnippets ( ) {
14
15
const filters = useFilters ( ) ;
15
16
16
17
const { data, loading, error } = useQuery < {
17
18
recipes : AssistantRecipeWithStats [ ] ;
18
19
} > ( GET_SHARED_RECIPES , {
19
- variables : GET_SHARED_RECIPES_VARIABLES ,
20
+ variables : {
21
+ ...GET_SHARED_RECIPES_VARIABLES ,
22
+ name : filters . searchTerm ,
23
+ languages :
24
+ filters . language !== Language . ALL_LANGUAGES ? [ filters . language ] : null ,
25
+ tag : filters . tags ,
26
+ } ,
20
27
} ) ;
21
28
22
29
const teamRecipes = data ?. recipes || [ ] ;
You can’t perform that action at this time.
0 commit comments