Refactor: Migrate class components to hooks, standardize props, and add ESLint#5
Merged
Conversation
Owner
TamimEhsan
commented
May 25, 2026
- Convert all class components to functional components with hooks — every visualizer (N-Queen, Convex Hull, Pathfinder, Sorting, Recursive Sorting, Turing Machine, Prime Numbers, Recursion Tree, Binary Search) now uses useState, useEffect, and useRef. Uses useRef for values read inside async animation loops to avoid stale closure bugs. 15-Puzzle is the only remaining class component (intentionally skipped).
- Standardize disabled prop naming — replaced disable and isDisabled variants with the standard disabled across all menu components and shared UI. Added visual disabled state to the Slider component.
- Add ESLint with next/core-web-vitals flat config (eslint.config.mjs). Rules: no-console (warn), no-unused-vars (warn), react/no-unescaped-entities (off). All lint errors resolved.
- Remove unused variables and dead code — deleted dead functions, unused imports, unreferenced props, and removed unused files (cnvas2.jsx, timer.jsx, details.jsx, vertexOriginal.jsx).
- Add About page and update Navbar with Info link.
- Add running state management — disable controls during animations across all visualizers.
…buttons accordingly
…t, and Sort components
…cross various algorithms
Migrates cell, cells, menu, and page components to use useState, useEffect, and useRef. Uses refs for speed and number values read inside async algorithm.
…h hooks Migrates menu, canvas, and page to use useState, useEffect, and useRef. Removes unused cnvas2.jsx and timer.jsx.
… hooks Migrates node, grid, menu, and page components. Uses useRef for isRunning guard in async animations. Removes unused state and commented-out code.
Sorting: menu with useState for compareMode, page with useRef for speed and dual running state tracking via refs. Recursive Sorting: rect, menu, page converted. Three async animation handlers (merge, heap, quick) use speedRef and countRef. Also fixes CustomSlider to accept disabled prop alongside disable/isDisabled.
…onents Converts Turing Machine, Prime Numbers, Recursion Tree, and Binary Search to use useState, useEffect, and useRef. Uses refs for values read inside async animation loops. Removes unused dead files (details.jsx, vertexOriginal.jsx). Cleans up console.logs and commented-out code.
Unifies CustomSlider to accept only 'disabled' (removes disable/isDisabled). Cleans up commented code and imports in CustomSelect and CustomToggle. Adds visual disabled state (opacity + pointer-events) to Slider component. Fixes Turing Machine midCell ref sync in shift handlers.
Set up ESLint using eslint-config-next v16 native flat config with no-console (warn), no-unused-vars (warn), and react/no-unescaped-entities (off).
Remove unused vars, dead functions (sib, dfs, handleRefresh), unused imports, and unused props to resolve all ESLint no-unused-vars warnings. Also fix setState-in-effect, state mutation, and hoisting lint errors.
Recursion tree: replace double-border nodes with single border, drop shadow, and three-state coloring (amber=active, teal=partial, slate=completed). Soften edge/arrow colors to slate-500. Pathfinder: fix bug where visited cell colors disappeared when shortest path was animated (stale grid closure). Update REFACTOR.md to reflect completed tasks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.