From d8eedcb16095ed115cbe83a1eadd8de56f976d8e Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Wed, 3 Jan 2024 10:51:57 +1300 Subject: [PATCH 1/2] Handling of search filters - Always display "no results" when a query is present - Placeholder path for no sources selected (ensures URL retains structure) - Fixes comment https://github.com/jaedb/Iris/issues/906#issuecomment-1776667496 --- src/js/App.js | 1 + src/js/components/SearchResults.js | 8 +++++--- src/js/locale/en.yaml | 1 + src/js/views/Search.js | 18 ++++++++++-------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/js/App.js b/src/js/App.js index 38ca038ed..54d8b5279 100755 --- a/src/js/App.js +++ b/src/js/App.js @@ -55,6 +55,7 @@ const Content = () => ( } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/js/components/SearchResults.js b/src/js/components/SearchResults.js index a434fed07..91ba997de 100755 --- a/src/js/components/SearchResults.js +++ b/src/js/components/SearchResults.js @@ -38,8 +38,6 @@ const SearchResults = ({ results = results.slice(0, 6); } - if (all && !results.length) return null; - return (

@@ -60,7 +58,7 @@ const SearchResults = ({ )}

- {results.length > 0 && ( + {results.length > 0 ? (
{type === 'artists' && } {type === 'albums' && } @@ -84,6 +82,10 @@ const SearchResults = ({ )}
+ ) : ( + + + )}
); diff --git a/src/js/locale/en.yaml b/src/js/locale/en.yaml index 77eb86efc..214ddef59 100755 --- a/src/js/locale/en.yaml +++ b/src/js/locale/en.yaml @@ -339,6 +339,7 @@ search: sort: Sort source: Sources placeholder: Search + no_results: No results all: title: All artists: diff --git a/src/js/views/Search.js b/src/js/views/Search.js index fceed8052..50757b0a2 100755 --- a/src/js/views/Search.js +++ b/src/js/views/Search.js @@ -50,7 +50,7 @@ const Search = () => { const updateSearchQuery = (term, providers) => { const encodedTerm = encodeURIComponent(term); - navigate(`/search/${type}/${providers.join(',')}/${encodedTerm || ''}`); + navigate(`/search/${type}/${providers.join(',') || 'none'}/${encodedTerm || ''}`); } const onReset = () => navigate('/search'); @@ -113,13 +113,15 @@ const Search = () => { onReset={onReset} /> -
- {type != 'all' ? ( - - ) : ( - - )} -
+ {term && ( +
+ {type != 'all' ? ( + + ) : ( + + )} +
+ )} ); } From 4dffccfbe56458034e8b22d6ef72904a1c4b3da7 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Wed, 3 Jan 2024 10:55:15 +1300 Subject: [PATCH 2/2] Buildout and version bump 3.69.3 --- IRIS_VERSION | 2 +- mopidy_iris/__init__.py | 2 +- package.json | 2 +- setup.cfg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/IRIS_VERSION b/IRIS_VERSION index 1cc2eac08..d50ee18d8 100755 --- a/IRIS_VERSION +++ b/IRIS_VERSION @@ -1 +1 @@ -3.69.2 +3.69.3 diff --git a/mopidy_iris/__init__.py b/mopidy_iris/__init__.py index 49c1708f6..c535c1e21 100755 --- a/mopidy_iris/__init__.py +++ b/mopidy_iris/__init__.py @@ -3,7 +3,7 @@ from mopidy import config, ext -__version__ = "3.69.2" +__version__ = "3.69.3" logger = logging.getLogger(__name__) diff --git a/package.json b/package.json index 1ab828287..e3e9e693d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mopidy-iris", - "version": "3.69.2", + "version": "3.69.3", "description": "Mopidy HTTP interface", "repository": "https://github.com/jaedb/iris", "author": "James Barnsley ", diff --git a/setup.cfg b/setup.cfg index af92270fd..1fba27f60 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = Mopidy-Iris -version = 3.69.2 +version = 3.69.3 url = https://github.com/jaedb/iris author = James Barnsley author_email = james@barnsley.nz