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: Ensure weekdays are responsive on medium and small screens " #9747

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

kris70lesgo
Copy link

@kris70lesgo kris70lesgo commented Jan 4, 2025

#9738)"
Here’s how you can format the changelog entry for your code changes:

Proposed Changes
Fixes #9738

400133648-de91be8f-bf19-4b13-b05c-e4099577d802

Feature: Implemented WeekdayCheckbox component to allow selecting multiple weekdays with a grid layout.
UI Update: Changed layout from a flex-based design to a grid-based design for better structuring of days.
Styling: Adjusted padding (px-8 py-6) and border styling to ensure consistent checkbox appearance.
Label Alignment: Ensured labels are centered and aligned across all screen sizes for a cleaner UI.
Code Optimization: Removed redundant class declarations for improved clarity and readability.
@ohcnetwork/care-fe-code-reviewers

Merge Checklist
Add specs that demonstrate bug / test a new feature.
Update product documentation.
Ensure that UI text is kept in I18n files.
Prep screenshot or demo video for changelog entry, and attach it to issue.
Request for Peer Reviews
Completion of QA

Summary by CodeRabbit

  • Style
    • Updated WeekdayCheckbox component layout to use responsive grid design
    • Adjusted checkbox container padding for improved visual consistency
    • Centered checkbox labels

@kris70lesgo kris70lesgo requested a review from a team as a code owner January 4, 2025 15:57
Copy link
Contributor

coderabbitai bot commented Jan 4, 2025

Walkthrough

The pull request modifies the WeekdayCheckbox component to improve its responsiveness across different screen sizes. The changes primarily involve updating the layout from a flexbox to a grid system, which allows for a more adaptive design. The component now uses responsive grid classes that adjust the number of columns based on screen width, ensuring that weekday checkboxes are fully visible and properly spaced on various device sizes.

Changes

File Change Summary
src/CAREUI/interactive/WeekdayCheckbox.tsx - Replaced flexbox layout with responsive grid layout
- Updated container classes from "flex justify-between" to "grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-7"
- Reduced padding from "px-8 py-6" to "p-4"
- Added "text-center" to label classes

Assessment against linked issues

Objective Addressed Explanation
Ensure weekdays are fully visible on medium and smaller screens [#9738]

Suggested Labels

needs review, tested

Suggested Reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 Checkboxes dance in grid's embrace,
Responsive layout with pixel-perfect grace
From mobile to desktop, days align
No more cut-offs, everything's fine!
A rabbit's design, clean and bright 🌈


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.

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.

Copy link

netlify bot commented Jan 4, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 98738f2
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67795addcaade000083b9622
😎 Deploy Preview https://deploy-preview-9747--care-ohc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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/CAREUI/interactive/WeekdayCheckbox.tsx (2)

41-41: Remove extra spaces or trailing whitespace.
It appears there's an indentation or whitespace mismatch detected by the static analysis tool on this line. Cleaning it up eliminates unnecessary clutter, ensuring consistent formatting.

-  
+
🧰 Tools
🪛 eslint

[error] 41-41: Delete ··

(prettier/prettier)


70-70: Remove extra blank line to satisfy prettier rules.
The static analysis tool indicates an unnecessary line break at the end of the file. Removing it aligns with coding style guidelines.

-  
+
🧰 Tools
🪛 eslint

[error] 69-70: Delete ⏎··

(prettier/prettier)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8d4ba31 and 98738f2.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/CAREUI/interactive/WeekdayCheckbox.tsx (3 hunks)
🧰 Additional context used
🪛 eslint
src/CAREUI/interactive/WeekdayCheckbox.tsx

[error] 41-41: Delete ··

(prettier/prettier)


[error] 49-49: Insert ,

(prettier/prettier)


[error] 69-70: Delete ⏎··

(prettier/prettier)

🔇 Additional comments (3)
src/CAREUI/interactive/WeekdayCheckbox.tsx (3)

38-38: Good move to a grid layout for responsive design.
This change effectively improves the responsiveness of the WeekdayCheckbox component across various screen sizes, reducing layout breaks and improving the user experience.


46-46: Nicely structured UI layout.
Using flex flex-col in tandem with items-center justify-center is a clean approach for centering elements. This improved organization helps maintain a straightforward user experience.


59-59: Center-aligned label for cleaner UI
Centering the label text promotes consistency and a user-friendly layout. This is a solid improvement to accessibility and aesthetics.

isChecked
? "border-primary-500 bg-white shadow"
: "border-gray-300",
: "border-gray-300"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

The trailing comma is required after the ternary expression

The linting error is correct. The code shows a template literal using cx() or a similar utility where multiple class strings are being composed. In this context, each item in the array (including the last one) should have a trailing comma according to your Prettier configuration. The ternary expression isChecked ? "border-primary-500 bg-white shadow" : "border-gray-300" is the last item in the array and needs a trailing comma.

Here's the problematic code:

cx(
  "flex flex-col items-center justify-center gap-2 rounded-lg border p-4 transition-all duration-200 ease-in-out",
  isChecked
    ? "border-primary-500 bg-white shadow"
    : "border-gray-300"  // <-- Missing trailing comma
)}
🔗 Analysis chain

Verify the static analysis request for a trailing comma.
The static analysis tool reports a missing comma at line 49. However, this might be a false positive given the ternary expression. Double-check your prettier/eslint configs to confirm if a trailing comma is truly required.


Based on the linting output, I can see that there is indeed a Prettier error at line 49 in src/CAREUI/interactive/WeekdayCheckbox.tsx that requires a trailing comma. Let me verify the surrounding context to ensure this is not a false positive.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify linting, focusing on missing commas or spacing issues around line 49
npm run lint || yarn lint

Length of output: 66359


Script:

#!/bin/bash
# Check the context around line 49 in WeekdayCheckbox.tsx
rg -A 3 -B 3 "border-gray-300" src/CAREUI/interactive/WeekdayCheckbox.tsx

Length of output: 378

🧰 Tools
🪛 eslint

[error] 49-49: Insert ,

(prettier/prettier)

Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

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

lgtm, do fix the coderabbits comment, discard lockfile changes and check the lint fixes....

also next time, do ensure the issue gets assigned before you work on it to avoid duplication of efforts. i had already made it responsive along with a bunch of other fixes and validations.... ignoring since this is your first time contribution 😀

Copy link
Member

Choose a reason for hiding this comment

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

discard the lockfile changes

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback! I’ll address the CodeRabbit comments, discard the package-lock.json changes, and verify the lint fixes. I appreciate the reminder about assigning issues before working on them to avoid duplication. This is my first time contributing to open source so i apologise for my misatkes.

Copy link
Member

Choose a reason for hiding this comment

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

No worries. Welcome to the community! Checkout https://docs.ohc.network and join our community at https://slack.ohc.network/

Copy link
Author

@kris70lesgo kris70lesgo Jan 5, 2025

Choose a reason for hiding this comment

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

i have already joined the community . I have fixed lint issues and discard lockfile changes should i push(i used npx prettier --write . which reformats entire codebase and also caused 400 commits) ?

Copy link
Member

@rithviknishad rithviknishad Jan 5, 2025

Choose a reason for hiding this comment

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

yup, need not ask btw 😅

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.

Weekdays Not Showing or Being Cut Off on Medium and Smaller Screens
2 participants