import React, { useEffect } from "react";
import { Cache } from "three";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Dashboard from "./pages/Dashboard";
import Project from "./pages/Project";
import UserAuth from "./pages/UserAuth";
import "./styles/main.scss";
import { LoggerProvider } from "./components/ui/log/LoggerContext";
import ForgotPassword from "./pages/ForgotPassword";

const App: React.FC = () => {

  useEffect(() => {
    Cache.clear();
    Cache.enabled = true;
  }, []);

  return (
    <LoggerProvider>
      <Router>
        <Routes>
          <Route path="/" element={<UserAuth />} />
          <Route path="/forgot" element={<ForgotPassword />} />
          <Route path="/dashboard" element={<Dashboard />} />
          <Route path="/projects/:projectId" element={<Project />} />
        </Routes>
      </Router>
    </LoggerProvider>
  );
};

export default App;
