From 7d14e75e7f9691802b6e0c8563e504b2d9c3485a Mon Sep 17 00:00:00 2001 From: "tuan.cna" Date: Fri, 30 May 2025 17:47:03 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20ESLint=20Warnings=20-=20Re?= =?UTF-8?q?move=20Unused=20Variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit โœ… Fixed ESLint Issues: - Removed unused isDarkMode variable and theme detection logic - Removed unused startRecord and endRecord variables - Cleaned up theme change listeners that are no longer needed - Removed redundant theme state management ๐Ÿงน Code Cleanup: - All theme handling now done in CustomPagination component - No duplicate theme detection logic - Cleaner component structure - Better separation of concerns ๐Ÿ“‹ Changes Made: - src/feature-module/inventory/productlist.jsx: Removed unused variables - All ESLint warnings resolved - No functional changes to pagination behavior - Maintained all existing functionality ๐ŸŽฏ Benefits: - Cleaner code without warnings - Better maintainability - Proper component separation - No unused code bloat --- src/feature-module/inventory/productlist.jsx | 25 -------------------- 1 file changed, 25 deletions(-) diff --git a/src/feature-module/inventory/productlist.jsx b/src/feature-module/inventory/productlist.jsx index fb8ed9f..155b087 100644 --- a/src/feature-module/inventory/productlist.jsx +++ b/src/feature-module/inventory/productlist.jsx @@ -446,29 +446,7 @@ const ProductList = () => { const [isFilterVisible, setIsFilterVisible] = useState(false); const [searchTerm, setSearchTerm] = useState(""); - // Detect theme mode from document attribute - const [isDarkMode, setIsDarkMode] = useState( - document.documentElement.getAttribute('data-layout-mode') === 'dark_mode' - ); - // Listen for theme changes - useEffect(() => { - const observer = new MutationObserver((mutations) => { - mutations.forEach((mutation) => { - if (mutation.type === 'attributes' && mutation.attributeName === 'data-layout-mode') { - const newTheme = document.documentElement.getAttribute('data-layout-mode'); - setIsDarkMode(newTheme === 'dark_mode'); - } - }); - }); - - observer.observe(document.documentElement, { - attributes: true, - attributeFilter: ['data-layout-mode'] - }); - - return () => observer.disconnect(); - }, []); // State for pagination - sync with Redux const [currentPage, setCurrentPage] = useState(reduxCurrentPage || 1); @@ -639,9 +617,6 @@ const ProductList = () => { const calculatedTotalPages = Math.ceil(totalRecords / pageSize); const actualTotalPages = totalPages || calculatedTotalPages; - const startRecord = totalRecords > 0 ? (currentPage - 1) * pageSize + 1 : 0; - const endRecord = Math.min(currentPage * pageSize, totalRecords); - // Debug logs removed for production // Clear error when component unmounts