import { Routes, Route, Navigate } from "react-router-dom";
import Toolbar from "@mui/material/Toolbar";
import Delta from "./pages/delta/Delta.jsx";
import Resume from "./pages/resume/Resume.jsx";
import { useScrollToLocation } from "./hooks.jsx";

const redirects = [
  { path: "/r1", rewrite: "/resume" },
  { path: "/r2", rewrite: "/resume" },
  { path: "/r3", rewrite: "/resume" },
];
export default function Routing() {
  useScrollToLocation();
  return (
    <div className="view">
      <Toolbar disableGutters />
      <Routes>
        <Route path="/" element={<Delta />} />
        {/* <Route path="/resume" element={<Resume />} /> */}
        {redirects.map((r, i) => (
          <Route key={i} path={r.path} element={<Navigate to={r.rewrite} />} />
        ))}
        <Route path="*" element={<Navigate to="/" replace />} />
        <Route path="/*" element={<Navigate to="/" replace />} />
      </Routes>
    </div>
  );
}
