Refactor code structure for improved readability and maintainability, removed unnecessary console logs, removed old.js
This commit is contained in:
@@ -353,13 +353,11 @@ export default function Player({ user }) {
|
||||
}, []);
|
||||
|
||||
const handleTrackData = useCallback((trackData) => {
|
||||
console.debug('handleTrackData called with:', trackData);
|
||||
const requestStation = activeStationRef.current;
|
||||
|
||||
// Only set "No track playing" if we have clear indication of no track
|
||||
// and not just missing song field (to avoid flickering during transitions)
|
||||
if ((!trackData.song || trackData.song === 'N/A') && (!trackData.artist || trackData.artist === 'N/A')) {
|
||||
console.debug('Setting no track playing state');
|
||||
setTrackTitle('No track playing');
|
||||
setLyrics([]);
|
||||
return;
|
||||
@@ -408,7 +406,6 @@ export default function Player({ user }) {
|
||||
const ws = new WebSocket(wsUrl);
|
||||
|
||||
ws.onopen = function () {
|
||||
console.log('Connected to radio WebSocket for station:', station);
|
||||
// Reset retry count on successful connection
|
||||
};
|
||||
|
||||
@@ -434,15 +431,12 @@ export default function Player({ user }) {
|
||||
};
|
||||
|
||||
ws.onclose = function (event) {
|
||||
console.log('Radio WebSocket connection closed, code:', event.code, 'reason:', event.reason);
|
||||
|
||||
// Don't retry if it was a clean close (code 1000)
|
||||
if (event.code === 1000) return;
|
||||
|
||||
// Attempt reconnection with exponential backoff
|
||||
if (retryCount < maxRetries) {
|
||||
const delay = Math.min(baseDelay * Math.pow(2, retryCount), maxDelay);
|
||||
console.log(`Attempting WebSocket reconnection in ${delay}ms (attempt ${retryCount + 1}/${maxRetries})`);
|
||||
|
||||
setTimeout(() => {
|
||||
connectWebSocket(retryCount + 1);
|
||||
|
||||
@@ -115,11 +115,11 @@ export default function MediaRequestForm() {
|
||||
const inputEl = ac?.getInput ? ac.getInput() : document.querySelector('.p-autocomplete-input');
|
||||
if (inputEl && typeof inputEl.blur === 'function') inputEl.blur();
|
||||
} catch (innerErr) {
|
||||
console.debug('selectArtist: overlay hide fallback failed', innerErr);
|
||||
// Ignore inner errors
|
||||
}
|
||||
}, 0);
|
||||
} catch (err) {
|
||||
console.debug('selectArtist: unable to schedule overlay hide', err);
|
||||
// Ignore outer errors
|
||||
}
|
||||
};
|
||||
|
||||
@@ -189,7 +189,6 @@ export default function MediaRequestForm() {
|
||||
try {
|
||||
if (metadataFetchToastId.current) toast.dismiss(metadataFetchToastId.current);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
metadataFetchToastId.current = toast.info("Retrieving metadata...",
|
||||
{
|
||||
|
||||
45005
src/components/old.js
45005
src/components/old.js
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user