diff --git a/frontend/package.json b/frontend/package.json
index 6633e9b..f450de5 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -13,8 +13,10 @@
"dependencies": {
"@material-tailwind/react": "^2.1.9",
"@remixicon/react": "^4.2.0",
+ "express": "^4.19.2",
"flowbite": "^2.3.0",
"flowbite-react": "^0.9.0",
+ "mongoose": "^8.3.5",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-datepicker": "^6.9.0",
diff --git a/frontend/src/Components/Pages/Meeting-Page/Meeting-Availability.jsx b/frontend/src/Components/Pages/Meeting-Page/Meeting-Availability.jsx
index d05fddc..a1eab6f 100644
--- a/frontend/src/Components/Pages/Meeting-Page/Meeting-Availability.jsx
+++ b/frontend/src/Components/Pages/Meeting-Page/Meeting-Availability.jsx
@@ -11,24 +11,29 @@ const MeetingAvailability = () => {
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const data = [];
const [selectedButtons, setSelectedButtons] = useState([]);
+ const [selectedDates, setSelectedDates] = useState([]);
const handleButtonClick = (buttonId) => {
- // Check if the button is already selected
const isSelected = selectedButtons.includes(buttonId);
-
if (isSelected) {
- // If selected, remove it from the list
setSelectedButtons(selectedButtons.filter((id) => id !== buttonId));
} else {
- // If not selected, add it to the list
setSelectedButtons([...selectedButtons, buttonId]);
}
};
+ const handleDateClick = (date) => {
+ const isSelected = selectedDates.includes(date);
+ if (isSelected) {
+ setSelectedDates(selectedDates.filter((d) => d !== date));
+ } else {
+ setSelectedDates([...selectedDates, date]);
+ }
+ };
+
for (let i = 0; i < 7; i++) {
const date = new Date(currentDate);
date.setDate(currentDate.getDate() + i);
-
data.push({
date: date.toLocaleDateString(),
day: daysOfWeek[date.getDay()],
@@ -53,7 +58,7 @@ const MeetingAvailability = () => {
display: 'flex',
justifyContent: 'center',
alignItems: 'middle',
- transition: 'transform 0.5s ease', // Add transition for smooth movement
+ transition: 'transform 0.5s ease',
};
const slideContentStyle = {
@@ -86,178 +91,238 @@ const MeetingAvailability = () => {
}
};
+ const saveAvailability = () => {
+ const availabilityData = {
+ dates: selectedDates,
+ slots: selectedButtons.map((buttonId) => {
+ const timeMapping = {
+ button1: '09:15 AM',
+ button2: '09:45 AM',
+ button3: '10:15 AM',
+ button4: '10:45 AM',
+ button5: '11:15 AM',
+ button6: '11:45 AM',
+ button7: '12:15 PM',
+ button8: '12:45 PM',
+ button9: '01:15 PM',
+ button10: '01:45 PM',
+ };
+ return timeMapping[buttonId];
+ }),
+ };
+
+ fetch('http://localhost:5000/mentor-data', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(availabilityData),
+ })
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error('Network response was not ok');
+ }
+ return response.json();
+ })
+ .then((data) => {
+ console.log('availability data saved to MongoDB: ', data);
+ })
+ .catch((error) => {
+ console.error('error saving availability data to MongoDB: ', error);
+ });
+ };
+
return (
-
-
-
-
-
-
-
-
- Availabile Dates{' '}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Available Dates{' '}
+
+
+
+
+
+
+
+
+
+
-
-
-
- {data.slice(startIndex, startIndex + 3).map((d, index) => (
-
+
+
+ {data.slice(startIndex, startIndex + 3).map((d, index) => (
-
-
-
- {d.date}
-
-
- {d.day}
+ key={index}
+ style={{
+ ...slideContainerStyle,
+ transform: `translateX(${index * 100}%)`,
+ }}>
+
handleDateClick(d.date)}
+ style={{
+ ...slideContainerStyle,
+ backgroundColor: selectedDates.includes(d.date)
+ ? 'white'
+ : '#1F2329',
+ cursor: 'pointer',
+ }}
+ className='border border-2 h-28 flex flex-col align-center items-center rounded-lg mt-16'>
+
+
+
+ {d.date}
+
+
+ {d.day}
+
-
- ))}
-
-
+ ))}
+
+
-
+
-
-
- Availabile Slots
-
-
- Click on the time slot to select
-
-
+
+
+ Available Slots
+
+
+ Click on the time slot to select
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
diff --git a/frontend/src/Components/Pages/Meeting-Page/Meeting-Details.jsx b/frontend/src/Components/Pages/Meeting-Page/Meeting-Details.jsx
index 4665999..ce92256 100644
--- a/frontend/src/Components/Pages/Meeting-Page/Meeting-Details.jsx
+++ b/frontend/src/Components/Pages/Meeting-Page/Meeting-Details.jsx
@@ -16,103 +16,105 @@ const MeetingDetails = () => {
const duration = queryParams.get('duration');
return (
-
-
-
-
-
-
-
-
- {title}
-
-
-
+
+
+
+
+
+
+
+
+
+ {title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/*
*/}
- {/*
*/}
-
-
-
+
+
+
+
+
+ {/*
*/}
+ {/*
*/}
+
+
+
+
diff --git a/frontend/src/Components/Pages/Meeting-Page/Sidebar.jsx b/frontend/src/Components/Pages/Meeting-Page/Sidebar.jsx
index 42add52..f192821 100644
--- a/frontend/src/Components/Pages/Meeting-Page/Sidebar.jsx
+++ b/frontend/src/Components/Pages/Meeting-Page/Sidebar.jsx
@@ -3,10 +3,11 @@ import { Link } from 'react-router-dom';
const Sidebar = () => {
return (
-