"use client"
import React, { useEffect, useRef } from "react"
import { useLocation } from "react-router-dom"

interface PageTransitionProps {
    children: React.ReactNode
}

// Simplified page transition - no loading delay for better LCP
const PageTransition = ({ children }: PageTransitionProps) => {
    const location = useLocation()
    const previousPathRef = useRef<string | null>(null)

    useEffect(() => {
        // Only scroll on path change, not on initial mount
        if (previousPathRef.current && location.pathname !== previousPathRef.current) {
            window.scrollTo(0, 0)
        }
        previousPathRef.current = location.pathname
    }, [location.pathname])

    return <>{children}</>
}

export default PageTransition
