|
@ -1,20 +1,16 @@ |
|
|
import React from "react"; |
|
|
import React, { lazy, Suspense } from "react"; |
|
|
|
|
|
|
|
|
import { createRoot } from "react-dom/client"; |
|
|
import { createRoot } from "react-dom/client"; |
|
|
|
|
|
|
|
|
import useLocation from "wouter/use-location"; |
|
|
import useLocation from "wouter/use-location"; |
|
|
|
|
|
|
|
|
import Home from "./pages/main/Home"; |
|
|
|
|
|
import Exp from "./pages/main/Exp"; |
|
|
|
|
|
import Projects from "./pages/main/Projects"; |
|
|
|
|
|
import Contact from "./pages/main/Contact"; |
|
|
|
|
|
import Live from "./pages/main/Live"; |
|
|
|
|
|
|
|
|
|
|
|
import NotFound from "./pages/main/404"; |
|
|
|
|
|
import BlogHome from "./pages/blog/Home"; |
|
|
|
|
|
import { BlogPost } from "./pages/blog/components/BlogContent"; |
|
|
|
|
|
import { normalise } from "./util"; |
|
|
import { normalise } from "./util"; |
|
|
|
|
|
|
|
|
|
|
|
const Home = lazy(() => import("./pages/main/Home")); |
|
|
|
|
|
const Exp = lazy(() => import("./pages/main/Exp")); |
|
|
|
|
|
const Projects = lazy(() => import("./pages/main/Projects")); |
|
|
|
|
|
const Contact = lazy(() => import("./pages/main/Contact")); |
|
|
|
|
|
|
|
|
|
|
|
const NotFound = lazy(() => import("./pages/main/404")); |
|
|
|
|
|
|
|
|
function App() { |
|
|
function App() { |
|
|
const [location, navigate] = useLocation(); |
|
|
const [location, navigate] = useLocation(); |
|
|
|
|
|
|
|
@ -30,14 +26,16 @@ function App() { |
|
|
if (normalised.startsWith("/experience/")) return <Exp />; |
|
|
if (normalised.startsWith("/experience/")) return <Exp />; |
|
|
if (normalised === "/projects") return <Projects />; |
|
|
if (normalised === "/projects") return <Projects />; |
|
|
if (normalised === "/contact") return <Contact />; |
|
|
if (normalised === "/contact") return <Contact />; |
|
|
if (normalised === "/live") return <Live />; |
|
|
// if (normalised === "/live") return <Live />;
|
|
|
if (normalised === "/blog") return <BlogHome />; |
|
|
// if (normalised === "/blog") return <BlogHome />;
|
|
|
if (location.startsWith("/blog")) return <BlogPost />; |
|
|
// if (location.startsWith("/blog")) return <BlogPost />;
|
|
|
return <NotFound />; |
|
|
return <NotFound />; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createRoot(document.getElementById("root")!).render( |
|
|
createRoot(document.getElementById("root")!).render( |
|
|
<React.StrictMode> |
|
|
<React.StrictMode> |
|
|
<App /> |
|
|
<Suspense> |
|
|
|
|
|
<App /> |
|
|
|
|
|
</Suspense> |
|
|
</React.StrictMode>, |
|
|
</React.StrictMode>, |
|
|
); |
|
|
); |
|
|