@@ -9,18 +9,20 @@ import { Grid } from './Grid';
99import { I18n } from '../locale' ;
1010import Button from './Button' ;
1111import { makeSearchResultsSelector , getSortSelector } from '../util/selectors' ;
12+ import useSearchQuery from '../util/useSearchQuery' ;
1213
1314const SORT_KEY = 'search_results' ;
1415
1516const SearchResults = ( {
1617 type,
1718 all,
1819} ) => {
19- const { term } = useParams ( ) ;
20+ const { term, providers } = useSearchQuery ( ) ;
21+ const encodedProviders = providers . join ( ',' ) . replace ( / : / g, '' ) ;
2022 const [ sortField , sortReverse ] = useSelector (
2123 ( state ) => getSortSelector ( state , SORT_KEY , 'name' ) ,
2224 ) ;
23- const searchResultsSelector = makeSearchResultsSelector ( term , type ) ;
25+ const searchResultsSelector = makeSearchResultsSelector ( providers , term , type ) ;
2426 const rawResults = useSelector ( searchResultsSelector ) ;
2527 const encodedTerm = encodeURIComponent ( term ) ;
2628 let results = [ ...rawResults ] ;
@@ -43,17 +45,17 @@ const SearchResults = ({
4345 < h4 >
4446 { ! all && (
4547 < span >
46- < URILink uri = { `iris:search:all:${ encodedTerm } ` } uriType = "search" unencoded >
48+ < URILink uri = { `iris:search:all:${ encodedProviders } : ${ encodedTerm } ` } uriType = "search" unencoded >
4749 < I18n path = "search.title" />
4850 </ URILink >
49- { ' ' }
51+ < span style = { { display : 'inline-block' , width : 10 } } />
5052 < Icon type = "fontawesome" name = "angle-right" />
51- { ' ' }
53+ < span style = { { display : 'inline-block' , width : 10 } } />
5254 < I18n path = { `search.${ type } .title` } />
5355 </ span >
5456 ) }
5557 { all && (
56- < URILink uri = { `iris:search:${ type } :${ encodedTerm } ` } uriType = "search" unencoded >
58+ < URILink uri = { `iris:search:${ type } :${ encodedProviders } : ${ encodedTerm } ` } uriType = "search" unencoded >
5759 < I18n path = { `search.${ type } .title` } />
5860 </ URILink >
5961 ) }
@@ -66,7 +68,7 @@ const SearchResults = ({
6668 { type === 'tracks' && (
6769 < TrackList
6870 source = { {
69- uri : `iris:search:${ type } :${ encodedTerm } ` ,
71+ uri : `iris:search:${ type } :${ encodedProviders } : ${ encodedTerm } ` ,
7072 name : 'Search results' ,
7173 type : 'search' ,
7274 } }
@@ -77,7 +79,7 @@ const SearchResults = ({
7779 { /* <LazyLoadListener enabled={this.props.artists_more && spotify_search_enabled} loadMore={loadMore} /> */ }
7880
7981 { resultsCount > results . length && (
80- < Button uri = { `iris:search:${ type } :${ encodedTerm } ` } uriType = "search" unencoded >
82+ < Button uri = { `iris:search:${ type } :${ encodedProviders } : ${ encodedTerm } ` } uriType = "search" unencoded >
8183 < I18n path = { `search.${ type } .more` } count = { resultsCount } />
8284 </ Button >
8385 ) }
0 commit comments