diff --git a/frontend/src/app/components/Flicker/flicker.tsx b/frontend/src/app/components/Flicker/flicker.tsx new file mode 100644 index 0000000..7f18050 --- /dev/null +++ b/frontend/src/app/components/Flicker/flicker.tsx @@ -0,0 +1,51 @@ +"use client"; + +import { useEffect } from "react"; + +const SEQUENCE = [ + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 1000 }, + { glowing: [true,true,true,true,true,true,true,false,false,false,false], duration: 80 }, + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 2000 }, + { glowing: [false,true,true,false,true,true,false,false,false,true,true], duration: 80 }, + { glowing: [false,false,false,false,false,false,false,false,false,false,false], duration: 100 }, + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 2000 }, + { glowing: [false,false,false,false,false,false,false,false,false,false,false], duration: 100 }, + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 200 }, + { glowing: [false,false,false,false,false,false,false,false,false,false,false], duration: 100 }, + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 2000 }, + { glowing: [false,false,false,false,false,false,true,true,true,true,true], duration: 80 }, + { glowing: [true,true,true,true,true,true,false,false,false,true,true], duration: 80 }, + { glowing: [true,true,true,true,true,true,true,true,true,true,true], duration: 2000 }, + { glowing: [false,true,true,true,true,true,true,true,true,true,true], duration: 30 }, +]; + +interface FlickerProps { + onGlowChange?: (isGlowing: boolean) => void; +} + +export default function Flicker({ onGlowChange }: FlickerProps) { + useEffect(() => { + let timeout: ReturnType; + + const runSequence = (index: number) => { + const glowingArray = SEQUENCE[index].glowing; + + + const glowingCount = glowingArray.filter(Boolean).length; + const isGlowing = glowingCount > glowingArray.length * 0.7; + + onGlowChange?.(isGlowing); + + timeout = setTimeout(() => { + const next = (index + 1) % SEQUENCE.length; + runSequence(next); + }, SEQUENCE[index].duration); + }; + + runSequence(0); + + return () => clearTimeout(timeout); + }, [onGlowChange]); + + return null; +} \ No newline at end of file diff --git a/frontend/src/app/components/TrackWinner/TrackWinner.tsx b/frontend/src/app/components/TrackWinner/TrackWinner.tsx index 4ddb122..b48bbd8 100644 --- a/frontend/src/app/components/TrackWinner/TrackWinner.tsx +++ b/frontend/src/app/components/TrackWinner/TrackWinner.tsx @@ -1,53 +1,4 @@ -// "use client"; -// import type { ReactElement } from "react"; -// import Lottie from "lottie-react"; -// import confettiAnimation from "../../../../public/animations/confetti.json"; -// import { cabinetBlack, cabinetBold, cabinetRegular } from "@/app/utils/fonts"; -// import { useEffect, useRef } from "react"; -// export default function TrackWinner({ scrollProgress }: { scrollProgress: number }): ReactElement { -// const lottieRef = useRef(null); - -// useEffect(() => { -// if (!lottieRef.current) return; -// const anim = lottieRef.current; -// const totalFrames = anim.getDuration(true); -// const frame = Math.floor(scrollProgress * totalFrames); -// anim.goToAndStop(frame, true); -// }, [scrollProgress]); - -// return ( -//
-//
-//
-// -//
-//

-// Track Winner -//

-//
-//
-//
-//

-// New Track Added ! -//

-//

-// Rs. 15,000 -//

-//

-// per track -//

-//
-//
-//
-// ); -// } "use client"; import type { ReactElement } from "react"; import { DotLottieReact } from "@lottiefiles/dotlottie-react"; diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index b569788..9830772 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -38,6 +38,9 @@ .exp-gradient-background { background: linear-gradient(270deg, #F5C144 0%, #6633CC 100%); } + .blockchain-background { + background: linear-gradient(60deg, #6633CC 0%,#F5C144 150%); + } .text-primary-gradient-color { @apply bg-gradient-to-r from-primary from-1% to-secondary bg-clip-text text-transparent; diff --git a/frontend/src/app/sections/Tracks/TracksCard.tsx b/frontend/src/app/sections/Tracks/TracksCard.tsx index 86c0f24..33f6a7d 100644 --- a/frontend/src/app/sections/Tracks/TracksCard.tsx +++ b/frontend/src/app/sections/Tracks/TracksCard.tsx @@ -1,25 +1,27 @@ "use client"; -import { useState } from "react"; +import { useState, useEffect, useRef } from "react"; import TracksHeading from "@/app/components/Tracks/TracksHeadingCard"; +import TracksBodyCard from "@/app/components/Tracks/TracksBodyCard"; import InteractiveTechnologySVG from "@/app/assets/icons/InteractiveTechnology"; import InteractiveTechnologyNewSVG from "@/app/assets/icons/InteractiveTechnologyNew"; import DataScienceSVG from "@/app/assets/icons/DataScience"; -import BlockchainSVG from "@/app/assets/icons/Blockchain"; -import OpenInnovationSVG from "@/app/assets/icons/OpenInnovation"; -import EdTechSVG from "@/app/assets/icons/EdTech"; -import TracksBodyCard from "@/app/components/Tracks/TracksBodyCard"; -import { useRef } from "react"; import DataScienceNew from "@/app/assets/icons/DataScienceNew"; +import BlockchainSVG from "@/app/assets/icons/Blockchain"; import BlockchainNew from "@/app/assets/icons/BlockChainNew"; +import OpenInnovationSVG from "@/app/assets/icons/OpenInnovation"; import OpenInnovationNew from "@/app/assets/icons/OpenInnovationNew"; +import EdTechSVG from "@/app/assets/icons/EdTech"; import EdTechNew from "@/app/assets/icons/EdTechNew"; import EnvironmentTrackSVG from "@/app/assets/icons/EnvironmentTrack"; import EnvironmentTrackBodySVG from "@/app/assets/icons/EnvironmentTrackBody"; const TracksCard = () => { const [selectedTrack, setSelectedTrack] = useState( - "Interactive Technology", + "Interactive Technology" ); + const [animKey, setAnimKey] = useState(0); + + const autoSwitchTimer = useRef | null>(null); const trackData = [ { @@ -44,17 +46,17 @@ const TracksCard = () => { : "bg-violet hover:bg-purpures hover:text-magnolia transition-all duration-300", bodyStyling: "bg-purpures text-magnolia", description: - "Dive deep into the captivating realm of Data Analysis and Predictive Modeling, Leveraging algorithms and Artificial Intellignce.", + "Dive deep into the captivating realm of Data Analysis and Predictive Modeling, Leveraging algorithms and Artificial Intelligence.", }, { title: "Blockchain", svg: , - svgBody: , + svgBody: , headStyling: selectedTrack === "Blockchain" - ? "bg-magnolia text-dark-purple active" - : "bg-violet hover:bg-magnolia hover:text-dark-purple transition-all duration-300", - bodyStyling: "bg-magnolia text-dark-purple", + ? "blockchain-background text-white active" + : "bg-violet hover:blockchain-background hover:text-white transition-all duration-300", + bodyStyling: "blockchain-background text-white", description: "Embrace Decentralization with DeerHack. Explore smart contracts, secure transactions, and reshape industries at the forefront of innovation.", }, @@ -90,24 +92,48 @@ const TracksCard = () => { selectedTrack === "Environment" ? "gradient-bg text-magnolia active invert " : "bg-violet hover:gradient-bg hover:text-magnolia hover:invert transition-all duration-300", - bodyStyling: "gradient-bg text-magnolia invert transition-all duration-300", + bodyStyling: + "gradient-bg text-magnolia invert transition-all duration-300", description: "Think Green, Code Clean at DeerHack. Dive into the world of climate-positive innovation. Turn environmental challenges into elegant, scalable, and sustainable tech solutions.", }, ]; + // Function to handle track selection manually const handleTrackSelection = (title: string) => { setSelectedTrack(title); + setAnimKey((prev) => prev + 1); + resetAutoSwitchTimer(); + }; + + // Auto switch logic + const resetAutoSwitchTimer = () => { + if (autoSwitchTimer.current) clearTimeout(autoSwitchTimer.current); + + autoSwitchTimer.current = setTimeout(() => { + const currentIndex = trackData.findIndex( + (track) => track.title === selectedTrack + ); + const nextIndex = (currentIndex + 1) % trackData.length; + setSelectedTrack(trackData[nextIndex].title); + setAnimKey((prev) => prev + 1); + resetAutoSwitchTimer(); // schedule next switch + }, 10000); // 8 seconds }; - const containerRef = useRef(null); + // Start auto-switch when component mounts + useEffect(() => { + resetAutoSwitchTimer(); + return () => { + if (autoSwitchTimer.current) clearTimeout(autoSwitchTimer.current); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedTrack]); return ( -
- +
{trackData.map((track, index) => ( { {trackData.map( (track, index) => selectedTrack === track.title && ( - - ), +
+ +
+ ) )}
); }; -export default TracksCard; +export default TracksCard; \ No newline at end of file diff --git a/frontend/src/app/sections/home/Hero.tsx b/frontend/src/app/sections/home/Hero.tsx index 1132b07..953c7a4 100644 --- a/frontend/src/app/sections/home/Hero.tsx +++ b/frontend/src/app/sections/home/Hero.tsx @@ -5,20 +5,40 @@ import styles from "./styles.module.css"; import DeerHack26Logo from "@/app/assets/icons/Deerhack26"; import { cabinetBold, cabinetMedium, satoshiBlack, satoshiBold } from "@/fonts"; import Link from "next/link"; +// import { useState, useEffect } from "react"; +import Flicker from "@/app/components/Flicker/flicker"; +import { useState, useCallback } from "react"; + const Hero = () => { + const [isGlowing, setIsGlowing] = useState(true); + +const handleGlowChange = useCallback((allGlowing: boolean) => { + setIsGlowing(allGlowing); +}, []); return (
{/*Original div -->
*/} -
-

+ +

- 12th - 14th June + 12th - 14th June

{/*