Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"axios": "^1.7.2",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dompurify": "^3.1.7",
"framer-motion": "^11.11.9",
"lottie-react": "^2.4.0",
"lucide-react": "^0.400.0",
"next": "^14.2.5",
"radix-ui": "^1.0.1",
Expand All @@ -31,6 +34,8 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@types/dompurify": "^3.0.5",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand Down
1 change: 1 addition & 0 deletions public/assets/todo_pending_animation.json

Large diffs are not rendered by default.

44 changes: 36 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,49 @@
import './App.css';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { useState, useEffect } from 'react';
import Mentors from './pages/root/mentor';
import Login from './pages/auth/Login';
import Singup from './pages/auth/Singup';
import Signup from './pages/auth/Singup';
import ForgotPassword from './pages/auth/ForgotPassword';
import Student from './pages/student';
import Dashboard from './pages/root/dashboard/page';
import Loader from './pages/root/Loader';

function App() {
const [isAuthenticated, setIsAuthenticated] = useState(false);
const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
const token = localStorage.getItem('token');
setIsAuthenticated(!!token);


setIsLoading(false);
}, []);

if (isLoading) {
return <Loader />;
}

return (
<BrowserRouter>
<Routes>
<Route path='/' element={<Navigate to="/login" />} />
<Route path='/mentors' element={<Mentors />} />
<Route path='/login' element={<Login />} />
<Route path='/signup' element={<Singup />} />
<Route path='/forgotpassword' element={<ForgotPassword />} />
<Route path='/studentdetails/:id' element={<Student />} />

<Route
path="/"
element={isAuthenticated ? <Dashboard /> : <Login/>}
/>
<Route
path="/mentors"
element={isAuthenticated ? <Mentors /> : <Login />}
/>
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route path="/forgotpassword" element={<ForgotPassword />} />
<Route
path="/studentdetails/:id"
element={isAuthenticated ? <Student /> : <Login />}
/>
</Routes>
</BrowserRouter>
);
Expand Down
122 changes: 122 additions & 0 deletions src/actions/planner_actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"use server";

import { getCookie } from "./cookie_actions";
import { revalidateTag } from "next/cache";

export const getPlanner = async () => {
const token = await getCookie("token");

try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_STUDENT_API_BASE_URL}/api/planner/get`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Cookie: `token=${token}`,
},
credentials: "include",
// cache: "force-cache",
next: {
tags: ["plannerData"],
},
}
);

const responseData = await res.json();

return responseData;
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Error fetching planner data: ${error.message}`);
} else {
throw new Error("An unknown error occurred while fetching planner data!");
}
}
};

export const createPlanner = async () => {
const token = await getCookie("token");

try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_STUDENT_API_BASE_URL}/api/planner/create`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Cookie: `token=${token}`,
},
credentials: "include",
}
);

const responseData = await res.json();

return responseData;
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Error creating planner: ${error.message}`);
} else {
throw new Error("An unknown error occurred while creating planner!");
}
}
};

export const updatePlanner = async () => {
const token = await getCookie("token");

try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_STUDENT_API_BASE_URL}/api/planner/update`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Cookie: `token=${token}`,
},
credentials: "include",
}
);

const responseData = await res.json();
revalidateTag("plannerData");

return responseData;
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Error creating planner: ${error.message}`);
} else {
throw new Error("An unknown error occurred while creating planner!");
}
}
};

export const allocateBackTopics = async () => {
const token = await getCookie("token");

try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_STUDENT_API_BASE_URL}/api/planner/allocateTopics`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
Cookie: `token=${token}`,
},
credentials: "include",
}
);

const responseData = await res.json();
revalidateTag("plannerData");

return responseData;
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Error creating planner: ${error.message}`);
} else {
throw new Error("An unknown error occurred while creating planner!");
}
}
};
1 change: 1 addition & 0 deletions src/apiClient/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const apiClient = axios.create({
headers: {
'Content-Type': 'application/json',
},

});

apiClient.interceptors.request.use(
Expand Down
1 change: 1 addition & 0 deletions src/assets/todo_pending_animation.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/components/icons/AttachIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { IIconProps } from "../../helpers/types";
import { cn } from "../../lib/utils";

const AttachIcon = ({ className, ...props }: IIconProps) => {
return (
<svg
viewBox="0 0 19 31"
xmlns="http://www.w3.org/2000/svg"
className={cn(
"w-[10px] h-5 stroke-[#6a6a6a] stroke-[3] fill-none",
className
)}
{...props}>
<path
d="M17 11L17 20C17 24.9706 13.6421 29 9.5 29C5.35786 29 2 24.9706 2 20L2 8C2 4.68629 4.23858 2 7 2C9.76142 2 12 4.68629 12 8L12 20C12 21.6569 10.8807 23 9.5 23C8.11929 23 7 21.6569 7 20L7 8"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
};

export default AttachIcon;
20 changes: 20 additions & 0 deletions src/components/icons/CallIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { IIconProps } from "../../helpers/types";
import { cn } from "../../lib/utils";

const CallIcon = ({ className, ...props }: IIconProps) => {
return (
<svg
viewBox="0 0 33 33"
xmlns="http://www.w3.org/2000/svg"
className={cn("w-5 h-5 fill-none stroke-black stroke-[2.6]", className)}
{...props}>
<path
d="M23.2865 31.0698C12.8729 28.2243 4.78215 19.8461 2.30183 9.33959C1.36286 5.36218 4.82893 2.05775 8.91506 2.12908L10.7647 2.16136C11.7862 2.17919 12.5901 3.02365 12.6732 4.04196C12.8134 5.7624 13.1898 7.41786 13.7703 8.97518L10.9112 11.7363C13.0186 16.345 16.6593 20.115 21.1917 22.3821L24.0509 19.621C25.587 20.2555 27.2283 20.6895 28.9428 20.8897C29.9576 21.0082 30.7735 21.8411 30.7557 22.8626L30.7234 24.7123C30.6521 28.7984 27.2287 32.147 23.2865 31.0698Z"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
};

export default CallIcon;
Loading