@@ -5,8 +5,8 @@ import { Strategy } from '../Strategy/Strategy.js';
55import { Options } from './options/Options.js' ;
66import { ReactComponent as Play } from '../../img/play.svg'
77import { ReactComponent as Replay } from '../../img/replay.svg'
8- import { Animation } from '../Animation/Animation.js' ;
98import { MergeSort } from '../Strategy/Algorithms/MergeSort.js' ;
9+ import { RadixSortLSD } from '../Strategy/Algorithms/RadixSortLSD.js' ;
1010
1111
1212class InputField extends Component {
@@ -17,6 +17,7 @@ class InputField extends Component {
1717 this . name = props . name ;
1818 this . selectionSort = new SelectionSort ( ) ;
1919 this . mergeSort = new MergeSort ( ) ;
20+ this . radixSortLSD = new RadixSortLSD ( ) ;
2021 this . Strategy = new Strategy ( ) ;
2122 this . state = {
2223 algorithm : ''
@@ -33,7 +34,7 @@ class InputField extends Component {
3334 return (
3435 < div className = "flex flex-col border-[1px] bg-gray-100" >
3536
36- < div className = { `flex items-center justify-center p-3 w-sreen gap-4 flex-wrap ${ this . name [ 0 ] + ' ' } ` } >
37+ < div className = { `flex items-center justify-center py-2 w-sreen gap-4 flex-wrap ${ this . name [ 0 ] + ' ' } ` } >
3738
3839 < div className = "w-[41em] overflow-auto flex gap-3 p-2" >
3940 < div onClick = { ( ) => {
@@ -61,11 +62,11 @@ class InputField extends Component {
6162 </ div >
6263
6364 < div onClick = { ( ) => {
64- this . Strategy . setStrategy = this . selectionSort ;
65- this . setState ( { algorithm : 'Bubble ' } ) ;
65+ this . Strategy . setStrategy = this . radixSortLSD ;
66+ this . setState ( { algorithm : 'Radix ' } ) ;
6667 } }
6768 className = { `cursor-pointer hover:scale-[1.05] transition-all duration-200 ease-in-out border-2 hover:bg-blue-200 hover:border-blue-300 ${ algorithm === 'Bubble' ? "bg-blue-100 border-blue-300" : "border-gray-300 bg-white" } min-w-[150px] rounded-xl text-gray-600 flex flex-col p-3 items-center` } >
68- < p className = "font-semibold" > Bubble Sort</ p >
69+ < p className = "font-semibold" > Radix Sort</ p >
6970 </ div >
7071
7172 </ div >
@@ -91,19 +92,19 @@ class InputField extends Component {
9192 < div className = "flex gap-10 flex-wrap justify-center" >
9293 < Options options = { this . props . InputHandler } algorithm = { algorithm } />
9394 < div className = "flex self-center gap-3" >
94- < div onClick = { ( ) => {
95+ < div onClick = { async ( ) => {
9596 if ( this . state . algorithm && inputArrayLength ) {
9697 window . scroll ( { // SG 07/10/2022 18:55 for mobile devices
9798 top : 1000 ,
9899 behavior : 'smooth'
99100 } ) ;
100101 this . Strategy . setOptions = options ;
101- this . Strategy . perform ( options , inputArray )
102+ await this . Strategy . perform ( options , inputArray )
102103 }
103104 }
104105 } className = { `relative min-w-[3.5em] p-3 group rounded-lg flex ${ this . state . algorithm && inputArrayLength ? "bg-green-600 cursor-pointer hover:shadow-custom-md-green transition-all duration-200 ease-in-out" : "bg-gray-600 cursor-not-allowed" } ` } >
105- < p className = { `text-white font-semibold group-hover:opacity-0 ${ this . state . algorithm && "mr-9" } ` } > { this . state . algorithm && this . state . algorithm + " sort " } </ p >
106- < Play className = { `absolute right-[1em ] transition-all duration-200 ease-in-out ${ this . state . algorithm && "group-hover:scale-[1.15] group-hover:right-[40%]" } ` } />
106+ < p className = { `text-white font-semibold group-hover:opacity-0 ${ this . state . algorithm && "mr-9" } ` } > { this . state . algorithm && this . state . algorithm + " Sort " } </ p >
107+ < Play className = { `absolute right-[.94em ] transition-all duration-200 ease-in-out ${ this . state . algorithm && "group-hover:scale-[1.15] group-hover:right-[40%]" } ` } />
107108 </ div >
108109
109110 < div className = "self-center group" >
0 commit comments