This commit is contained in:
Kaushik Narayan R 2024-12-29 20:13:03 -07:00
parent 9894a0da59
commit 6d044d34d5
15 changed files with 60 additions and 55 deletions

View File

@ -60,7 +60,18 @@ function App() {
setAuth(true);
return true;
}
if (refreshResp.status >= 500) {
setAuth(false);
showErrorToastNotification(refreshResp.data.message);
return false;
}
if (refreshResp.status === 401) {
// not authed
setAuth(false);
return false;
}
setAuth(false);
showWarnToastNotification(refreshResp.data.message);
return false;
}
setAuth(false);

View File

@ -7,7 +7,8 @@ const AnimatedSVG = ({ stroke = "#ffffff" }) => {
{/* width, height and viewBox are necessary */}
<svg
xmlns="http://www.w3.org/2000/svg"
width="512" height="512" viewBox="0 0 512 512"
width="256" height="256" // adjust size here
viewBox="0 0 512 512"
preserveAspectRatio="xMidYMid meet"
>
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)">

View File

@ -1,5 +1,6 @@
.navbar_wrapper {
display: flex;
background-color: var(--bgNav);
flex-direction: column;
align-items: center;
justify-content: space-around;
@ -8,4 +9,5 @@
left: 0;
height: 100vh;
width: 10vw;
padding: var(--mb-3);
}

View File

@ -10,13 +10,12 @@ const Navbar = () => {
return (
<nav className={styles.navbar_wrapper}>
<StyledNavLink path="/" text="Home" />
<StyledNavLink path="/graph" text="Graph" />
<StyledNavLink path="/about" text="About" />
<StyledNavLink exact path="/" text="About" />
<StyledNavLink exact path="/graph" text="Graph" />
{
auth === true ?
<StyledNavLink path="/logout" text="Logout" /> :
<StyledNavLink path="/login" text="Login" />
<StyledNavLink exact path="/logout" text="Logout" /> :
<StyledNavLink exact path="/login" text="Login" />
}
</nav>
)

View File

@ -1,12 +1,18 @@
.link_wrapper {
padding: 2em;
border-radius: 20%;
a {
padding: var(--mb-3);
border-radius: 2%;
width: 100%;
cursor: pointer;
text-decoration: none;
color: var(--text);
}
.active_link {
background-color: var(--bgLinkActive);
box-shadow: 2px 2px black;
}
.inactive_link {
background-color: var(--bgLinkInactive);
box-shadow: 2px 2px var(--bg);
}

View File

@ -18,15 +18,14 @@ const StyledNavLink = ({
activeClass = styles.active_link,
inactiveClass = styles.inactive_link
}) => {
return (
<div className={styles.link_wrapper}>
<NavLink
to={path}
className={({ isActive }) => isActive ? activeClass : inactiveClass}
>
{text}
</NavLink>
</div>
<NavLink
to={path}
className={({ isActive }) => isActive ? activeClass : inactiveClass}
>
{text}
</NavLink>
)
}

View File

@ -3,33 +3,14 @@
/* Font Size */
:root {
--normalFontSize: 16px;
--headingFontSize: 24px;
--headingFont: AileronFont;
--primaryFont: AileronFont;
--text: whitesmoke;
--bgBlue: #040a53;
--darkBlue: #061320;
--vscBlue: #1b81a8;
--dYellow: #5b3c15;
--lYellow: #fcbe72;
--primary: #04005e;
--secondry: #440bd4;
--tertiary: #ff2079;
--accent: #e92efb;
--bg: #262626;
--blue1: #405de6;
--blue2: #5851d8;
--purple1: #833ab4;
--pink1: #c13584;
--pink2: #e1306c;
--red1: #fd1d1d;
--orange1: #f56040;
--orange2: #f77737;
--orange3: #fcaf45;
--orange4: #ffdc80;
--fun_b: #b00b69;
--fun_d: #1d1cc5;
--bg: #443c9c;
--bgNav: #6360b1;
--bgLinkActive: #362e7b;
--bgLinkInactive: #242c44;
}
/* Colors */
@ -97,7 +78,7 @@ body {
"Helvetica Neue", sans-serif;
font-size: var(--normalFontSize);
color: var(--text);
background-color: var(--bgBlue);
background-color: var(--bg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;

View File

@ -2,4 +2,5 @@
display: flex;
width: 100%;
height: 100vh;
color: black;
}

View File

@ -15,11 +15,15 @@ import styles from './Graph.module.css';
const initialNodes = [
{ id: '1', position: { x: 0, y: 0 }, data: { label: '1' } },
{ id: '2', position: { x: 0, y: 100 }, data: { label: '2' } },
{ id: '3', position: { x: 50, y: 50 }, data: { label: '3' } },
];
// const initialEdges = [];
const initialEdges = [
{ id: 'e1-2', source: '1', target: '2' }
];
const proOptions = { hideAttribution: true };
const Graph = () => {
const [playlistNodes, setNodes, onNodesChange] = useNodesState(initialNodes);
const [linkEdges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
@ -33,6 +37,8 @@ const Graph = () => {
<ReactFlow
nodes={playlistNodes}
edges={linkEdges}
fitView
proOptions={proOptions}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}

View File

@ -3,7 +3,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
font-size: var(--headingFontSize);
}
.app_logo {

View File

@ -1,7 +1,6 @@
import React, { useEffect } from "react"
import { useSearchParams } from "react-router-dom";
import styles from "./Landing.module.css"
import logo from '../../assets/icons/logo.svg';
import { showInfoToastNotification, showSuccessToastNotification } from "../../components/ToastNotification";
import AnimatedSVG from "../../components/AnimatedSVG";

View File

@ -2,5 +2,5 @@
display: flex;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
font-size: var(--headingFontSize);
}

View File

@ -2,5 +2,5 @@
display: flex;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
font-size: var(--headingFontSize);
}

View File

@ -14,21 +14,21 @@ const AllRoutes = () => {
<Routes>
{/* Routes that require user to be logged in */}
<Route element={<AuthOnlyRoutes />}>
<Route path="/logout" element={<Logout />} />
<Route path="/graph" element={<Graph />} />
{/* <Route path="/playlists" element={<Playlists />} /> */}
<Route exact path="/logout" element={<Logout />} />
<Route exact path="/graph" element={<Graph />} />
{/* <Route exact path="/playlists" element={<Playlists />} /> */}
</Route>
{/* Routes that require user to be logged *out* */}
<Route element={<UnAuthOnlyRoutes />}>
<Route path="/login" element={<Login />} />
<Route exact path="/login" element={<Login />} />
</Route>
{/* Common routes */}
<Route path="/" element={<Landing />} />
<Route exact path="/" element={<Landing />} />
{/* 404 */}
<Route path="/page-not-found" element={<PageNotFound />} />
<Route exact path="/page-not-found" element={<PageNotFound />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
);

View File

@ -13,7 +13,7 @@ function UnAuthOnlyRoutes() {
return <Outlet />;
} else {
showWarnToastNotification(<p>Already logged in!</p>);
return <Navigate to={"/graph"} state={{ from: location }} />;
return <Navigate to={"/"} state={{ from: location }} />;
}
};