Added frontend folder structure in Ombase's branch

This commit is contained in:
K
2025-02-22 13:00:33 +05:30
parent 33b5c9ccc8
commit 75f31b5b93
60 changed files with 9080 additions and 0 deletions
+202
View File
@@ -0,0 +1,202 @@
import React from "react";
const Dashboard = () => {
return (
<>
<div className="w-full bg-white rounded-lg shadow p-4">
<div className="flex flex-col justify-center items-center mb-4">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Upcoming Sessions{" "}
</h2>
<div className="bg-gray-300 w-full h-52 rounded-lg"></div>
</div>
<div className="mb-4">
<h3 className="text-lg font-medium">Recent Activity</h3>
<p className="text-gray-500 text-sm mt-2">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
<div className="grid grid-cols-1 gap-4 mt-4">
<input type="range" className="w-full h-auto" readOnly:true/>
<div className="bg-gray-100 rounded-lg p-4 flex justify-between items-center">
<div className="flex items-center">
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 text-green-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="2"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M13 7l5 5m0 0l-5 5m5-5H6"
/>
</svg>
<span className="ml-2 font-medium">Topup</span>
</div>
<div className="flex items-center">
<span className="text-gray-500 text-sm">06:24:45 AM</span>
<span className="ml-2 text-green-500 text-sm">+$5,553</span>
</div>
</div>
</div>
</div>
<div className="mb-4">
<h3 className="text-lg font-medium">Weekly Summary</h3>
<div className="grid grid-cols-8 gap-2 mt-4">
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Sun</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Mon</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Tue</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Wed</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Thu</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Fri</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Sat</span>
</div>
<div className="col-span-1 flex flex-col justify-between items-center bg-gray-100 rounded-lg p-2">
<span className="text-gray-500 text-xs">Completed</span>
</div>
</div>
<div className="grid grid-cols-8 gap-2 mt-2">
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-16"></div>
<div className="bg-gray-300 h-4"></div>
<div className="bg-red-500 rounded-b-lg h-16"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-20"></div>
<div className="bg-gray-300 h-8"></div>
<div className="bg-red-500 rounded-b-lg h-12"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-12"></div>
<div className="bg-gray-300 h-12"></div>
<div className="bg-red-500 rounded-b-lg h-20"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-24"></div>
<div className="bg-gray-300 h-4"></div>
<div className="bg-red-500 rounded-b-lg h-8"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-16"></div>
<div className="bg-gray-300 h-12"></div>
<div className="bg-red-500 rounded-b-lg h-16"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-16"></div>
<div className="bg-gray-300 h-4"></div>
<div className="bg-red-500 rounded-b-lg h-24"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-green-500 rounded-t-lg h-8"></div>
<div className="bg-gray-300 h-16"></div>
<div className="bg-red-500 rounded-b-lg h-20"></div>
</div>
<div
className="col-span-1 flex flex-col justify-between items-center rounded-lg p-2"
style={{ height: "100px" }}
>
<div className="bg-gray-300 h-24"></div>
<div className="bg-gray-300 h-24"></div>
<div className="bg-gray-300 h-24"></div>
</div>
</div>
</div>
<div className="mb-4">
<h3 className="text-lg font-medium">Notifications</h3>
<div className="grid grid-cols-1 gap-4 mt-4">
<div className="bg-gray-100 rounded-lg p-4 flex justify-between items-center">
<div className="flex items-center">
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 text-green-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="2"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M13 7l5 5m0 0l-5 5m5-5H6"
/>
</svg>
<span className="ml-2 font-medium">Topup</span>
</div>
<div className="flex items-center">
<span className="text-gray-500 text-sm">06:24:45 AM</span>
<span className="ml-2 text-green-500 text-sm">+$5,553</span>
</div>
</div>
</div>
<div className="grid grid-cols-1 gap-4 mt-4">
<div className="bg-gray-100 rounded-lg p-4 flex justify-between items-center">
<div className="flex items-center">
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 text-green-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth="2"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M13 7l5 5m0 0l-5 5m5-5H6"
/>
</svg>
<span className="ml-2 font-medium">Topup</span>
</div>
<div className="flex items-center">
<span className="text-gray-500 text-sm">06:24:45 AM</span>
<span className="ml-2 text-green-500 text-sm">+$5,553</span>
</div>
</div>
</div>
</div>
</div>
</>
);
};
export default Dashboard;
@@ -0,0 +1,9 @@
import React from 'react'
const FeedBackAndRatings = () => {
return (
<></>
)
}
export default FeedBackAndRatings
+10
View File
@@ -0,0 +1,10 @@
import React from 'react'
const History = () => {
return (
<>
<div className=""></div></>
)
}
export default History
@@ -0,0 +1,261 @@
import React from "react";
import { Link, Outlet, useNavigate } from "react-router-dom";
import { BsThreeDotsVertical } from "react-icons/bs";
import { RiLogoutBoxLine } from "react-icons/ri";
import { IoMdSettings } from "react-icons/io";
import { FaHome } from "react-icons/fa";
import { useSelector } from "react-redux";
import { MdHistory } from "react-icons/md";
import { IoIosNotifications } from "react-icons/io";
import { MdFeedback } from "react-icons/md";
import { MdOutlineSupportAgent } from "react-icons/md";
import { IoSettings } from "react-icons/io5";
import { RiCalendarScheduleLine } from "react-icons/ri";
import { IoIosHome } from "react-icons/io";
import { BACKEND_URL } from "../../constants";
const MainUserPanel = () => {
const navigate = useNavigate();
const handleLogOut = async () => {
const responce = await fetch(`${BACKEND_URL}/api/v1/logout`, {
method: "Get",
credentials: "include",
});
const data = await responce.json();
//console.log("User Logged out data is : ", data);
if (data.success == true) {
navigate("/user/login");
}
};
const user = useSelector((store) => store.user);
return (
<>
<div className="container mx-auto p-4 ">
<div className="flex items-center mb-4 md:hidden">
<img
src={`${user.avatar}`}
alt="Profile Picture"
className="rounded-full w-10 h-10 mr-2"
/>
<span className="text-lg font-medium">Hello, {user.name}</span>
</div>
<div className="flex flex-row gap-4">
<div className="w-1.5/12 md:w-3/12 bg-white rounded-lg shadow p-4">
<div className="hidden md:flex items-center mb-4">
<img
src={`${user.avatar}`}
alt="Profile Picture"
className="rounded-full w-10 h-10 mr-2"
/>
<span className="text-lg font-medium">Hello, {user.name}</span>
</div>
<ul className="list-none">
<li className="py-2 border-b border-gray-200">
<Link to={"/user/dashboard"} className="flex items-center">
<IoIosHome className="text-xl font-bold text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Dashboard
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/scheduledmeetings"}
className="flex items-center"
>
<RiCalendarScheduleLine className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Scheduled Meeting
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/history"}
className="flex items-center"
>
<MdHistory className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
History
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/notifications"}
className="flex items-center"
>
<IoIosNotifications className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Notifications
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/feedback"}
className="flex items-center"
>
<MdFeedback className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Feedback and Ratings
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/support"}
className="flex items-center"
>
<MdOutlineSupportAgent className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Support
</span>
</Link>
</li>
<li className="py-2 border-b border-gray-200">
<Link
to={"/user/dashboard/settings"}
className="flex items-center"
>
<IoSettings className="text-xl text-gray-700" />
<span className="ml-2 text-sm font-semibold text-gray-500 hidden md:block">
Settings
</span>
</Link>
</li>
</ul>
</div>
<Outlet />
<div className="hidden md:block w-3/12 bg-white rounded-lg shadow p-4 h-96">
<div className="flex justify-between items-center mb-4">
<h3 className="text-lg font-medium">My Profile</h3>
<div className="flex items-center md:order-2 space-x-3 md:space-x-0 rtl:space-x-reverse">
<button
type="button"
className="flex text-sm rounded-full md:me-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"
id="user-menu-button"
aria-expanded="false"
data-dropdown-toggle="user-dropdown"
data-dropdown-placement="bottom"
>
<span className="sr-only">Open user menu</span>
<BsThreeDotsVertical className="text-lg" />
</button>
{/* <!-- Dropdown menu --> */}
<div
className="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow dark:bg-gray-700 dark:divide-gray-600"
id="user-dropdown"
>
<div className="px-4 py-3">
<span className="block text-sm text-gray-900 dark:text-white">
Bonnie Green
</span>
<span className="block text-sm text-gray-500 truncate dark:text-gray-400">
name@flowbite.com
</span>
</div>
<ul className="py-2" aria-labelledby="user-menu-button">
<li>
<Link
to={"/user/dashboard"}
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
>
Dashboard
</Link>
</li>
<li>
<a
href="#"
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
>
Settings
</a>
</li>
<li>
<a
href="#"
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
>
Earnings
</a>
</li>
<li>
<a
onClick={handleLogOut}
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
>
Sign out
</a>
</li>
</ul>
</div>
<button
data-collapse-toggle="navbar-user"
type="button"
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
aria-controls="navbar-user"
aria-expanded="false"
>
<span className="sr-only">Open main menu</span>
<svg
className="w-5 h-5"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 17 14"
>
<path
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M1 1h15M1 7h15M1 13h15"
/>
</svg>
</button>
</div>
</div>
<div class="mb-4">
<img
src={`${user.avatar}`}
alt="Profile Picture"
class="rounded-full w-24 h-24 mx-auto"
/>
<h4 class="text-lg font-medium mt-2">{user.name}</h4>
{/* <span class="text-gray-500 text-sm">@thomasdox</span> */}
<p class="text-gray-500 text-sm mt-2">
Join on {user.createdAt && user.createdAt.substring(0, 10)}
</p>
<p class="text-gray-500 text-sm mt-2">
{user.description == null &&
"I am a Senior Software Engineer at Google and also mentored 50+ students to get there dream job."}
</p>
<div class="flex justify-center mt-4">
<button class="bg-gray-300 hover:bg-gray-400 text-gray-700 font-bold py-2 px-4 rounded mr-2">
<FaHome className="text-lg font-extrabold" />
</button>
<button class="bg-gray-300 hover:bg-gray-400 text-gray-700 font-bold py-2 px-4 rounded mr-2">
<IoMdSettings className="text-lg font-extrabold" />
</button>
<button
class="bg-gray-300 hover:bg-gray-400 text-gray-700 font-bold py-2 px-4 rounded"
onClick={handleLogOut}
>
<RiLogoutBoxLine className="text-lg font-extrabold" />
</button>
</div>
</div>
</div>
</div>
</div>
</>
);
};
export default MainUserPanel;
@@ -0,0 +1,100 @@
import React from "react";
import { useSelector } from "react-redux";
const MentorSessionCard = ({ session }) => {
const {
id,
mentorName,
mentorMail,
mentorAvatar,
studentName,
studentMail,
studentAvatar,
roomid,
schduledTime,
createdAt,
updatedAt,
amountPaid,
status,
} = session;
const user = useSelector((store) => store.user);
//console.log("User in the Dashborde : ");
let timeStringToDayName = (dateStr) => {
// for getting day name by time string
// const dateStr = "2024-09-26T04:31:50.646+00:00";
const date = new Date(dateStr);
const dayName = date.toLocaleDateString("en-US", { weekday: "long" });
//console.log(dayName);
return dayName;
};
let timeStringtoRealTime = (utcDateStr) => {
// for converting the to get time in am or pm
//const utcDateStr = "2024-09-26T04:31:50.646+00:00";
const date = new Date(utcDateStr);
// India TimeZone is Asia/Kolkata, which is UTC+5:30
const options = {
timeZone: "Asia/Kolkata",
hour: "numeric",
minute: "numeric",
second: "numeric",
hour12: true,
year: "numeric",
month: "long",
day: "numeric",
};
const istDate = date.toLocaleString("en-US", options);
console.log(istDate); // Output: "September 26, 2024, 10:01:50 AM"
return istDate;
};
const realTimeString = timeStringtoRealTime(schduledTime);
return (
<>
<li class="flex flex-col gap-5 w-full h-auto max-h-28 px-3 py-1 rounded-md hover:bg-slate-100 border-b-2">
<div class="flex items-center">
<div class="flex-shrink-0">
<img
class="w-8 h-8 rounded-full"
src="/images/profile.jpeg"
alt="Neil image"
/>
</div>
<div class="flex-1 min-w-0 ms-4">
<p class="text-sm font-medium text-gray-900 truncate dark:text-white">
{user.role === "user" ? mentorName : studentName}
</p>
<p class="text-sm text-gray-500 truncate dark:text-gray-400">
{user.role === "user" ? mentorMail : studentMail}
</p>
</div>
<div class="inline-flex items-center text-base font-semibold text-gray-900 dark:text-white">
{amountPaid}
</div>
</div>
<div className="flex justify-between">
<div className="flex items-center">
<div>
<p className="text-gray-500">
{timeStringToDayName(schduledTime)},
{realTimeString.substring(21, 26) +
" " +
realTimeString.substring(30)}
</p>
</div>
</div>
<div className="flex items-center">
<p className="text-gray-500">{realTimeString.substring(0, 18)}</p>
</div>
</div>
</li>
</>
);
};
export default MentorSessionCard;
@@ -0,0 +1,120 @@
import React from "react";
import Notification from "../../components/Notification";
const Notifications = () => {
let notifications = [
{
id: 1,
type: "success",
message: "Your profile has been updated successfully.",
timestamp: "2024-09-26T10:00:00Z",
isRead: false,
},
{
id: 2,
type: "warning",
message: "Your subscription is about to expire in 3 days.",
timestamp: "2024-09-25T09:30:00Z",
isRead: false,
},
{
id: 3,
type: "info",
message: "New mentor has joined your network.",
timestamp: "2024-09-24T15:45:00Z",
isRead: false,
},
{
id: 4,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 5,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 6,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 7,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 8,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 9,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
{
id: 10,
type: "error",
message: "Failed to connect to the video call. Please try again.",
timestamp: "2024-09-26T08:20:00Z",
isRead: false,
},
];
// for getting day name by time string
// const dateStr = '2024-09-26T04:31:50.646+00:00';
// const date = new Date(dateStr);
// const dayName = date.toLocaleDateString('en-US', { weekday: 'long' });
// console.log(dayName); // Output: "Thursday"
// for converting the to get time in am or pm
// const utcDateStr = '2024-09-26T04:31:50.646+00:00';
// const date = new Date(utcDateStr);
// India TimeZone is Asia/Kolkata, which is UTC+5:30
// const options = {
// timeZone: 'Asia/Kolkata',
// hour: 'numeric',
// minute: 'numeric',
// second: 'numeric',
// hour12: true,
// year: 'numeric',
// month: 'long',
// day: 'numeric'
// };
// const istDate = date.toLocaleString('en-US', options);
// console.log(istDate); // Output: "September 26, 2024, 10:01:50 AM"
return (
<>
<div className="w-full bg-white rounded-lg shadow p-4 min-h-[85vh]">
<div className="flex flex-col justify-center items-center mb-4">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Notifications
</h2>
</div>
<div className="flex flex-col w-full gap-2">
{notifications.map((notification) => (
<Notification key={notification.id} notification={notification} />
))}
</div>
</div>
</>
);
};
export default Notifications;
@@ -0,0 +1,131 @@
import React from "react";
import MentorSessionCard from "./MentorSessionCard";
const ScheduleMeeting = () => {
let meetingInfo = [
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
{
id: "7K6dU5qLpF9tS4",
mentorName: "mentor",
mentorMail: "mentor4@gmail.com",
mentorAvatar: "/images/profile4.jpeg",
studentName: "student",
studentMail: "student4@gmail.com",
studentAvatar: "/images/profile4.jpeg",
roomid: "F7mT9rV5uP3sL2K7cJ8xH4zG1yW5aQ9nD2o",
schduledTime: "2024-09-29T11:20:40.456+00:00",
createdAt: "2024-09-29T11:20:40.456+00:00",
updatedAt: "2024-09-29T11:20:40.456+00:00",
amountPaid: "550",
status: false,
},
];
return (
<>
<div className="w-full bg-white rounded-lg shadow p-4 min-h-[85vh]">
<div className="flex flex-col justify-center items-center mb-4">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Scheduled Meetings
</h2>
</div>
<div className="flex w-full flex-col gap-5">
{meetingInfo.map((session) => (
<MentorSessionCard session={session} />
))}
</div>
</div>
</>
);
};
export default ScheduleMeeting;
+273
View File
@@ -0,0 +1,273 @@
import React, { useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { loaderSliceActions } from "../../store/loaderSlice";
import { userSliceActions } from "../../store/userSlice";
import { BACKEND_URL } from "../../constants";
const Settings = () => {
const nameElement = useRef();
const emailElement = useRef();
const passwordElement = useRef();
const confirmPassElement = useRef();
const formData = new FormData();
const [avatar, setAvatar] = useState();
const user = useSelector((store) => store.user);
const loader = useSelector((store) => store.loader);
//console.log("Before the user is : ", user);
const dispatch = useDispatch();
// Optimise the call for the database here you are refreshing the page again and again which makes read and write operation
const handleAvatar = async (event) => {
event.preventDefault();
formData.append("avatar", avatar);
//console.log("forma daata is : ", formData);
if (avatar) {
dispatch(loaderSliceActions.showLoader());
//console.log("The loader values is : ", loader);
const responce = await fetch(`${BACKEND_URL}/api/v1/user/avatar`, {
method: "PUT",
credentials: "include",
body: formData,
});
const finalResponce = await responce.json();
//console.log("Our final responce is : ", finalResponce);
if (finalResponce.success) {
dispatch(loaderSliceActions.hideLoader());
//console.log("The loader values is : ", loader);
dispatch(userSliceActions.addUser(finalResponce.data));
// console.log("Updated User is : ", user);
window.location.reload();
}
}
};
const handleLogin = async (event) => {
event.preventDefault();
const responce = await fetch(`${BACKEND_URL}/api/v1/login`, {
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: emailElement.current.value,
password: passwordElement.current.value,
}),
});
const user = await responce.json();
//console.log("User Login Data is here : ", user);
dispatch(userSliceActions.addUser(user.data));
emailElement.current.value = "";
passwordElement.current.value = "";
if (user.success == true) {
navigate("/");
}
};
return (
<>
<>
<div className="w-full bg-white rounded-lg shadow p-4 min-h-[85vh]">
<div className="flex flex-col justify-center items-center mb-4">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Update Your Avatar
</h2>
<div className="w-full h-auto flex items-center justify-center py-7">
<div className="w-[9rem] h-[9rem] overflow-hidden rounded-full object-center">
<img src={`${user.avatar}`} alt="Avatar" />
</div>
</div>
</div>
<form onSubmit={handleAvatar}>
<div class="flex items-center justify-center w-full">
<img src={formData.avatar && `${formData.avatar}`} alt="" />
<label
for="dropzone-file"
class="flex flex-col items-center justify-center w-full h-64 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600"
>
<div class="flex flex-col items-center justify-center pt-5 pb-6 ">
<svg
class="w-8 h-8 mb-4 text-gray-500 dark:text-gray-400"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 20 16"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
/>
</svg>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400">
{avatar ? (
<span class="font-semibold">
Avatar uploaded successfulky
</span>
) : (
<span class="font-semibold">
Click to upload and press Upload button
</span>
)}
</p>
<p class="text-xs text-gray-500 dark:text-gray-400">
SVG, PNG, JPG or GIF (MAX. 800x400px)
</p>
<button
type="submit"
className="bg-gray-600 px-4 py-1 rounded-lg text-white font-semibold my-4"
>
Upload
</button>
</div>
<input
id="dropzone-file"
type="file"
class="hidden"
onChange={(e) => {
setAvatar(e.target.files[0]);
//console.log(e.target.files[0]);
}}
/>
</label>
</div>
</form>
<div className="flex flex-col justify-center items-center mb-4">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Update Your Details
</h2>
</div>
<form className="space-y-6" onSubmit={handleLogin}>
<div>
<label
for="password"
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>
Name :
</label>
<input
type="text"
id="password"
ref={nameElement}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Enter your Updated Name here.."
required
/>
</div>
<div>
<label
for="username"
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>
Email :
</label>
<input
type="email"
id="username"
ref={emailElement}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Enter your Updated Email here.."
required
/>
</div>
{/* <div>
<label
for="password"
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>
Password
</label>
<input
type="password"
id="password"
ref={passwordElement}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="********"
required
/>
</div> */}
<div className="flex justify-center items-center">
<button
type="submit"
className="text-white bg-purple-500 hover:bg-purple-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Change the Details
</button>
</div>
</form>
<div className="flex flex-col justify-center items-center my-10">
<h2 className="text-2xl font-bold font-sans border-b-2 py-2">
Update Your Password
</h2>
</div>
<form className="space-y-6" onSubmit={handleLogin}>
<div>
<label
for="password"
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>
New Password :
</label>
<input
type="password"
id="password"
ref={passwordElement}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Enter your New Password to update.."
required
/>
</div>
<div>
<label
for="password"
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>
Confirm Password :
</label>
<input
type="password"
id="password"
ref={confirmPassElement}
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Enter your New Password to update.."
required
/>
</div>
<div className="flex justify-center items-center">
<button
type="submit"
className="text-white bg-purple-500 hover:bg-purple-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
>
Change the Password
</button>
</div>
</form>
</div>
</>
</>
);
};
export default Settings;
+11
View File
@@ -0,0 +1,11 @@
import React from "react";
const Support = () => {
return (
<>
<div className=""></div>
</>
);
};
export default Support;