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

[REFACTOR] CSS for Events.tsx #2998

Conversation

hustlernik
Copy link
Contributor

@hustlernik hustlernik commented Dec 28, 2024

What kind of change does this PR introduce?

Streamlined all CSS for Events.tsx into a single global file, fixed UI bugs on the Events.tsx , and ensured no conflicts with other pages.

Issue Number:

Fixes #2892

Did you add tests for your changes?

No

Does this PR introduce a breaking change?

No

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • Style Changes

    • Completely redesigned styling for the Events module.
    • Added new CSS classes for event-related components.
    • Updated visual styles for the event creation modal.
    • Introduced responsive design elements for event interfaces.
  • Refactor

    • Reorganized CSS class naming conventions.
    • Migrated styling from previous module to new location.
    • Removed outdated CSS file associated with the Events module.

Copy link
Contributor

coderabbitai bot commented Dec 28, 2024

Walkthrough

This pull request focuses on refactoring the CSS for the Events module in the Talawa-Admin application. The changes involve removing the Events.module.css file and moving its styles to the global app.module.css file. The Events.tsx component has been updated to use the new global CSS classes, aligning with the project's goal of streamlining CSS into a single file and improving UI/UX consistency.

Changes

File Change Summary
src/screens/UserPortal/Events/Events.module.css Completely removed
src/screens/UserPortal/Events/Events.tsx Updated import and class names to use global CSS styles
src/style/app.module.css Added multiple new CSS classes for event-related components

Assessment against linked issues

Objective Addressed Explanation
Refactor CSS in Events.tsx [#2892]
Move CSS to global file [#2892]
Remove embedded CSS references [#2892]

Possibly related issues

Possibly related PRs

Suggested reviewers

  • palisadoes

Poem

🐰 Styles dancing, CSS so bright,
Global file gleaming with delight!
Modules merge, classes align,
Events now sparkle, design divine!
Refactoring magic, code so clean! 🎨


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: 0

🧹 Nitpick comments (2)
src/screens/UserPortal/Events/Events.tsx (1)

345-346: Updated checkbox container classes.
Renaming from checkboxdiv/dispflex to checkboxdivEvents/dispflexEvents adds clarity, but watch out for potential confusion if other modules also need “checkboxdiv”-like layouts.

Also applies to: 357-357, 369-370, 381-381

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

3484-3633: Impressive consolidation of event-specific styles.
Introducing classes like titlemodalEvents, dateboxEvents, and checkboxdivEvents succinctly organizes event UI elements in one place. A few suggestions:
• Consider referencing shared color variables (e.g., #7c9beb) from :root to centralize brand colors and keep consistency.
• Evaluate if some classes (e.g., .borderNone, .colorWhite) can be reused project-wide rather than duplicating utility classes.
Overall, this is a clean approach to unifying the styling for Events.tsx.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c5a3000 and b26422b.

📒 Files selected for processing (3)
  • src/screens/UserPortal/Events/Events.module.css (0 hunks)
  • src/screens/UserPortal/Events/Events.tsx (11 hunks)
  • src/style/app.module.css (1 hunks)
💤 Files with no reviewable changes (1)
  • src/screens/UserPortal/Events/Events.module.css
🔇 Additional comments (4)
src/screens/UserPortal/Events/Events.tsx (4)

22-22: Use caution with indirect CSS imports.
Importing global CSS may inadvertently affect other components. Ensure that the references in app.module.css won't cause conflicts or override styles in unrelated parts of the application.


239-239: Well-organized modal title styling.
Switching from titlemodal to titlemodalEvents is clear and consistent.


283-283: Consistent naming for date/time picker classes.
Renaming to dateboxEvents properly differentiates the event-related pickers. Good job maintaining a consistent theme across these elements.

Also applies to: 287-287, 301-301, 317-317, 332-332


395-395: Button color change requires UX sign-off.
You’ve replaced the green register button with blueregbtnEvents. Verify that the updated color meets accessibility guidelines (contrast ratio, brand alignment, etc.).

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 28, 2024
Copy link

codecov bot commented Dec 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.93%. Comparing base (c9292d1) to head (a45439c).
Report is 2 commits behind head on develop-postgres.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           develop-postgres    #2998       +/-   ##
=====================================================
+ Coverage             31.32%   88.93%   +57.61%     
=====================================================
  Files                   299      320       +21     
  Lines                  7429     8290      +861     
  Branches               1624     1869      +245     
=====================================================
+ Hits                   2327     7373     +5046     
+ Misses                 4897      692     -4205     
- Partials                205      225       +20     

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

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

See comments

src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css 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: 2

🧹 Nitpick comments (2)
src/style/app.module.css (2)

33-34: Consider using semantic color variables.

Instead of using direct hex color codes, consider:

  1. Reusing existing color variables if similar colors exist
  2. Creating semantic variables that describe the purpose (e.g., --date-picker-background, --text-dark)

This helps maintain consistency and makes it easier to update the theme.

:root {
-  --bg-date-picker: #f2f2f2;
-  --grey-bg-color-dark: #707070;
+  /* Reuse existing variables if available */
+  --date-picker-background: var(--grey-bg-color, #f2f2f2);
+  --text-dark: var(--brown-color, #707070);
}

3526-3541: Consider leveraging Bootstrap utility classes.

Instead of creating custom utility classes, consider using Bootstrap's built-in utilities:

  • borderNoneborder-0
  • colorWhitetext-white
  • backgroundWhitebg-white
  • maxWidthmw-100 with custom max-width

This reduces CSS bloat and maintains consistency with Bootstrap's utility-first approach.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b26422b and 93e0be3.

📒 Files selected for processing (1)
  • src/style/app.module.css (2 hunks)

src/style/app.module.css Outdated Show resolved Hide resolved
src/style/app.module.css Outdated Show resolved Hide resolved
palisadoes
palisadoes previously approved these changes Dec 28, 2024
@palisadoes
Copy link
Contributor

Please make code rabbit approve your PR

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 28, 2024
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: 0

🧹 Nitpick comments (4)
src/style/app.module.css (4)

3542-3550: Improve responsive layout handling.

The current layout implementation has potential issues:

  1. Fixed percentage width might not work well on all screen sizes
  2. Fixed pixel values for gaps and padding reduce flexibility
  3. Overflow handling might cause content loss on mobile

Consider these improvements:

.mainContainer {
  margin-top: 2rem;
  width: 100%;
  max-width: 800px;
  flex-grow: 3;
-  max-height: 90vh;
+  max-height: min(90vh, 800px);
  overflow: auto;
  padding: 0 1rem;
+  @media (max-width: 768px) {
+    margin-top: 1rem;
+    padding: 0 0.5rem;
+  }
}

3575-3582: Enhance form control accessibility.

The datePicker class needs accessibility improvements.

Consider these enhancements:

.datePicker {
  border-radius: 10px;
  height: 2.5rem;
  text-align: center;
  background-color: var(--date-picker-background);
  border: none;
  width: 100%;
+  cursor: pointer;
+  &:focus {
+    outline: 2px solid var(--subtle-blue-grey);
+    outline-offset: 2px;
+  }
+  &:focus-visible {
+    outline: 2px solid var(--subtle-blue-grey);
+    outline-offset: 2px;
+  }
}

3656-3675: Optimize button styles.

The button implementation has a duplicate width property and could benefit from better hover state handling.

Apply these improvements:

.blueregbtnEvents {
  margin-top: var(--spacing-lg, 1.25rem);
  border: 1px solid var(--grey-border-box-color);
  box-shadow: 0 2px 2px var(--grey-border-box-color);
  padding: var(--spacing-md, 0.625rem);
  border-radius: 5px;
  background-color: var(--subtle-blue-grey);
-  width: 100%;
  font-size: 16px;
  color: var(--bs-white);
  outline: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  width: 100%;
  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px var(--grey-border-box-color);
+    background-color: var(--subtle-blue-grey-hover);
  }
+  &:focus-visible {
+    outline: 2px solid var(--subtle-blue-grey);
+    outline-offset: 2px;
+  }
+  &:active {
+    transform: translateY(0);
+  }
}

3632-3654: Improve form layout structure.

The checkbox and input layouts could be more maintainable and accessible.

Consider these improvements:

.checkboxdivEvents {
  display: flex;
+  flex-wrap: wrap;
+  gap: var(--spacing-md, 0.625rem);
}

.checkboxdivEvents > div {
-  width: 50%;
+  flex: 1;
+  min-width: 200px;
}

.checkboxdivEvents > label {
-  margin-right: 50px;
+  margin-right: var(--spacing-lg, 1.25rem);
+  display: flex;
+  align-items: center;
+  gap: var(--spacing-sm, 0.5rem);
}

.dispflexEvents {
  display: flex;
  align-items: center;
+  gap: var(--spacing-sm, 0.5rem);
}

.dispflexEvents > input {
  border: none;
  box-shadow: none;
-  margin-top: 5px;
+  margin: 0;
+  padding: var(--spacing-sm, 0.5rem);
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 93e0be3 and a45439c.

📒 Files selected for processing (1)
  • src/style/app.module.css (2 hunks)
🔇 Additional comments (2)
src/style/app.module.css (2)

33-34: LGTM! Well-defined CSS variables.

The new CSS variables are appropriately named and their values are suitable for their intended use in the Events component.


3526-3540: LGTM! Well-organized utility classes.

The utility classes are well-structured and follow a clear naming convention.

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