🔧 Fix ESLint Warnings - Remove Unused Variables

✅ 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
This commit is contained in:
tuan.cna 2025-05-30 17:47:03 +07:00
parent be9da50fc5
commit 7d14e75e7f

View File

@ -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