"use client";
'use strict';

var NProgress = require('nprogress');
var navigation = require('next/navigation');
var React = require('react');
var lib = require('@windrun-huaiin/base-ui/lib');

// remove NProgress progress bar spinner circle
NProgress.configure({ showSpinner: false });
function NProgressBar() {
    const pathname = navigation.usePathname();
    const previousPath = React.useRef(pathname);
    React.useEffect(() => {
        document.documentElement.style.setProperty('--nprogress-bar-color', lib.themeSvgIconColor);
    }, []);
    React.useEffect(() => {
        if (previousPath.current !== pathname) {
            NProgress.start();
            setTimeout(() => {
                NProgress.done();
            }, 100);
            previousPath.current = pathname;
        }
    }, [pathname]);
    return null;
}

exports.NProgressBar = NProgressBar;
