Skip to content

feat(calendar): show Google logo for events synced from Google Calendar #2658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 4, 2025

Conversation

Adinorio
Copy link
Collaborator

@Adinorio Adinorio commented May 3, 2025

It displays the Google logo before the event title for Google-synced events. It can be changed to google calendar icon soon because currently, I am not sure how to add an image to be usable.

Summary by CodeRabbit

  • New Features
    • Added a Google Calendar icon to event cards and all-day event bars to visually indicate events synced from Google Calendar.
    • Introduced a Google Calendar badge in event modal titles for clearer identification of synced events.

It displays the Google logo before the event title for Google-synced events. It can be changed to google calendar icon soon because currently, I am not sure how to add an image to be usable.
Copy link

graphite-app bot commented May 3, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Contributor

coderabbitai bot commented May 3, 2025

Walkthrough

Conditional UI enhancements were added to multiple calendar event components. When an event includes a non-empty google_event_id, a Google Calendar icon or badge is displayed near the event title or modal title. These changes appear in the EventCard, AllDayEventBar, and UnifiedEventModal components. The icons include accessibility attributes such as alt text, tooltips, and test IDs. No changes were made to event logic, state management, or exported/public entity declarations.

Changes

File(s) Change Summary
packages/ui/src/components/ui/legacy/calendar/EventCard.tsx Added conditional rendering of a Google Calendar icon image before the event title when the event has a google_event_id.
packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx Added conditional rendering of a Google Calendar icon image before the event title for all-day events with a google_event_id.
packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx Enhanced dialog title to include a "Google Calendar" badge with icon and label when the event has a google_event_id.

Possibly related PRs

Suggested reviewers

  • coder1807

Poem

🐇 A bunny hopped by an EventCard today,
Saw a Google logo shining in the display.
"Synced and special!" the rabbit did cheer,
Now Google events are crystal clear.
With every hop and every glance,
Calendar magic gets a chance!
📅✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx

Oops! Something went wrong! :(

ESLint: 9.26.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

packages/ui/src/components/ui/legacy/calendar/EventCard.tsx

Oops! Something went wrong! :(

ESLint: 9.26.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx

Oops! Something went wrong! :(

ESLint: 9.26.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@typescript-eslint/parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd182b0 and 376109c.

📒 Files selected for processing (3)
  • packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx (1 hunks)
  • packages/ui/src/components/ui/legacy/calendar/EventCard.tsx (1 hunks)
  • packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx

[warning] 98-106: packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx#L98-L106
Added lines #L98 - L106 were not covered by tests

packages/ui/src/components/ui/legacy/calendar/EventCard.tsx

[warning] 1017-1025: packages/ui/src/components/ui/legacy/calendar/EventCard.tsx#L1017-L1025
Added lines #L1017 - L1025 were not covered by tests

packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx

[warning] 855-869: packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx#L855-L869
Added lines #L855 - L869 were not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Verify generated types
🔇 Additional comments (1)
packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx (1)

98-107:

❓ Verification inconclusive

Good implementation of Google Calendar icon with proper accessibility.

The conditional rendering for the Google Calendar icon is well-implemented. The code correctly checks if google_event_id is a non-empty string before displaying the icon, and includes important accessibility attributes (alt text, title) and a test ID for easier testing.

The static analysis indicates this new code isn't covered by tests. As mentioned in a previous review, please add test cases to verify:

  • The Google Calendar icon appears when google_event_id is present
  • The icon doesn't appear when google_event_id is undefined or empty

🏁 Script executed:

#!/bin/bash
# Check for existing tests that could be extended
fd "AllDayEventBar.*\.(test|spec)" --type f

Length of output: 45


Add tests for AllDayEventBar’s Google Calendar icon

It looks like there aren’t any existing tests covering AllDayEventBar. Please add test cases to verify that:

  • The Google Calendar icon renders when google_event_id is a non-empty string
  • The icon does not render when google_event_id is empty or undefined
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 98-106: packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx#L98-L106
Added lines #L98 - L106 were not covered by tests

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Adinorio Adinorio requested a review from vhpx May 3, 2025 16:39
Copy link

codecov bot commented May 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.

Project coverage is 0.82%. Comparing base (4f89428) to head (376109c).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...omponents/ui/legacy/calendar/UnifiedEventModal.tsx 0.00% 15 Missing ⚠️
...c/components/ui/legacy/calendar/AllDayEventBar.tsx 0.00% 9 Missing ⚠️
...ui/src/components/ui/legacy/calendar/EventCard.tsx 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2658      +/-   ##
==========================================
- Coverage    0.82%    0.82%   -0.01%     
==========================================
  Files        2146     2146              
  Lines      252097   252128      +31     
  Branches     2586     2586              
==========================================
  Hits         2078     2078              
- Misses     248174   248205      +31     
  Partials     1845     1845              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/ui/src/components/ui/legacy/calendar/EventCard.tsx (1)

1017-1024: Good implementation for Google Calendar integration.

The conditional rendering of the Google logo for events synced from Google Calendar is well-implemented. The code correctly checks for the google_event_id property and displays an appropriate visual indicator with helpful alt text and tooltip.

Consider these minor improvements:

  • Add an error handling fallback in case the image fails to load
  • Eventually move from using a static image path to an imported SVG icon or a component for better maintainability
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 1017-1023: packages/ui/src/components/ui/legacy/calendar/EventCard.tsx#L1017-L1023
Added lines #L1017 - L1023 were not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f89428 and 2cc3568.

📒 Files selected for processing (1)
  • packages/ui/src/components/ui/legacy/calendar/EventCard.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
packages/ui/src/components/ui/legacy/calendar/EventCard.tsx

[warning] 1017-1023: packages/ui/src/components/ui/legacy/calendar/EventCard.tsx#L1017-L1023
Added lines #L1017 - L1023 were not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Prettier Check (23)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Verify generated types

@Adinorio Adinorio marked this pull request as draft May 3, 2025 16:54
vhpx and others added 2 commits May 4, 2025 00:22
- Add Google Calendar icon to event cards and all-day events
- Add Google Calendar indicator badge in event edit modal
- Implement robust conditional rendering with proper type checking
- Add responsive light/dark mode styling for better visibility
@Adinorio Adinorio force-pushed the feat/add-google-event-icon branch from 1653fa2 to 52e981a Compare May 3, 2025 18:05
Copy link
Collaborator Author

@Adinorio Adinorio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better and improved version.

@Adinorio Adinorio marked this pull request as ready for review May 3, 2025 18:08
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
packages/ui/src/components/ui/legacy/calendar/EventCard.tsx (1)

1017-1025: Add missing tests for Google Calendar logo in EventCard.

The Google Calendar icon implementation looks good, with proper conditional rendering and accessibility attributes. However, test coverage is needed to ensure this feature works correctly.

As noted in the previous review, please add tests that verify:

  • When google_event_id is provided, the Google logo is rendered with correct attributes
  • When google_event_id is absent, the Google logo is not rendered

Example test assertions:

it('renders Google logo when google_event_id is set', () => {
  const { queryByAltText } = render(<EventCard {...props} google_event_id="123" />);
  const logo = queryByAltText('Google Calendar');
  expect(logo).toBeInTheDocument();
  expect(logo).toHaveAttribute('src', '/media/google-calendar-icon.png');
  expect(logo).toHaveAttribute('title', 'Synced from Google Calendar');
});

it('does not render Google logo when google_event_id is undefined', () => {
  const { queryByAltText } = render(<EventCard {...props} />);
  expect(queryByAltText('Google Calendar')).toBeNull();
});
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 1017-1024: packages/ui/src/components/ui/legacy/calendar/EventCard.tsx#L1017-L1024
Added lines #L1017 - L1024 were not covered by tests

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cc3568 and fd182b0.

⛔ Files ignored due to path filters (1)
  • apps/web/public/media/google-calendar-icon.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx (1 hunks)
  • packages/ui/src/components/ui/legacy/calendar/EventCard.tsx (1 hunks)
  • packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Check: codecov/patch
packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx

[warning] 855-867: packages/ui/src/components/ui/legacy/calendar/UnifiedEventModal.tsx#L855-L867
Added lines #L855 - L867 were not covered by tests

packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx

[warning] 98-105: packages/ui/src/components/ui/legacy/calendar/AllDayEventBar.tsx#L98-L105
Added lines #L98 - L105 were not covered by tests

packages/ui/src/components/ui/legacy/calendar/EventCard.tsx

[warning] 1017-1024: packages/ui/src/components/ui/legacy/calendar/EventCard.tsx#L1017-L1024
Added lines #L1017 - L1024 were not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview
  • GitHub Check: Deploy-Preview

Copy link
Member

@vhpx vhpx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @Adinorio.

@vhpx vhpx merged commit 9147d58 into main May 4, 2025
19 checks passed
@vhpx vhpx deleted the feat/add-google-event-icon branch May 4, 2025 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants