'use client'

import { useEffect } from 'react'
import { usePathname } from 'next/navigation'

export function ReadySignal() {
    const pathname = usePathname()

    useEffect(() => {
        // Small delay ensures loader is visible before firing ready
        const t = setTimeout(() => {
            window.dispatchEvent(new Event('app:ready'))
        }, 300)

        return () => clearTimeout(t)
    }, [pathname])

    return null
}
