Skip to content

Commit d735151

Browse files
cleanup
1 parent 3aae2f3 commit d735151

File tree

1 file changed

+2
-64
lines changed

1 file changed

+2
-64
lines changed

src/SortingVisualizer/Visualizer.js

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -25,61 +25,6 @@ const Visualizer = () => {
2525
const [animationSpeed, setAnimationSpeed] = useState(10);
2626
const [algo, setAlgo] = useState("mergesort");
2727
const [able, setAble] = useState(true);
28-
// const [time, setTime] = useState({ ms: 0, s: 0, m: 0, h: 0 });
29-
// const [interv, setInterv] = useState();
30-
// const [status, setStatus] = useState(0);
31-
// // Not started = 0
32-
// // started = 1
33-
// // stopped = 2
34-
35-
// const handleStart = () => {
36-
// run();
37-
// setStatus(1);
38-
// setInterv(setInterval(run, 10));
39-
// };
40-
41-
// var updatedMs = time.ms,
42-
// updatedS = time.s,
43-
// updatedM = time.m,
44-
// updatedH = time.h;
45-
46-
// const run = () => {
47-
// if (updatedM === 60) {
48-
// updatedH++;
49-
// updatedM = 0;
50-
// }
51-
// if (updatedS === 60) {
52-
// updatedM++;
53-
// updatedS = 0;
54-
// }
55-
// if (updatedMs === 100) {
56-
// updatedS++;
57-
// updatedMs = 0;
58-
// }
59-
// updatedMs++;
60-
// return setTime({ ms: updatedMs, s: updatedS, m: updatedM, h: updatedH });
61-
// };
62-
63-
// const handleStop = () => {
64-
// clearInterval(interv);
65-
// setStatus(2);
66-
// };
67-
68-
// const handleReset = () => {
69-
// clearInterval(interv);
70-
// setStatus(0);
71-
// setTime({ ms: 0, s: 0, m: 0, h: 0 });
72-
// };
73-
74-
// const handleResume = () => handleStart();
75-
76-
// const h = () => {
77-
// if (time.h === 0) {
78-
// return "";
79-
// } else {
80-
// return <span>{time.h >= 10 ? time.h : "0" + time.h}</span>;
81-
// }
82-
// };
8328

8429
//Render the Array Before DOM loades
8530
useEffect(() => {
@@ -108,7 +53,6 @@ const Visualizer = () => {
10853

10954
const populateArray = (size) => {
11055
audio.play(); // play resetEffect here
111-
// handleReset();
11256
const tempArr = [];
11357
for (let i = 0; i < size; i++) {
11458
const item = {
@@ -130,7 +74,6 @@ const Visualizer = () => {
13074
const colorEveryElement = (arr, counter) => {
13175
setTimeout(() => {
13276
completedAudio.play(); // Play audion when bar will sorted
133-
// handleStop();
13477
const sortedArray = [];
13578
for (let i = 0; i < arr.length; i++) {
13679
document.getElementsByClassName("arrayBar")[i].style.backgroundColor =
@@ -141,6 +84,7 @@ const Visualizer = () => {
14184
val: arr[i],
14285
});
14386
}
87+
14488
setMainArray(sortedArray);
14589
setAble(true);
14690
}, counter * animationSpeed);
@@ -191,7 +135,6 @@ const Visualizer = () => {
191135
colorEveryElement(arr, count + 1);
192136
};
193137
const startSorting = (algo) => {
194-
// handleStart();
195138
switch (algo) {
196139
case "bubblesort":
197140
bubbleSortAnimate();
@@ -245,12 +188,7 @@ const Visualizer = () => {
245188
<div className="select-box able">
246189
<label htmlFor="algo">Select Algorithm</label>
247190
<label htmlFor="algo"></label>
248-
{/* <div>
249-
{h()}&nbsp;&nbsp;
250-
{time.m >= 10 ? time.m : "0" + time.m} :
251-
{time.s >= 10 ? time.s : "0" + time.s} :
252-
{time.ms >= 10 ? time.ms : "0" + time.ms}
253-
</div> */}
191+
<div></div>
254192

255193
<select
256194
name="algo"

0 commit comments

Comments
 (0)