-
-
Notifications
You must be signed in to change notification settings - Fork 813
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
base: develop-postgres
Are you sure you want to change the base?
[FIX] Events Page Violates The Figma Style Guide #3280
Conversation
WalkthroughThis pull request introduces modifications to several components within the event calendar and holiday card systems. The changes primarily involve commenting out the functionality for navigating to today's date, updating weekday representations to full names, and restructuring CSS imports and class names. Additionally, there are enhancements in the visual presentation of the components, including new styling variables and classes. Overall, the modifications focus on refining the user interface and improving testability without altering core functionalities. Changes
Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this 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:
- Use CSS variables for the background color instead of rgba
- Increase the font size for better readability
- 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
📒 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 issueRemove 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.
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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
📒 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.tsxLength of output: 196
There was a problem hiding this 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
📒 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:
Style verification:
- Test CSS class applications
- Verify style-related props
Edge cases:
- Holiday names with special characters
- HTML entities in names
- Multi-line holiday names
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/components/HolidayCards/HolidayCard.spec.tsx (4)
8-11
: Enhance the basic rendering test assertion.Instead of just checking if the element is defined, consider using more specific assertions:
test('renders without crashing', () => { render(<HolidayCard holidayName="Christmas" />); - expect(screen.getByTestId('holiday-card')).toBeDefined(); + const cardElement = screen.getByTestId('holiday-card'); + expect(cardElement).toBeInTheDocument(); + expect(cardElement).toBeVisible(); });
13-19
: Remove unnecessary blank line.The test is well-structured, but there's an unnecessary blank line that can be removed for better code consistency.
test('displays the provided holiday name', () => { const testHolidayName = 'New Year'; render(<HolidayCard holidayName={testHolidayName} />); - const cardElement = screen.getByTestId('holiday-card'); expect(cardElement.textContent).toBe(testHolidayName); });
21-26
: Make the CSS class test more flexible.The current test might break if the component needs to support multiple classes in the future.
test('applies the correct CSS class', () => { render(<HolidayCard holidayName="Easter" />); const cardElement = screen.getByTestId('holiday-card'); - expect(cardElement.className).toBe(styles.holidayCard); + expect(cardElement.className).toContain(styles.holidayCard); });
43-51
: Add more TypeScript validation cases.Consider adding more type validation tests to cover additional scenarios:
// TypeScript compile-time tests test('TypeScript props validation', () => { // @ts-expect-error - Testing TypeScript validation for missing required prop render(<HolidayCard />); // @ts-expect-error - Testing TypeScript validation for wrong prop type render(<HolidayCard holidayName={123} />); + + // @ts-expect-error - Testing TypeScript validation for null + render(<HolidayCard holidayName={null} />); + + // @ts-expect-error - Testing TypeScript validation for undefined + render(<HolidayCard holidayName={undefined} />); });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/HolidayCards/HolidayCard.spec.tsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Test Application
🔇 Additional comments (2)
src/components/HolidayCards/HolidayCard.spec.tsx (2)
28-41
: Add more edge cases as suggested in the previous review.While the current edge cases are good, consider adding tests for holiday names with special characters as suggested in the previous review.
test('handles long holiday names', () => { const longHolidayName = 'International Talk Like a Pirate Day Celebration'; render(<HolidayCard holidayName={longHolidayName} />); const cardElement = screen.getByTestId('holiday-card'); expect(cardElement.textContent).toBe(longHolidayName); }); + +test('handles holiday names with special characters', () => { + const specialHolidayName = 'Día de los Muertos!@#$%'; + render(<HolidayCard holidayName={specialHolidayName} />); + + const cardElement = screen.getByTestId('holiday-card'); + expect(cardElement.textContent).toBe(specialHolidayName); +});
5-5
: Verify the styles import path and class existence.The styles are being imported from a global CSS module. Ensure that the
holidayCard
class exists in the global styles file.✅ Verification successful
Styles import and class definition are correct
The
holidayCard
class is properly defined in the global styles file with appropriate styling properties.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if the holidayCard class exists in the global styles file rg -l 'holidayCard' 'src/style/app.module.css'Length of output: 69
Script:
#!/bin/bash # Check the actual content of the holidayCard class definition with context rg -C 2 'holidayCard' 'src/style/app.module.css'Length of output: 151
6e1f485
There was a problem hiding this 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 (4)
src/screens/UserPortal/Events/Events.spec.tsx (1)
Line range hint
1-900
: Consider improving test documentation and readability.While the test implementation is solid, consider these improvements:
- Add JSDoc comments for each mock data entry explaining its purpose
- Use more descriptive test case names (e.g., "should display full weekday names in calendar view" instead of "Switch to calendar view works as expected")
src/style/app.module.css (3)
5418-5432
: Consider improving calendar header's responsive design.The calendar header's margin and padding values could be more responsive:
.calendar { - margin-bottom: 10px; + margin-bottom: clamp(10px, 2vw, 20px); background: var(--white-color); border-radius: 10px; - padding-left: 70px; - padding-right: 70px; + padding-inline: clamp(20px, 5vw, 70px); padding-top: 5px; } .calendar__header { display: flex; align-items: center; justify-content: space-between; - margin-right: 50px; + margin-inline-end: clamp(20px, 4vw, 50px); }
6345-6350
: Consider using relative units for card title.The card title's font size should use relative units for better scalability:
.card_title { - font-size: 20px; + font-size: clamp(16px, 1.25rem, 20px); margin-bottom: 10px; font-weight: bold; color: var(--black-color); }
5769-5769
: Inconsistent spacing and shadow values in button styles.The button styles have hardcoded shadow values that should use CSS variables for consistency:
.space { flex: 1; display: flex; align-items: center; - gap: 10px; + gap: var(--spacing-md, 10px); } .createButtonEventHeader { background-color: var(--grey-bg-color); color: var(--brown-color); width: 110px; border: 1px solid var(--brown-color); - box-shadow: 2.5px 2.5px 2.5px rgba(0, 0, 0, 0.3); + box-shadow: var(--card-shadow); } .createButtonEventHeader:hover { - box-shadow: 2.5px 2.5px 2.5px rgba(0, 0, 0, 0.3); + box-shadow: var(--card-shadow); }Also applies to: 5774-5778, 5785-5785
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/EventCalendar/EventCalendar.tsx
(3 hunks)src/screens/UserPortal/Events/Events.spec.tsx
(1 hunks)src/style/app.module.css
(22 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/EventCalendar/EventCalendar.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test Application
- GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (3)
src/screens/UserPortal/Events/Events.spec.tsx (1)
653-653
: LGTM! The assertion change aligns with the UI updates.The change from 'Sun' to 'Sunday' correctly reflects the updated weekday representation in the calendar view.
src/style/app.module.css (2)
49-53
: Good addition of semantic CSS variables for consistent styling.The new CSS variables follow a clear naming convention and promote reusability. This is a good practice for maintaining a consistent design system.
6330-6342
: 🛠️ Refactor suggestionImprove accessibility of the holiday card.
The font size and background color need improvements for better accessibility:
.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; }
- Font size increased to meet WCAG guidelines (minimum 12px)
- Using CSS variable for background color to ensure consistent contrast ratio
Likely invalid or redundant comment.
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
Test Coverage
Other information
Have you read the contributing guide?
Yes
Summary by CodeRabbit
Release Notes
UI/UX Changes
Styling Updates
Component Refactoring
Testing
HolidayCard
component to verify rendering functionality.Events
component to check for full day names in the calendar view.