From 27e74aca539bd715d073ba158937cd845069be15 Mon Sep 17 00:00:00 2001 From: dev-opsss Date: Wed, 9 Apr 2025 10:26:15 -0500 Subject: [PATCH] Understandable Variable --- src/components/Queue/QueueCommands.tsx | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/Queue/QueueCommands.tsx b/src/components/Queue/QueueCommands.tsx index a0eaa35..c7c6c73 100644 --- a/src/components/Queue/QueueCommands.tsx +++ b/src/components/Queue/QueueCommands.tsx @@ -386,13 +386,13 @@ const QueueCommands: React.FC = ({ className="flex items-center justify-between cursor-pointer hover:bg-white/10 rounded px-2 py-1 transition-colors" onClick={() => { // Create a hidden instance of LanguageSelector to extract languages - const tempDiv = document.createElement('div'); - tempDiv.style.position = 'absolute'; - tempDiv.style.left = '-9999px'; - document.body.appendChild(tempDiv); + const hiddenRenderContainer = document.createElement('div'); + hiddenRenderContainer.style.position = 'absolute'; + hiddenRenderContainer.style.left = '-9999px'; + document.body.appendChild(hiddenRenderContainer); // Create a root and render the LanguageSelector temporarily - const root = createRoot(tempDiv); + const root = createRoot(hiddenRenderContainer); root.render( = ({ // Use setTimeout to ensure the component has rendered setTimeout(() => { // Extract options from the rendered select element - const selectElement = tempDiv.querySelector('select'); + const selectElement = hiddenRenderContainer.querySelector('select'); if (selectElement) { const options = Array.from(selectElement.options); const values = options.map(opt => opt.value); @@ -419,7 +419,7 @@ const QueueCommands: React.FC = ({ // Clean up root.unmount(); - document.body.removeChild(tempDiv); + document.body.removeChild(hiddenRenderContainer); }, 0); }} tabIndex={0} @@ -428,13 +428,13 @@ const QueueCommands: React.FC = ({ e.key === 'ArrowLeft' || e.key === 'ArrowRight') { // Create a hidden instance of LanguageSelector to extract languages - const tempDiv = document.createElement('div'); - tempDiv.style.position = 'absolute'; - tempDiv.style.left = '-9999px'; - document.body.appendChild(tempDiv); + const hiddenRenderContainer = document.createElement('div'); + hiddenRenderContainer.style.position = 'absolute'; + hiddenRenderContainer.style.left = '-9999px'; + document.body.appendChild(hiddenRenderContainer); // Create a root and render the LanguageSelector temporarily - const root = createRoot(tempDiv); + const root = createRoot(hiddenRenderContainer); root.render( = ({ // Use setTimeout to ensure the component has rendered setTimeout(() => { // Extract options from the rendered select element - const selectElement = tempDiv.querySelector('select'); + const selectElement = hiddenRenderContainer.querySelector('select'); if (selectElement) { const options = Array.from(selectElement.options); const values = options.map(opt => opt.value); @@ -470,7 +470,7 @@ const QueueCommands: React.FC = ({ // Clean up root.unmount(); - document.body.removeChild(tempDiv); + document.body.removeChild(hiddenRenderContainer); }, 0); } }}