Refactor AudioPlayer and LyricSearch components/ AudioPlayer: add DJ controls (porting from old site), and optimize theme handling.
This commit is contained in:
@@ -5,6 +5,7 @@ import React, {
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
useCallback,
|
||||
} from "react";
|
||||
import { toast } from 'react-toastify';
|
||||
import Alert from '@mui/joy/Alert';
|
||||
@@ -65,7 +66,7 @@ export function LyricSearchInputField({ id, placeholder, setShowLyrics }) {
|
||||
|
||||
|
||||
// Typeahead: fetch suggestions
|
||||
const fetchSuggestions = async (event) => {
|
||||
const fetchSuggestions = useCallback(async (event) => {
|
||||
const query = event.query;
|
||||
const res = await fetch(`${API_URL}/typeahead/lyrics`, {
|
||||
method: "POST",
|
||||
@@ -74,7 +75,7 @@ export function LyricSearchInputField({ id, placeholder, setShowLyrics }) {
|
||||
});
|
||||
const json = await res.json();
|
||||
setSuggestions(json);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Toggle exclusion state for checkboxes
|
||||
const toggleExclusion = (source) => {
|
||||
|
||||
Reference in New Issue
Block a user