This repository was archived by the owner on Dec 19, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,17 @@ function SearchResultsView () {
13
13
const [ appState , dispatch ] = useStateValue ( )
14
14
15
15
const query = useQuery ( ) . get ( 'q' )
16
- const queryOk = query . length >= 2
16
+ const queryOk = query . length >= 1
17
17
18
18
if ( ! queryOk ) return < Redirect to = '/' />
19
19
20
+ let programs = appState . programs
21
+ if ( query ) {
22
+ programs = programs . filter ( ( { payload : { value : { name, type, address } } } ) =>
23
+ name . includes ( query ) || type . includes ( query ) || address . toString ( ) . includes ( query )
24
+ )
25
+ }
26
+
20
27
return (
21
28
< Pane display = 'flex' justifyContent = 'center' >
22
29
< Pane
@@ -28,10 +35,10 @@ function SearchResultsView () {
28
35
>
29
36
< Pane borderBottom = 'default' >
30
37
< Heading size = { 600 } marginBottom = { majorScale ( 1 ) } >
31
- { appState . programs . length } programs found
38
+ { programs . length } programs found
32
39
</ Heading >
33
40
</ Pane >
34
- { appState . programs !== loadingState ? < ProgramList programs = { appState . programs } /> : < Spinner marginX = 'auto' marginY = { 120 } /> }
41
+ { programs !== loadingState ? < ProgramList programs = { programs } /> : < Spinner marginX = 'auto' marginY = { 120 } /> }
35
42
</ Pane >
36
43
</ Pane >
37
44
)
You can’t perform that action at this time.
0 commit comments