Skip to content

Commit 02ec24f

Browse files
Merge pull request #90 from codexsit/feat/bug2bot
feat: remove date and seconds
2 parents 034ace5 + cdd7132 commit 02ec24f

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/components/Footer/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Footer() {
3333
</p>
3434
<div className="flex flex-col sm:flex-row items-center gap-4 md:w-full">
3535
<img src={SitLogo} alt="Symbiosis Logo" className="h-12" />
36-
<div className="hidden sm:block w-px h-12 bg-secondary-light"></div>
36+
<div className="hidden sm:block w-px h-12 bg-secondary-light" />
3737
<img
3838
src={Logo}
3939
alt="CodeX Logo"

src/pages/Bug2Bot/index.jsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import PageTransition from "@/components/PageTransition";
21
import { useEffect, useState } from "react";
2+
import PropTypes from "prop-types";
3+
import PageTransition from "@/components/PageTransition";
34
import MazeImage from "../../assets/images/Bug2Bot/mazeImage.png";
45
import Bug2BotLogo from "../../assets/images/Bug2Bot/bug2botLogo.svg";
56
import Background1 from "../../assets/images/Bug2Bot/background1.png";
67
import Background2 from "../../assets/images/Bug2Bot/background2.png";
78
import Card1Background from "../../assets/images/Bug2Bot/card1_debug.png";
89
import Card2Background from "../../assets/images/Bug2Bot/card2_build.png";
910
import Card3Background from "../../assets/images/Bug2Bot/card3_conquer.png";
10-
import React from "react";
1111

1212
const 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+
2324
function 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+
5059
export 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 & 25th January

0 commit comments

Comments
 (0)