import { RouterProvider } from "react-router-dom";
import { App as AntdApp } from "antd";
import { router } from "./router";
import { ThemeProvider } from "./contexts/ThemeContext";
import { setNotificationInstance } from "./components/Toast/Toast";
import "./i18n";

// Component to extract static functions from App
const AntdStaticHolder = () => {
  const { notification } = AntdApp.useApp();
  setNotificationInstance(notification);
  return null;
};

export default function App() {
  return (
    <ThemeProvider>
      <AntdApp>
        <AntdStaticHolder />
        <RouterProvider router={router} />
      </AntdApp>
    </ThemeProvider>
  );
}
