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: Adjust containers flexibility and inconsistency #10553

Draft
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

Tanuj1718
Copy link
Contributor

@Tanuj1718 Tanuj1718 commented Feb 11, 2025

Proposed Changes

Before Update:

Screen.Recording.2025-02-10.at.10.39.05.AM.mov

After Update:

Screen.Recording.2025-02-11.at.1.49.21.PM.mov

@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

    • Enhanced visual alignment and spacing of scheduling form fields, including time selection areas.
    • Standardized dimensions and margins for a cleaner, more consistent layout.
  • Refactor

    • Simplified the structure of the scheduling section for improved clarity and a more streamlined interface.

@Tanuj1718 Tanuj1718 requested a review from a team as a code owner February 11, 2025 08:30
Copy link
Contributor

coderabbitai bot commented Feb 11, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request introduces modifications to the layout and structure of the CreateScheduleTemplateSheet component, focusing on the form fields for scheduling templates. The start_time and end_time fields are now in a centered flex container with a fixed height (h-28), and their margins have been adjusted for consistency. The slot_size_in_minutes and tokens_per_slot fields have standardized spacing, while the overall structure of the availabilities section has been refined. These changes enhance the visual presentation of the form fields without altering any core functionality.

Changes

File Path Change Summary
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx Revised layout for start_time and end_time fields using a centered flex container with explicit height; adjusted margins for FormItem components; standardized spacing for slot_size_in_minutes and tokens_per_slot; refined structure of availabilities section.

Sequence Diagram(s)

(No sequence diagrams generated as the changes only affect UI styling and layout adjustments without modifying control flow.)

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • Jacobjeevan
  • rithviknishad

Poem

I'm a bunny, hopping through the code,
Admiring neat layouts where form fields are bestowed.
With margins in place and centers so fine,
I savor the changes like a garden of thyme.
CodeRabbit sings, my whiskers all aglow,
Celebrating order wherever I go! 🐰


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 Feb 11, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 3b03fdc
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67ab0aacf39da30008907abf
😎 Deploy Preview https://deploy-preview-10553--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

netlify bot commented Feb 11, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 7a5ab28
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67af2b761d514f0008f5eb03
😎 Deploy Preview https://deploy-preview-10553.preview.ohc.network
📱 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: 0

🧹 Nitpick comments (2)
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx (2)

434-468: Simplify the time fields container layout.

The current implementation has redundant height constraints and unnecessary margins that could cause layout issues.

Consider this simplified layout:

-<div className="flex items-center gap-0 sm:gap-4 col-span-2 md:col-span-1 h-28">
-  <div className="flex items-center justify-center mt-16">
+<div className="flex items-center gap-0 sm:gap-4 col-span-2 md:col-span-1">
+  <div className="flex items-center justify-center">
     <FormField
       control={form.control}
       name={`availabilities.${index}.start_time`}
       render={({ field }) => (
-        <FormItem className="flex-1 mb-12 h-28">
+        <FormItem className="flex-1">
           <FormLabel required>
             {t("start_time")}
           </FormLabel>
           <FormControl>
             <Input type="time" {...field} />
           </FormControl>
           <FormMessage />
         </FormItem>
       )}
     />

-    <ArrowRightIcon className="size-4 mb-20" />
+    <ArrowRightIcon className="size-4 mx-2" />

     <FormField
       control={form.control}
       name={`availabilities.${index}.end_time`}
       render={({ field }) => (
-        <FormItem className="flex-1 mb-12 h-28">
+        <FormItem className="flex-1">
           <FormLabel required>{t("end_time")}</FormLabel>
           <FormControl>
             <Input type="time" {...field} />
           </FormControl>
           <FormMessage />
         </FormItem>
       )}
     />
   </div>
 </div>

473-529: Standardize the slot configuration fields layout.

The container has redundant height constraints and inconsistent spacing.

Consider this simplified layout:

-<div className="flex items-center gap-2 sm:gap-4 col-span-2 md:col-span-1 h-28 pt-4">
+<div className="flex items-center gap-2 sm:gap-4 col-span-2 md:col-span-1">
   <FormField
     control={form.control}
     name={`availabilities.${index}.slot_size_in_minutes`}
     render={({ field }) => (
-      <FormItem className="flex-1 mt-4 mb-8 h-24">
+      <FormItem className="flex-1">
         <FormLabel
           required
           className="whitespace-nowrap"
         >
           {t("schedule_slot_size_label")}
         </FormLabel>
         <FormControl>
           <Input
             type="number"
             min={0}
             placeholder="e.g. 10"
             {...field}
             value={field.value ?? ""}
             onChange={(e) =>
               field.onChange(e.target.valueAsNumber)
             }
           />
         </FormControl>
         <FormMessage />
       </FormItem>
     )}
   />

   <FormField
     control={form.control}
     name={`availabilities.${index}.tokens_per_slot`}
     render={({ field }) => (
-      <FormItem className="flex-1 mt-4 mb-8 h-24">
+      <FormItem className="flex-1">
         <FormLabel
           required
           className="whitespace-nowrap"
         >
           {t("patients_per_slot")}
         </FormLabel>
         <FormControl>
           <Input
             type="number"
             min={0}
             placeholder="e.g. 1"
             {...field}
             value={field.value ?? ""}
             onChange={(e) =>
               field.onChange(e.target.valueAsNumber)
             }
           />
         </FormControl>
         <FormMessage />
       </FormItem>
     )}
   />
 </div>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9f223f8 and 69630df.

📒 Files selected for processing (1)
  • src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: cypress-run (1)
🔇 Additional comments (2)
src/pages/Scheduling/components/CreateScheduleTemplateSheet.tsx (2)

537-555: Clean implementation of the remarks field container.

The container follows a clean layout without unnecessary height constraints or margins.


257-606: Well-structured form with proper validation and responsive layout.

The form implementation demonstrates good practices:

  • Proper grid layout for field organization
  • Responsive design with mobile-first approach
  • Comprehensive form validation
  • Clear error handling

control={form.control}
name={`availabilities.${index}.end_time`}
render={({ field }) => (
<FormItem className="flex-1 mb-12 h-28">
Copy link
Contributor

Choose a reason for hiding this comment

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

See if you can solve this without specifying a particular height for the FormItem components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we have to set the height in both FormItems because we are showing message in one container so it will get adjusted automatically if we will not set the height. Is there any issue with this approach?🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we don't want to randomly set height like that 😅

https://css-tricks.com/snippets/css/a-guide-to-flexbox/

You should be able to solve this without setting height.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok sure. I will do it with different approach.👍

@rithviknishad rithviknishad marked this pull request as draft February 13, 2025 12:33
@rithviknishad
Copy link
Member

mark it for ready for review once changes have been made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency in containers during schedule creation for a doctor
3 participants