1- " use client" ;
1+ ' use client' ;
22
3- import { type FC , useEffect , useState } from " react" ;
4- import { cn } from "@/lib/cls" ;
5- import { Button } from "@/primitives/components/ui/button" ;
6- import { Dictionary } from "@/dictionaries" ;
3+ import { type FC , useEffect , useState } from ' react' ;
4+ import type { Dictionary } from '@/dictionaries' ;
5+ import { cn } from '@/lib/cls' ;
6+ import { Button } from '@/primitives/components/ui/button' ;
77
88const TIMER_DURATION = 120 ; // 2 minutes in seconds
99
@@ -18,7 +18,11 @@ interface GameTimerProps {
1818 dict : Dictionary ;
1919}
2020
21- export const GameTimer : FC < GameTimerProps > = ( { playerRoles, onPlayAgain, dict } ) => {
21+ export const GameTimer : FC < GameTimerProps > = ( {
22+ playerRoles,
23+ onPlayAgain,
24+ dict,
25+ } ) => {
2226 const [ timeLeft , setTimeLeft ] = useState ( TIMER_DURATION ) ;
2327 const [ isExpired , setIsExpired ] = useState ( false ) ;
2428 const [ showSpies , setShowSpies ] = useState ( false ) ;
@@ -44,13 +48,13 @@ export const GameTimer: FC<GameTimerProps> = ({ playerRoles, onPlayAgain, dict }
4448
4549 const minutes = Math . floor ( timeLeft / 60 ) ;
4650 const seconds = timeLeft % 60 ;
47- const formattedTime = `${ minutes } :${ seconds . toString ( ) . padStart ( 2 , "0" ) } ` ;
51+ const formattedTime = `${ minutes } :${ seconds . toString ( ) . padStart ( 2 , '0' ) } ` ;
4852
4953 const getTimerColor = ( ) => {
50- if ( isExpired ) return " text-destructive" ;
51- if ( timeLeft <= 30 ) return " text-destructive" ;
52- if ( timeLeft <= 60 ) return " text-warning" ;
53- return " text-foreground" ;
54+ if ( isExpired ) return ' text-destructive' ;
55+ if ( timeLeft <= 30 ) return ' text-destructive' ;
56+ if ( timeLeft <= 60 ) return ' text-warning' ;
57+ return ' text-foreground' ;
5458 } ;
5559
5660 const spies = playerRoles . filter ( ( player ) => player . isSpy ) ;
@@ -61,29 +65,29 @@ export const GameTimer: FC<GameTimerProps> = ({ playerRoles, onPlayAgain, dict }
6165 < div className = "text-center" >
6266 < h2 className = "mb-2 font-bold text-2xl" > { dict . timer . title } </ h2 >
6367 < p className = "text-muted-foreground" >
64- { isExpired
65- ? dict . timer . timeUpDescription
66- : dict . timer . description }
68+ { isExpired ? dict . timer . timeUpDescription : dict . timer . description }
6769 </ p >
6870 </ div >
6971
7072 < div
7173 className = { cn (
72- " flex h-64 w-64 items-center justify-center rounded-full border-4 shadow-lg transition-colors" ,
74+ ' flex h-64 w-64 items-center justify-center rounded-full border-4 shadow-lg transition-colors' ,
7375 getTimerColor ( ) ,
7476 {
75- " animate-pulse border-destructive" : isExpired ,
76- " border-destructive" : timeLeft <= 30 && ! isExpired ,
77- " border-warning" : timeLeft > 30 && timeLeft <= 60 ,
78- " border-border" : timeLeft > 60 ,
77+ ' animate-pulse border-destructive' : isExpired ,
78+ ' border-destructive' : timeLeft <= 30 && ! isExpired ,
79+ ' border-warning' : timeLeft > 30 && timeLeft <= 60 ,
80+ ' border-border' : timeLeft > 60 ,
7981 } ,
8082 ) } >
8183 < div className = "text-center" >
82- < div className = { cn ( " font-bold text-6xl" , getTimerColor ( ) ) } >
84+ < div className = { cn ( ' font-bold text-6xl' , getTimerColor ( ) ) } >
8385 { formattedTime }
8486 </ div >
8587 { isExpired && (
86- < div className = "mt-2 font-semibold text-xl" > { dict . timer . timeUp } </ div >
88+ < div className = "mt-2 font-semibold text-xl" >
89+ { dict . timer . timeUp }
90+ </ div >
8791 ) }
8892 </ div >
8993 </ div >
0 commit comments