3
0
mirror of https://github.com/Qortal/ear-bump.git synced 2025-01-30 06:42:20 +00:00

Merge pull request #1 from QuickMythril/search-fix

Search songs/playlists by title/description
This commit is contained in:
Phillip 2024-01-31 17:53:38 +02:00 committed by GitHub
commit b13edd5976
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ const SearchInput = () => {
} }
return ( return (
<Input <Input
placeholder="What do you want to listen to? by title" placeholder="What do you want to listen to?"
onChange={(e) => dispatch(setQueriedValue(e.target.value))} onChange={(e) => dispatch(setQueriedValue(e.target.value))}
onKeyDown={handleInputKeyDown} onKeyDown={handleInputKeyDown}
/> />

View File

@ -30,7 +30,7 @@ export const SearchInputPlaylist = () => {
return ( return (
<div className="flex items-center"> <div className="flex items-center">
<Input <Input
placeholder="What do you want to listen to? by title" placeholder="What do you want to listen to?"
onChange={(e) => { onChange={(e) => {
dispatch(setQueriedValuePlaylist(e.target.value)) dispatch(setQueriedValuePlaylist(e.target.value))
}} }}

View File

@ -120,9 +120,9 @@ export const useFetchSongs = () => {
if (!queriedValue) return if (!queriedValue) return
dispatch(setIsLoadingGlobal(true)) dispatch(setIsLoadingGlobal(true))
const offset = songListQueried.length const offset = songListQueried.length
const query = `earbump_song_` const identifier = `earbump_song_`
const replaceSpacesWithUnderscore = queriedValue.toLowerCase().replace(/ /g, '_'); const replaceSpacesWithUnderscore = queriedValue.toLowerCase().replace(/ /g, '_');
const identifier = replaceSpacesWithUnderscore const query = replaceSpacesWithUnderscore
const url = `/arbitrary/resources/search?mode=ALL&service=AUDIO&query=${query}&identifier=${identifier}&limit=20&includemetadata=true&offset=${offset}&reverse=true&excludeblocked=true&includestatus=true` const url = `/arbitrary/resources/search?mode=ALL&service=AUDIO&query=${query}&identifier=${identifier}&limit=20&includemetadata=true&offset=${offset}&reverse=true&excludeblocked=true&includestatus=true`
const response = await fetch(url, { const response = await fetch(url, {
method: 'GET', method: 'GET',
@ -530,9 +530,9 @@ export const useFetchSongs = () => {
try { try {
if (!queriedValuePlaylist) return if (!queriedValuePlaylist) return
const offset = playlistQueried.length const offset = playlistQueried.length
const query = `earbump_playlist_` const identifier = `earbump_playlist_`
const replaceSpacesWithUnderscore = queriedValuePlaylist.toLowerCase().replace(/ /g, '_'); const replaceSpacesWithUnderscore = queriedValuePlaylist.toLowerCase().replace(/ /g, '_');
const identifier = replaceSpacesWithUnderscore const query = replaceSpacesWithUnderscore
const url = `/arbitrary/resources/search?mode=ALL&service=PLAYLIST&query=${query}&identifier=${identifier}&limit=20&includemetadata=false&offset=${offset}&reverse=true&excludeblocked=true&includestatus=false` const url = `/arbitrary/resources/search?mode=ALL&service=PLAYLIST&query=${query}&identifier=${identifier}&limit=20&includemetadata=false&offset=${offset}&reverse=true&excludeblocked=true&includestatus=false`
const response = await fetch(url, { const response = await fetch(url, {
method: 'GET', method: 'GET',