1- import PageTransition from "@/components/PageTransition" ;
21import { useEffect , useState } from "react" ;
2+ import PropTypes from "prop-types" ;
3+ import PageTransition from "@/components/PageTransition" ;
34import MazeImage from "../../assets/images/Bug2Bot/mazeImage.png" ;
45import Bug2BotLogo from "../../assets/images/Bug2Bot/bug2botLogo.svg" ;
56import Background1 from "../../assets/images/Bug2Bot/background1.png" ;
67import Background2 from "../../assets/images/Bug2Bot/background2.png" ;
78import Card1Background from "../../assets/images/Bug2Bot/card1_debug.png" ;
89import Card2Background from "../../assets/images/Bug2Bot/card2_build.png" ;
910import Card3Background from "../../assets/images/Bug2Bot/card3_conquer.png" ;
10- import React from "react" ;
1111
1212const targetDate = new Date ( "2025-01-24T12:00:00" ) ;
1313
@@ -20,6 +20,7 @@ const targetDate = new Date("2025-01-24T12:00:00");
2020 * @param {number } props.fontSize - Font size of the text
2121 * @param {string[] } props.gradientColors - Array of two colors for gradient
2222 */
23+
2324function GradientTextSVG ( { text, width, height, fontSize, gradientColors } ) {
2425 return (
2526 < svg height = { height } viewBox = { `0 0 ${ width } ${ height } ` } className = "w-full" >
@@ -47,34 +48,39 @@ function GradientTextSVG({ text, width, height, fontSize, gradientColors }) {
4748 ) ;
4849}
4950
51+ GradientTextSVG . propTypes = {
52+ text : PropTypes . string . isRequired ,
53+ width : PropTypes . number . isRequired ,
54+ height : PropTypes . number . isRequired ,
55+ fontSize : PropTypes . number . isRequired ,
56+ gradientColors : PropTypes . arrayOf ( PropTypes . string ) . isRequired ,
57+ } ;
58+
5059export default function Bug2Bot ( ) {
5160 const [ remainingTime , setRemainingTime ] = useState ( {
52- days : 0 ,
5361 hours : 0 ,
5462 minutes : 0 ,
5563 seconds : 0 ,
5664 } ) ;
5765
5866 const updateCountdown = ( ) => {
59- const now = new Date ( ) ; // Current date and time
60- const diff = targetDate . getTime ( ) - now . getTime ( ) ; // Difference in milliseconds
67+ const now = new Date ( ) ;
68+ const diff = targetDate . getTime ( ) - now . getTime ( ) ;
6169
6270 if ( diff <= 0 ) {
6371 setRemainingTime ( {
64- days : 0 ,
6572 hours : 0 ,
6673 minutes : 0 ,
6774 seconds : 0 ,
6875 } ) ;
69- return ; // Stop updating if the target time is reached
76+ return ;
7077 }
7178
72- const days = Math . floor ( diff / ( 1000 * 60 * 60 * 24 ) ) ;
7379 const hours = Math . floor ( ( diff % ( 1000 * 60 * 60 * 24 ) ) / ( 1000 * 60 * 60 ) ) ;
7480 const minutes = Math . floor ( ( diff % ( 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ) ;
7581 const seconds = Math . floor ( ( diff % ( 1000 * 60 ) ) / 1000 ) ;
7682
77- setRemainingTime ( { days , hours, minutes, seconds } ) ;
83+ setRemainingTime ( { hours, minutes, seconds } ) ;
7884 } ;
7985
8086 useEffect ( ( ) => {
@@ -117,8 +123,8 @@ export default function Bug2Bot() {
117123 backgroundImage : "linear-gradient(to right, #FD4445, #F2C849)" ,
118124 } }
119125 >
120- { remainingTime . days } Days { remainingTime . hours } Hours { " " }
121- { remainingTime . minutes } Mins
126+ { remainingTime . hours } Hours { remainingTime . minutes } Mins { " " }
127+ { remainingTime . seconds } Secs
122128 </ div >
123129 < div className = "font-orbitron text-2xl text-center" >
124130 Date: 24th & 25 th January
0 commit comments