@@ -23,14 +23,15 @@ import {
23
23
FaRandom ,
24
24
FaQuestionCircle ,
25
25
} from 'react-icons/fa' ;
26
+ import { ToastContainer , toast } from 'react-toastify' ;
27
+ import 'react-toastify/dist/ReactToastify.css' ;
26
28
import {
27
29
DefaultColumnFilter ,
28
30
SelectDifficultyColumnFilter ,
29
31
SelectColumnFilter ,
30
32
SelectCheckedColumnFilter ,
31
33
} from './filters' ;
32
34
import { Event } from '../Shared/Tracking' ;
33
-
34
35
import questions , { updated } from '../../data' ;
35
36
36
37
import 'react-toggle/style.css' ;
@@ -505,16 +506,24 @@ const Table = () => {
505
506
disableFilters : true ,
506
507
Cell : ( { row } ) => {
507
508
const id = Number ( row ?. original ?. id ) ;
508
- console . log ( '⭐ Row ID:' , id , row ?. original ) ;
509
-
510
509
if ( Number . isNaN ( id ) ) return '❌' ;
511
510
512
511
const handleKeyPress = e => {
513
512
if ( e . key === 'Enter' || e . key === ' ' ) {
514
513
const updatedImportant = [ ...important ] ;
515
514
updatedImportant [ id ] = ! updatedImportant [ id ] ;
516
515
setImportant ( updatedImportant ) ;
517
- console . log ( 'Toggled important:' , updatedImportant ) ;
516
+ toast (
517
+ updatedImportant [ id ]
518
+ ? 'Marked as Important'
519
+ : 'Removed from Important' ,
520
+ {
521
+ type : updatedImportant [ id ] ? 'success' : 'info' ,
522
+ autoClose : 1200 ,
523
+ hideProgressBar : true ,
524
+ position : 'bottom-center' ,
525
+ } ,
526
+ ) ;
518
527
}
519
528
} ;
520
529
@@ -524,10 +533,20 @@ const Table = () => {
524
533
tabIndex = { 0 }
525
534
style = { { cursor : 'pointer' , fontSize : '1.2em' } }
526
535
onClick = { ( ) => {
527
- console . log ( 'Star clicked!' , id ) ; // add this
528
536
const updatedImportant = [ ...important ] ;
529
537
updatedImportant [ id ] = ! updatedImportant [ id ] ;
530
538
setImportant ( updatedImportant ) ;
539
+ toast (
540
+ updatedImportant [ id ]
541
+ ? 'Marked as Important'
542
+ : 'Removed from Important' ,
543
+ {
544
+ type : updatedImportant [ id ] ? 'success' : 'info' ,
545
+ autoClose : 1200 ,
546
+ hideProgressBar : true ,
547
+ position : 'bottom-center' ,
548
+ } ,
549
+ ) ;
531
550
} }
532
551
onKeyDown = { handleKeyPress }
533
552
aria-label = "Mark as important for revision"
@@ -609,6 +628,7 @@ const Table = () => {
609
628
610
629
return (
611
630
< Container className = "table" >
631
+ < ToastContainer />
612
632
< ReactTooltip />
613
633
< PatternFrequencies filters = { filters } rows = { filteredRows } />
614
634
0 commit comments