import { Cache } from "three";
import React, { useEffect } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { LoggerProvider } from "./components/ui/log/LoggerContext";

import UserAuth from "./pages/UserAuth";
import ForgotPassword from "./pages/ForgotPassword";
import Dashboard from "./pages/Dashboard";
import Project from "./pages/Project";
import PageNotFound from "./pages/PageNotFound";

import "./styles/main.scss";

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 />} />
                    <Route path="*" element={<PageNotFound />} />
                </Routes>
            </Router>
        </LoggerProvider>
    );
};

export default App;
