refactor bounce

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-05-28 21:16:52 +02:00
padre e5b46c7333
commit ae7a4568b6

Ver fichero

@@ -8,7 +8,7 @@ import text from "./list.txt";
const App = () => {
const [audioUrl, setAudioUrl] = useState(null),
[analyzerData, setAnalyzerData] = useState(null),
[bounce, setBounce] = useState(''),
[bounce, setBounce] = useState('Now Playing: '),
[json, setJson] = useState({}),
[currentVolume, setCurrentVolume] = useState(0.5),
[muted, setMuted] = useState(false),
@@ -63,8 +63,8 @@ const App = () => {
}
},
loadImages = useCallback(async () => {
const response = await fetch(text)
const data = await response.text()
const response = await fetch(text),
data = await response.text()
setImages(data.split('\n').filter(line => line.length > 0))
}),
load = useCallback(async () => {
@@ -82,7 +82,6 @@ const App = () => {
})
useEffect(() => {
if (json?.media?.track[0] && bounce.search(json?.media?.track[0].Title) === -1) {
setBounce('Now Playing: ')
setLink(json?.media['@ref']?.replace('/musica', 'https://manalejandro.com'))
Object.keys(json.media.track[0]).map((key) => {
if (key === 'Title' || key === 'Performer' || key === 'Album') {
@@ -103,7 +102,7 @@ const App = () => {
} else if (!json?.media && bounce.search('Now Playing: null') === -1) {
setLink('')
setTitle('Stream Radio')
setBounce('Now Playing: null')
setBounce('Now Playing: Title not available')
}
}, [json])
useEffect(() => {