feat: integrate Google Calendar sync for assignments #3#5
feat: integrate Google Calendar sync for assignments #3#5Mustansir-06 wants to merge 2 commits intoElijahFeldman7:masterfrom
Conversation
|
Hi, did you mean to create a gapi-script file, because you import it but never write it |
|
Actually, gapi-script is an external npm dependency I added to package.json. It's a lightweight wrapper used to load the Google API (gapi) dynamically in a React environment, which is more reliable than using a static <script> tag in index.html. You can see it listed in the dependencies in the package.json file in this PR. |
|
Hi, a few things.
|
3168ddb to
5686e06
Compare
|
Hi! I have refactored the code based on your feedback. Here is what's updated: Refactoring: Created a dedicated googleCalendar.js utility and a reusable SettingsCog component. UI/UX: Kept the page titles and buttons consistent. Added a showDateAddOn state toggled by the new Settings Cog. Functionality: Changed the calendar integration to "all-day" assignments using type="date" and removed the required attribute from the date input. Clean Code: Fixed Codacy warnings by using the in operator for dynamic object checks and optimized setEvents calls in the Scheduler to avoid double-renders. Sync: Pulled the latest upstream changes to ensure compatibility with recent Scheduler PRs. Let me know if there is anything else you'd like me to adjust! |
|
Hi, Thanks, |
Overview
This PR implements the requested Google Calendar integration for Issue #3. It allows users to sync their tasks/assignments directly to their Google Calendar and view them in real-time within the Daily Scheduler tab.
Changes Made
Authentication Update: Modified src/firebase.js to include the https://www.googleapis.com/auth/calendar.events scope, allowing the app to manage calendar events.
Google API Initialization: Integrated gapi-script in App.js to initialize the Google API client on application startup.
Task Syncing:
Updated TaskManager.js with a datetime-local input field.
Implemented addToGoogleCalendar logic to automatically push new tasks to the user's primary Google Calendar.
Live Scheduler: Refactored DailyScheduler.js to fetch today's events directly from the Google Calendar API instead of relying on localStorage.
Dependency Management: Added gapi-script to package.json.
Note to Maintainer
To enable this feature in production, you will need to:
Enable the Google Calendar API in your Google Cloud Console.
Set up OAuth 2.0 credentials.
Add REACT_APP_GOOGLE_CLIENT_ID and REACT_APP_GOOGLE_API_KEY to your environment variables.