'use client' import React, { useState, useEffect, useRef } from "react"; export default function Process() { const [activeStep, setActiveStep] = useState(-1); const [scrollProgress, setScrollProgress] = useState(0); const containerRef = useRef(null); const timelineRef = useRef(null); useEffect(() => { const handleScroll = () => { if (!containerRef.current || !timelineRef.current) return; const container = containerRef.current; const timeline = timelineRef.current; const rect = container.getBoundingClientRect(); const timelineHeight = timeline.scrollHeight - timeline.clientHeight; // Calculate when section enters viewport if (rect.top <= 0 && rect.bottom >= window.innerHeight) { // Section is sticky, scroll the timeline const progress = Math.abs(rect.top) / (rect.height - window.innerHeight); const clampedProgress = Math.max(0, Math.min(1, progress)); setScrollProgress(clampedProgress); timeline.scrollTop = clampedProgress * timelineHeight; } else if (rect.top > 0) { // Before sticky setScrollProgress(0); timeline.scrollTop = 0; } else { // After sticky setScrollProgress(1); timeline.scrollTop = timelineHeight; } }; window.addEventListener('scroll', handleScroll); handleScroll(); // Initial check return () => window.removeEventListener('scroll', handleScroll); }, []); const CalendarIcon = ( ); const steps = [ { number: "1", title: "2017", description: "Formation of Trauma Services", icon: CalendarIcon, }, { number: "2", title: "2020", description: "Establishment of the Department of Trauma Surgery under Dr. Sukria Nayak", icon: CalendarIcon, }, { number: "3", title: "May 2021", description: "Development of Trauma Protocols (MHTP, TROB, TRIP, Airway, Obstetric Trauma)", icon: CalendarIcon, }, { number: "4", title: "June 2022", description: "Inauguration of CMC Ranipet Campus: Level 1 Trauma Centre", icon: CalendarIcon, }, { number: "5", title: "November 2022", description: "Formation of T-ReCS (Trauma Registry – CMC – Pilot Study) under TCI-CMC Research Scholar Program", icon: CalendarIcon, }, { number: "6", title: "November 2022", description: "Integration of Multidisciplinary Trauma Services", icon: CalendarIcon, }, { number: "7", title: "November 2022", description: "Formation of Neurotrauma Unit", icon: CalendarIcon, }, { number: "8", title: "January 2023", description: "Accreditation of Trauma Radiology Fellowship", icon: CalendarIcon, }, { number: "9", title: "August 2023", description: "Inaugural ATLS® Course at CMC Vellore", icon: CalendarIcon, }, { number: "10", title: "September 2023", description: "First Research Publication from the Department", icon: CalendarIcon, }, { number: "11", title: "October 2023", description: "ACTraM Conference: Advances in Chest Trauma Management", icon: CalendarIcon, }, { number: "12", title: "October 2023", description: "CME Cadaveric Workshop", icon: CalendarIcon, }, { number: "13", title: "December 2023", description: "ICMR Trauma Quality Improvement Programme (TQIP) Initiated at CMC", icon: CalendarIcon, }, { number: "14", title: "February 2024", description: "HOPE Grant & RCPSG Trauma First Responder Outreach Programme", icon: CalendarIcon, }, { number: "15", title: "April 2024", description: "Launch of Masters of Trauma Online Lecture Series", icon: CalendarIcon, }, { number: "16", title: "April 2024", description: "Inaugural ATCN® Course for Nurses", icon: CalendarIcon, }, { number: "17", title: "July 2024", description: "MOU with GVK EMRI for Strengthening Pre-hospital Trauma Care", icon: CalendarIcon, }, { number: "18", title: "July 2024", description: "Accreditation for FNB in Trauma and Acute Care Surgery", icon: CalendarIcon, }, { number: "19", title: "January 2025", description: "Trauma Quality Workshop under ICMR-TQIP at CMC Vellore", icon: CalendarIcon, }, { number: "20", title: "March 2025", description: "Formation of CMC Trauma Quality Improvement Committee", icon: CalendarIcon, }, { number: "21", title: "July 2025", description: "Establishment of Trauma Orthopaedics Unit", icon: CalendarIcon, }, ]; // Calculate extra height needed for scroll effect const extraHeight = 2000; return (
{/* Left Column */}
Milestones

Our Journey in Trauma Care

From the formation of Trauma Services in 2017 to establishing a Level-1 Trauma Facility and comprehensive trauma care programs, we continue to expand our emergency care services with dedication and excellence.

{/* Right Column - Auto-scrolling Timeline */}
{steps.map((step, index) => (
setActiveStep(index)} onMouseLeave={() => setActiveStep(-1)} > {/* Connecting Line */} {index !== 0 && (
= index || (activeStep === -1 && index === 0) ? "h-full scale-y-100" : "h-0 scale-y-0" }`} style={{ backgroundColor: "#012068" }} />
)} {/* Step Content */}
{/* Number Circle */}
{step.number}
{/* Step Card */}
{/* Icon */}
{step.icon}
{/* Text */}

{step.title}

{step.description}

))}
); }