import { useState, useEffect } from "react"; import { BackTop } from "antd"; import Router from "./routes"; import { Provider } from "react-redux"; import store from "./app/store"; import "./i18n/i18n"; import PageLoader from "./components/Loader/pageLoader.jsx"; import ScrollToTop from "./components/ScrollToTop"; import { AuthProvider } from "./context/authContext.jsx"; function App() { const [isLoading, setIsLoading] = useState(true); const [isVisible, setIsVisible] = useState(false); useEffect(() => { const timer = setTimeout(() => { setIsLoading(false); }, 1000); return () => clearTimeout(timer); }, []); const handleScroll = () => { const scrollPosition = window.scrollY; if (scrollPosition > 200) { setIsVisible(true); } else { setIsVisible(false); } }; useEffect(() => { window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); return ( {isLoading ? (
) : ( <> {isVisible && (
)} )}
); } export default App;