"use client";

import { useEffect } from "react";
import $ from "jquery";
import { ToastContainer } from "react-toastify";
import ProfileProvider from "../context/ProfileContext";
import ScrollToTop from "../components/ScrollToTop";
import { GeneralSettingsProvider } from "@/context/GeneralSettingsContext";

export default function Providers({ children }) {
  useEffect(() => {
    window.$ = $;
    window.jQuery = $;
  }, []);

  return (
    <ProfileProvider>
      <GeneralSettingsProvider>
        <ScrollToTop />
        {children}
        <ToastContainer
          position="top-right"
          autoClose={3000}
          hideProgressBar={false}
          newestOnTop={false}
          closeOnClick
          rtl={false}
          pauseOnFocusLoss
          draggable
          pauseOnHover
          theme="colored"
        />
      </GeneralSettingsProvider>
    </ProfileProvider>
  );
}
