diff --git a/.github/workflows/issueReminder.yml b/.github/workflows/issueReminder.yml index 973966c..dc312dd 100644 --- a/.github/workflows/issueReminder.yml +++ b/.github/workflows/issueReminder.yml @@ -1,42 +1,32 @@ -name: Issue reminder workflow +name: 'open-issue reminder' on: schedule: - - cron: "30 2 * * *" - + - cron: '15 4 * * *' jobs: - stale: + welcome: runs-on: ubuntu-latest steps: - - name: Reminder message + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run script uses: actions/github-script@v4 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const { context, github } = require('@actions/github'); - - const message = 'Hi there! This issue is still open. We are looking forward to your response.'; - - github.issues.listForRepo({ - owner: 'Curious-Ecosystem', - repo: 'Curious-Connect', + const { data: issues } = await github.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, state: 'open' - }).then(async (response) => { - for (const issue of response.data) { - const { data: assignees } = await github.issues.listAssignees({ - owner: 'Curious-Ecosystem', - repo: 'Curious-Connect', - issue_number: issue.number - }); - const assigneeLogins = assignees.map(assignee => '@' + assignee.login).join(' '); - github.issues.createComment({ - owner: 'Curious-Ecosystem', - repo: 'Curious-Connect', - issue_number: issue.number, - body: `${message}\n\nAssignees: ${assigneeLogins}` - }); - } - }).catch((error) => { - console.error(error); - process.exit(1); }); + for (const issue of issues) { + const issueComment = `Hi there! This issue is still open. We are looking forward to your response. + Assignees: ${issue.assignees.map(assignee => '@' + assignee.login).join(', ') || 'None'}`; + await github.issues.createComment({ + issue_number: issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: issueComment + }); + } \ No newline at end of file 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 ( -
- Click on the time slot to select -
-+ Click on the time slot to select +
+