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