Skip to content
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

[FIX] Events Page Violates The Figma Style Guide #3280

Open
wants to merge 10 commits into
base: develop-postgres
Choose a base branch
from

Conversation

hustlernik
Copy link
Contributor

@hustlernik hustlernik commented Jan 15, 2025

What kind of change does this PR introduce?

UI fix according to figma.

Issue Number:

#3180

Snapshots/Videos:

Screen-Recording.1.mp4

Does this PR introduce a breaking change?

No

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Other information

Have you read the contributing guide?

Yes

Summary by CodeRabbit

Release Notes

  • UI/UX Changes

    • Removed the "Today" button functionality from the calendar, impacting quick navigation to the current date.
    • Updated calendar weekday display to use full day names.
    • Modified event header with new search and create event icons.
  • Styling Updates

    • Introduced new CSS variables for colors and card styling.
    • Adjusted holiday card and event card styling.
    • Updated calendar day and event header styles.
    • Refined component layout and visual design.
  • Component Refactoring

    • Updated import paths and class names for various components.
    • Removed unused elements from the event header layout.
  • Testing

    • Added a new test file for the HolidayCard component to verify rendering functionality.

Copy link
Contributor

coderabbitai bot commented Jan 15, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between c0e0005 and 5ca7439.

📒 Files selected for processing (1)
  • src/components/HolidayCards/HolidayCard.spec.tsx (1 hunks)
 _______________________
< Hasta la vista, bugs. >
 -----------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

This pull request introduces modifications to several components within the event calendar and holiday card systems. The changes primarily involve updating styling, removing certain functionalities like the "today" button navigation, modifying weekday representations, and adjusting CSS imports and class names. The modifications affect visual presentation and minor behavioral aspects of the event calendar and related components, focusing on restructuring the user interface and styling approach.

Changes

File Change Summary
src/components/EventCalendar/EventCalendar.tsx Commented out handleTodayButton function and associated button, removed current date navigation functionality.
src/components/EventCalendar/EventHeader.tsx Updated search and create event button icons, added data-testid, restructured button layout.
src/components/EventCalendar/constants.js Replaced weekday abbreviations with full day names.
src/components/HolidayCards/HolidayCard.module.css Deleted CSS module file.
src/components/HolidayCards/HolidayCard.tsx Updated CSS import path and class name.
src/screens/UserPortal/Events/Events.tsx Changed main container class name.
src/style/app.module.css Added new CSS variables, introduced new classes, modified existing styles.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • palisadoes

Poem

🐰 A Rabbit's Calendar Rhyme 🗓️
Weekdays stretch, no more abbrev's tight,
Buttons fade, but styles shine bright
CSS dances, variables gleam
Our calendar's evolving dream!
Hop along, code's gentle sway


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.

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. (Beta)
  • @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.

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.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

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

🧹 Nitpick comments (2)
src/components/HolidayCards/HolidayCard.tsx (1)

2-2: Consider keeping component-specific styles local.

Moving styles from a component-specific module to the global styles file could make maintenance more difficult and reduce encapsulation. Consider keeping the styles in a local module.

-import styles from './../../style/app.module.css';
+import styles from './HolidayCard.module.css';

-  return <div className={styles.holidayCard}>{props?.holidayName}</div>;
+  return <div className={styles.card}>{props?.holidayName}</div>;

Also applies to: 17-17

🧰 Tools
🪛 GitHub Actions: PR Workflow

[error] Contains code coverage disable statement. Please remove it and add the appropriate tests.

src/style/app.module.css (1)

6351-6363: Consider improvements to holiday card styles.

While the styles are functional, consider these enhancements:

  1. Use CSS variables for the background color instead of rgba
  2. Increase the font size for better readability
  3. Add hover/focus states for better interactivity
.holidayCard {
  color: var(--black-color);
- background-color: rgba(0, 0, 0, 0.15);
- font-size: 10px;
+ background-color: var(--holidays-card-background-color);
+ font-size: 12px;
  font-weight: 400;
  display: flex;
  padding: 8px 4px;
  border-radius: 5px;
  margin-bottom: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
+ transition: background-color 0.2s ease;
}

+ .holidayCard:hover,
+ .holidayCard:focus {
+   background-color: var(--holidays-card-background-color-hover, rgba(0, 0, 0, 0.25));
+ }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 334f0f7 and f85b8ac.

📒 Files selected for processing (7)
  • src/components/EventCalendar/EventCalendar.tsx (4 hunks)
  • src/components/EventCalendar/EventHeader.tsx (4 hunks)
  • src/components/EventCalendar/constants.js (1 hunks)
  • src/components/HolidayCards/HolidayCard.module.css (0 hunks)
  • src/components/HolidayCards/HolidayCard.tsx (2 hunks)
  • src/screens/UserPortal/Events/Events.tsx (1 hunks)
  • src/style/app.module.css (22 hunks)
💤 Files with no reviewable changes (1)
  • src/components/HolidayCards/HolidayCard.module.css
✅ Files skipped from review due to trivial changes (1)
  • src/screens/UserPortal/Events/Events.tsx
🧰 Additional context used
🪛 GitHub Actions: PR Workflow
src/components/HolidayCards/HolidayCard.tsx

[error] Contains code coverage disable statement. Please remove it and add the appropriate tests.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (9)
src/components/EventCalendar/constants.js (1)

16-24: LGTM! Improved readability with full weekday names.

The change from abbreviated to full weekday names enhances the calendar's readability and user experience.

src/components/HolidayCards/HolidayCard.tsx (1)

17-17: ⚠️ Potential issue

Remove istanbul ignore comment and add tests.

The pipeline has flagged this line for containing a code coverage disable statement. Please remove the istanbul ignore comment and add appropriate tests.

✅ Verification successful

Remove unnecessary istanbul ignore comment and add basic component test

The review comment is accurate. The component contains an istanbul ignore next comment, and no test file exists. Since this is a simple component that only renders a holiday name, there's no complexity that would justify ignoring test coverage. You should:

  • Remove the /*istanbul ignore next*/ comment from line 17
  • Add a basic test file (e.g., HolidayCard.test.tsx) that verifies:
    • Component renders without crashing
    • Holiday name is correctly displayed
    • CSS class is properly applied
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for existing test file
fd "HolidayCard.test.tsx" src/components/HolidayCards/

Length of output: 54


Script:

#!/bin/bash
# Check the component file for istanbul ignore comment
cat src/components/HolidayCards/HolidayCard.tsx

# Look for test files with different naming patterns
fd "HolidayCard.*test.*" src/
fd "HolidayCard.*spec.*" src/

# Check if tests might be in a __tests__ directory
fd -t d "__tests__" src/

Length of output: 727

🧰 Tools
🪛 GitHub Actions: PR Workflow

[error] Contains code coverage disable statement. Please remove it and add the appropriate tests.

src/components/EventCalendar/EventHeader.tsx (2)

3-4: LGTM! Improved icon consistency using Material-UI icons.

The change to use Material-UI icons improves consistency with the design system.


96-114: LGTM! Enhanced create button with improved visual hierarchy.

The addition of the AddIcon and better button structure improves the visual hierarchy and user experience.

src/components/EventCalendar/EventCalendar.tsx (2)

201-205: Verify if removing the Today button aligns with UX requirements.

The removal of the Today button functionality might impact user experience by making it harder to quickly navigate to the current date. Please verify if this change aligns with the Figma design and UX requirements.


372-374: LGTM! Improved holiday indicator styling.

The holiday indicator changes align with the new design system.

src/style/app.module.css (3)

49-52: LGTM! Well-structured CSS variables.

The new color variables are semantically named and follow the existing pattern. They provide good reusability for holiday and event-related components.


4424-4431: LGTM! Well-structured calendar container styles.

The calendar container styles provide good responsive layout with appropriate spacing and overflow handling.


6366-6371: LGTM! Well-structured card title styles.

The card title styles provide good visual hierarchy with appropriate font size and weight.

src/components/EventCalendar/EventCalendar.tsx Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
@hustlernik hustlernik changed the title Figma: [FIX] Events Page Violates The Figma Style Guide Jan 15, 2025
Copy link

codecov bot commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 8.54%. Comparing base (334f0f7) to head (c0e0005).
Report is 1 commits behind head on develop-postgres.

Files with missing lines Patch % Lines
src/components/HolidayCards/HolidayCard.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           develop-postgres   #3280      +/-   ##
===================================================
- Coverage              8.56%   8.54%   -0.02%     
===================================================
  Files                   309     309              
  Lines                  7954    7972      +18     
  Branches               1763    1766       +3     
===================================================
  Hits                    681     681              
- Misses                 7196    7214      +18     
  Partials                 77      77              
Flag Coverage Δ
jest 8.54% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9215fbf and 26fcd03.

📒 Files selected for processing (2)
  • src/components/HolidayCards/HolidayCard.spec.tsx (1 hunks)
  • src/screens/UserPortal/Events/Events.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/screens/UserPortal/Events/Events.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test Application
  • GitHub Check: Check Python Code Style
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (3)
src/components/HolidayCards/HolidayCard.spec.tsx (3)

1-4: LGTM! All necessary imports are present.

The import statements are clean and include all required testing utilities.


1-22: Address test coverage requirements.

The PR objectives indicate that test coverage doesn't meet the 95% threshold. While this file adds basic testing, consider using tools like vitest --coverage to identify untested code paths and ensure comprehensive test coverage across all component functionality.


6-10: Verify completeness of CSS module mock.

The mock only includes the 'holidayCard' class. Please verify if the component uses any other CSS classes that should be included in the mock to ensure comprehensive testing.

Run this script to check for additional CSS classes used by the component:

✅ Verification successful

CSS module mock is correctly implemented

The component only uses the styles.holidayCard class, which is properly included in the mock. No additional CSS classes need to be mocked.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for CSS class usage in the HolidayCard component
ast-grep --pattern 'styles.$_' src/components/HolidayCards/HolidayCard.tsx

Length of output: 196

src/components/HolidayCards/HolidayCard.spec.tsx Outdated Show resolved Hide resolved
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 (2)
src/style/app.module.css (1)

5418-5423: Consider using CSS Grid for better calendar layout.

The current margin and padding approach could be improved using CSS Grid for more consistent spacing and better responsiveness.

Consider this alternative:

.calendar {
  font-family: sans-serif;
  font-size: 1.2rem;
  margin-bottom: 10px;
  background: var(--white-color);
  border-radius: 10px;
- padding-left: 70px;
- padding-right: 70px;
- padding-top: 5px;
+ display: grid;
+ grid-template-columns: minmax(20px, 70px) 1fr minmax(20px, 70px);
+ padding: 5px 0;
}
src/components/HolidayCards/HolidayCard.spec.tsx (1)

6-10: Enhance the CSS module mock for comprehensive style testing.

The current mock is minimal. Consider expanding it to include all CSS classes used in the component to ensure thorough style testing.

 vi.mock('./../../style/app.module.css', () => ({
   default: {},
-  holidayCard: 'holidayCard',
+  holidayCard: 'holidayCard',
+  // Add other classes used in HolidayCard component
+  // Example:
+  // cardTitle: 'cardTitle',
+  // cardContent: 'cardContent',
 }));
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 26fcd03 and c0e0005.

📒 Files selected for processing (4)
  • src/components/EventCalendar/EventCalendar.tsx (4 hunks)
  • src/components/HolidayCards/HolidayCard.spec.tsx (1 hunks)
  • src/components/HolidayCards/HolidayCard.tsx (2 hunks)
  • src/style/app.module.css (22 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/HolidayCards/HolidayCard.tsx
  • src/components/EventCalendar/EventCalendar.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (3)
src/style/app.module.css (2)

49-53: LGTM! Well-structured CSS variables for consistent theming.

The new CSS variables are well-named and follow a clear naming convention, making them easy to understand and maintain.


Line range hint 5689-5705: LGTM! Well-structured calendar info cards.

The calendar info cards have good spacing, consistent use of variables, and proper box-shadow implementation.

src/components/HolidayCards/HolidayCard.spec.tsx (1)

12-32: Expand test coverage to meet the 95% threshold.

While the current tests cover basic scenarios, additional test cases are needed to improve coverage and ensure robust component behavior:

  1. Style verification:

    • Test CSS class applications
    • Verify style-related props
  2. Edge cases:

    • Holiday names with special characters
    • HTML entities in names
    • Multi-line holiday names
  3. Component behavior:

    • Hover states if applicable
    • Any click handlers or interactions
    • Accessibility attributes

Let's verify the current test coverage:

#!/bin/bash
# Check test coverage for the HolidayCard component
npx vitest run --coverage src/components/HolidayCards/HolidayCard.spec.tsx

src/style/app.module.css Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 15, 2025
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.

1 participant