back. WiP

graph package (reactflow), updates. assets, some of the SEO. started with some basic components, login, navbar, etc.
This commit is contained in:
2024-12-28 12:12:17 -07:00
parent cc682254df
commit c1bc6177d8
36 changed files with 5423 additions and 18018 deletions

36
src/routes/AllRoutes.jsx Normal file
View File

@@ -0,0 +1,36 @@
import { Route, Routes } from "react-router-dom";
import AuthOnlyRoutes from "./AuthOnlyRoutes";
import UnAuthOnlyRoutes from "./UnAuthOnlyRoutes";
import Landing from "../pages/Landing";
import PageNotFound from "../pages/PageNotFound";
import Graph from "../pages/Graph";
import Login from "../pages/Login";
const AllRoutes = () => {
return (
<Routes>
{/* Routes that require user to be logged in */}
<Route element={<AuthOnlyRoutes />}>
<Route path="/graph" element={<Graph />} />
{/* <Route path="/playlists" element={<Playlists />} /> */}
</Route>
{/* Routes that require user to be logged *out* */}
<Route element={<UnAuthOnlyRoutes />}>
<Route path="/login" element={<Login />} />
</Route>
{/* Common routes */}
<Route path="/" element={<Landing />} />
<Route path="/graph2" element={<Graph />} />
{/* 404 */}
<Route path="/page-not-found" element={<PageNotFound />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
);
};
export default AllRoutes;

View File

@@ -0,0 +1,23 @@
import React, { useContext } from "react";
import { Navigate, Outlet, useLocation } from "react-router-dom";
import { AuthContext } from "../App";
import { showWarnToastNotification } from "../components/ToastNotification";
function AuthOnlyRoutes() {
let location = useLocation();
const auth = useContext(AuthContext);
const handleRouteRender = () => {
if (auth !== true) {
showWarnToastNotification(<p>Sign in, please!</p>);
return <Navigate to={"/login"} state={{ from: location }} />;
} else {
return <Outlet />;
}
};
return handleRouteRender();
}
export default AuthOnlyRoutes;

View File

@@ -0,0 +1,23 @@
import React, { useContext } from "react";
import { Navigate, Outlet, useLocation } from "react-router-dom";
import { AuthContext } from "../App";
import { showWarnToastNotification } from "../components/ToastNotification";
function UnAuthOnlyRoutes() {
let location = useLocation();
const auth = useContext(AuthContext);
const handleRouteRender = () => {
if (auth !== true) {
return <Outlet />;
} else {
showWarnToastNotification(<p>Already logged in!</p>);
return <Navigate to={"/graph"} state={{ from: location }} />;
}
};
return handleRouteRender();
}
export default UnAuthOnlyRoutes;