11import { Button } from "@heroui/button" ;
2- import { Play , Pause , ChevronRight , ChevronLeft , Lightbulb , Target , X } from "lucide-react" ;
2+ import {
3+ Play ,
4+ Pause ,
5+ ChevronRight ,
6+ ChevronLeft ,
7+ Lightbulb ,
8+ Target ,
9+ RotateCcw ,
10+ Trash2 ,
11+ } from "lucide-react" ;
312import { Tooltip } from "@heroui/tooltip" ;
413
514interface GameControlsProps {
@@ -10,6 +19,7 @@ interface GameControlsProps {
1019 onNext : ( ) => void ;
1120 onPrevious : ( ) => void ;
1221 onClear : ( ) => void ;
22+ onResetToInitial : ( ) => void ;
1323 showHints ?: boolean ;
1424 showGoals ?: boolean ;
1525 onToggleHints ?: ( ) => void ;
@@ -25,6 +35,7 @@ export function GameControls({
2535 onNext,
2636 onPrevious,
2737 onClear,
38+ onResetToInitial,
2839 showHints = false ,
2940 showGoals = false ,
3041 onToggleHints,
@@ -33,34 +44,53 @@ export function GameControls({
3344} : GameControlsProps ) {
3445 return (
3546 < div className = "flex flex-col items-center gap-4" >
36- < div className = "flex gap-6 items-center" >
37- < button
38- onClick = { onPrevious }
39- disabled = { ! canUndo }
40- className = "w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gray-200 hover:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center transition-colors"
41- >
42- < ChevronLeft className = "w-5 h-5 sm:w-6 sm:h-6 text-gray-600" />
43- </ button >
44- < button
45- onClick = { isPlaying ? onPause : onPlay }
46- className = "flex items-center gap-1.5 sm:gap-2 p-3 sm:p-5 rounded-full bg-linera-primary hover:bg-linera-primary-dark text-white transition-colors shadow-lg"
47- >
48- { isPlaying ? (
49- < >
50- < Pause className = "w-4 h-4 sm:w-5 sm:h-5 fill-white" />
51- </ >
52- ) : (
53- < >
54- < Play className = "w-4 h-4 sm:w-5 sm:h-5 ml-0.5 fill-white" />
55- </ >
56- ) }
57- </ button >
58- < button
59- onClick = { onNext }
60- className = "w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center transition-colors"
61- >
62- < ChevronRight className = "w-5 h-5 sm:w-6 sm:h-6 text-gray-600" />
63- </ button >
47+ < div className = "flex gap-3 items-center" >
48+ < Tooltip content = "Previous generation" >
49+ < button
50+ onClick = { onPrevious }
51+ disabled = { ! canUndo }
52+ className = "w-10 h-10 rounded-full bg-gray-200 hover:bg-gray-300 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center transition-colors"
53+ >
54+ < ChevronLeft className = "w-5 h-5 text-gray-600" />
55+ </ button >
56+ </ Tooltip >
57+ < Tooltip content = { isPlaying ? "Pause" : "Play" } >
58+ < button
59+ onClick = { isPlaying ? onPause : onPlay }
60+ className = "p-3 rounded-full bg-linera-primary hover:bg-linera-primary-dark text-white transition-colors shadow-lg"
61+ >
62+ { isPlaying ? (
63+ < Pause className = "w-5 h-5 fill-white" />
64+ ) : (
65+ < Play className = "w-5 h-5 ml-0.5 fill-white" />
66+ ) }
67+ </ button >
68+ </ Tooltip >
69+ < Tooltip content = "Next generation" >
70+ < button
71+ onClick = { onNext }
72+ className = "w-10 h-10 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center transition-colors"
73+ >
74+ < ChevronRight className = "w-5 h-5 text-gray-600" />
75+ </ button >
76+ </ Tooltip >
77+ < div className = "w-px h-8 bg-gray-300 mx-2" /> { /* Divider */ }
78+ < Tooltip content = "Reset to generation 0" >
79+ < button
80+ onClick = { onResetToInitial }
81+ className = "w-10 h-10 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center transition-colors"
82+ >
83+ < RotateCcw className = "w-5 h-5 text-gray-600" />
84+ </ button >
85+ </ Tooltip >
86+ < Tooltip content = "Clear all cells" >
87+ < button
88+ onClick = { onClear }
89+ className = "w-10 h-10 rounded-full bg-gray-200 hover:bg-gray-300 flex items-center justify-center transition-colors"
90+ >
91+ < Trash2 className = "w-5 h-5 text-gray-600" />
92+ </ button >
93+ </ Tooltip >
6494 </ div >
6595 < div className = "flex gap-3 items-center flex-wrap justify-center" >
6696 { hasConditions && (
@@ -91,14 +121,6 @@ export function GameControls({
91121 </ Button >
92122 </ >
93123 ) }
94- < Button
95- variant = "flat"
96- onPress = { onClear }
97- className = "bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium text-xs sm:text-base px-4 py-2 sm:px-6 sm:py-2.5 min-w-[120px] sm:min-w-[140px] rounded-full flex items-center gap-2"
98- >
99- < X className = "w-4 h-4 sm:w-5 sm:h-5" />
100- Reset Generations
101- </ Button >
102124 </ div >
103125 </ div >
104126 ) ;
0 commit comments