mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
New: Search bar searches books as well as authors
This commit is contained in:
@@ -21,7 +21,8 @@ function createCleanAuthorSelector() {
|
||||
} = author;
|
||||
|
||||
return {
|
||||
authorName,
|
||||
type: 'author',
|
||||
name: authorName,
|
||||
sortName,
|
||||
titleSlug,
|
||||
images,
|
||||
@@ -40,12 +41,41 @@ function createCleanAuthorSelector() {
|
||||
);
|
||||
}
|
||||
|
||||
function createCleanBookSelector() {
|
||||
return createSelector(
|
||||
(state) => state.books.items,
|
||||
(allBooks) => {
|
||||
return allBooks.map((book) => {
|
||||
const {
|
||||
title,
|
||||
images,
|
||||
titleSlug
|
||||
} = book;
|
||||
|
||||
return {
|
||||
type: 'book',
|
||||
name: title,
|
||||
sortName: title,
|
||||
titleSlug,
|
||||
images,
|
||||
tags: []
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createDeepEqualSelector(
|
||||
createCleanAuthorSelector(),
|
||||
(authors) => {
|
||||
createCleanBookSelector(),
|
||||
(authors, books) => {
|
||||
const items = [
|
||||
...authors,
|
||||
...books
|
||||
];
|
||||
return {
|
||||
authors
|
||||
items
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -57,6 +87,10 @@ function createMapDispatchToProps(dispatch, props) {
|
||||
dispatch(push(`${window.Readarr.urlBase}/author/${titleSlug}`));
|
||||
},
|
||||
|
||||
onGoToBook(titleSlug) {
|
||||
dispatch(push(`${window.Readarr.urlBase}/book/${titleSlug}`));
|
||||
},
|
||||
|
||||
onGoToAddNewAuthor(query) {
|
||||
dispatch(push(`${window.Readarr.urlBase}/add/search?term=${encodeURIComponent(query)}`));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user