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: UI Update Suggestions: Appointment Page (Date Picker Filter) #9958

Conversation

abhimanyurajeesh
Copy link
Contributor

@abhimanyurajeesh abhimanyurajeesh commented Jan 14, 2025

Proposed Changes

  • Fix UI Update Suggestions: Appointment Page (Date Picker Filter) #9968

  • The filter button has been removed as a new filter option is now available. The DateRangePicker component has been aligned to the center of its container for better visual balance. The format for 'Before,' 'On,' and 'After' filters has been standardized to match the format used for 'Today,' 'Yesterday,' and 'Tomorrow' filters. Additionally, the 'Yesterday' filter now displays only the 'From Date,' similar to the 'Today' filter, instead of both 'From' and 'To' dates. Fixed: when selecting a range that starts from today, the today's date is not visible.

@ohcnetwork/care-fe-code-reviewers

Before

image
image
image
image
image

After

image
image
image
image
image

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

  • UI Improvements
    • Updated date range picker button alignment to center.
    • Enhanced date range display logic in Appointments page to include yesterday.
    • Modified calendar day selection and today's date styling for improved visual representation.
    • Simplified Appointments page UI by removing unused imports and filtering options.

Sorry, something went wrong.

@abhimanyurajeesh abhimanyurajeesh requested a review from a team as a code owner January 14, 2025 12:45
Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Walkthrough

This pull request introduces UI updates to the date range picker and appointments page. The changes include centering the date range picker button, modifying the calendar's day selection and today styles, and enhancing the date range display logic in the AppointmentsPage component. The modifications aim to improve the visual consistency and user experience of date-related interactions.

Changes

File Change Summary
src/components/ui/date-range-picker.tsx Button styling modified to center-justify content
src/pages/Appointments/AppointmentsPage.tsx Updated date range display logic to include yesterday, removed unused imports and commented code
src/components/ui/calendar.tsx Modified day_selected and day_today class styles

Assessment against linked issues

Objective Addressed Explanation
Center DateRangePicker
Display current date distinctly Green border added to today's date
Improve date range display for Today/Yesterday
Remove filter button No evidence of filter button removal in this PR

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad

Poem

🐰 A rabbit's dance of dates so bright,
Centered buttons, calendar's delight!
Yesterday and today align,
With styles that sparkle and design,
UI magic takes its flight! 🗓️


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 14, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 4593c3e
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/678b61467553800008840be3
😎 Deploy Preview https://deploy-preview-9958--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.

@abhimanyurajeesh
Copy link
Contributor Author

@rithviknishad requesting for a review, Thank you.

@rithviknishad rithviknishad marked this pull request as draft January 14, 2025 14:40
…y logic for yesterday
@abhimanyurajeesh abhimanyurajeesh marked this pull request as ready for review January 14, 2025 18:43
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

🔭 Outside diff range comments (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

Line range hint 598-642: Remove commented-out code.

Instead of keeping commented-out code, remove it entirely. The code history can be accessed through version control if needed.

Apply this diff to clean up the code:

-          {/* <Popover>
-            <PopoverTrigger asChild>
-              <Button variant="secondary">
-                <CareIcon icon="l-filter" className="mr-2" />
-                <span>{t("filter")}</span>
-              </Button>
-            </PopoverTrigger>
-            <PopoverContent className="mr-11">
-              <div>
-                <Label className="mb-2">{t("date")}</Label>
-                <DateRangePicker
-                  date={{
-                    from: qParams.date_from
-                      ? new Date(qParams.date_from)
-                      : undefined,
-                    to: qParams.date_to ? new Date(qParams.date_to) : undefined,
-                  }}
-                  onChange={(date) =>
-                    setQParams({
-                      ...qParams,
-                      date_from: date?.from ? dateQueryString(date.from) : null,
-                      date_to: date?.to ? dateQueryString(date?.to) : null,
-                    })
-                  }
-                />
-              </div>
-              <div className="flex justify-end bg-gray-100 mt-6 -m-4 py-3 px-4 rounded-md">
-                <Button
-                  variant="outline"
-                  onClick={() =>
-                    setQParams({
-                      date_from: null,
-                      date_to: null,
-                      slot: null,
-                      search: null,
-                      practitioner: null,
-                    })
-                  }
-                >
-                  <ReloadIcon className="mr-2" />
-                  {t("clear_all_filters")}
-                </Button>
-              </div>
-            </PopoverContent>
-          </Popover> */}
🧹 Nitpick comments (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

Line range hint 932-938: Track and implement TODO items.

Several placeholder implementations need to be addressed:

  1. Room information
  2. Labels
  3. Triage category
  4. Token number implementation

Would you like me to help create GitHub issues to track these implementation tasks?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ce2046 and edacbbf.

📒 Files selected for processing (2)
  • public/locale/en.json (3 hunks)
  • src/pages/Appointments/AppointmentsPage.tsx (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • public/locale/en.json
🧰 Additional context used
🪛 Biome (1.9.4)
src/pages/Appointments/AppointmentsPage.tsx

[error] 117-133: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

🔇 Additional comments (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

110-116: LGTM! Date range condition expanded correctly.

The condition has been properly expanded to handle both "Today" and "Yesterday" cases, aligning with the PR objectives.

@abhimanyurajeesh
Copy link
Contributor Author

@rithviknishad requesting for a review, thank you!

@abhimanyurajeesh abhimanyurajeesh changed the title Minor alignment fix in DateRangePicker component Fix: UI Update Suggestions: Appointment Page (Date Picker Filter) Jan 14, 2025
@rajku-dev
Copy link
Contributor

rajku-dev commented Jan 14, 2025

Try selecting a range that starts from Today, today's date is not visible to the user.

@rajku-dev
Copy link
Contributor

rajku-dev commented Jan 15, 2025

@github-actions github-actions bot added needs-triage question Further information is requested labels Jan 15, 2025
@abhimanyurajeesh
Copy link
Contributor Author

Try selecting a range that starts from Today, today's date is not visible to the user.

I have already raised this issue/concern with @rithviknishad , will be updating via cva

@abhimanyurajeesh
Copy link
Contributor Author

This PR is not linked to any issue. Please Refer : https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue

@rajku-dev, thank you, but I'm well aware of linking an issue. I hope you understand that I mentioned the issue without linking it to a fix or any closing keywords because I don’t want to close this issue yet during the merge. The reason is that the current date text becomes invisible when it is selected as the start date. I’m looking for a new background color for the current date. and other

@rithviknishad rithviknishad added changes required and removed question Further information is requested needs-triage labels Jan 15, 2025
@rajku-dev
Copy link
Contributor

This PR is not linked to any issue. Please Refer : https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue

@rajku-dev, thank you, but I'm well aware of linking an issue. I hope you understand that I mentioned the issue without linking it to a fix or any closing keywords because I don’t want to close this issue yet during the merge. The reason is that the current date text becomes invisible when it is selected as the start date. I’m looking for a new background color for the current date. and other

no worries, i'd recommend going with a yellow or green shade for that👍

…y component for consistent styling
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

🔭 Outside diff range comments (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

Line range hint 600-644: Remove commented-out code.

Instead of keeping the commented-out filter button code, it should be removed since it's no longer needed. If needed, the code can be retrieved from version control history.

🧹 Nitpick comments (1)
src/components/ui/calendar.tsx (1)

51-53: LGTM! The styling changes improve visibility.

The green border for today's date and the simplified selected day styles enhance visibility. Consider adding a transition to the border for a smoother user experience.

-          "dark:bg-gray-800 dark:text-gray-50 border-2 border-green-500",
+          "dark:bg-gray-800 dark:text-gray-50 border-2 border-green-500 transition-all duration-200",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between edacbbf and 532181a.

📒 Files selected for processing (2)
  • src/components/ui/calendar.tsx (1 hunks)
  • src/pages/Appointments/AppointmentsPage.tsx (7 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/pages/Appointments/AppointmentsPage.tsx

[error] 117-133: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (2)
src/pages/Appointments/AppointmentsPage.tsx (2)

201-202: LGTM! Consistent date format styling.

The changes standardize the date format display across "on", "before", and "after" filters, improving visual consistency.

Also applies to: 213-214, 224-227


110-133: ⚠️ Potential issue

Remove unnecessary fragment.

The fragment (<>...</>) is redundant here as it's used in a return statement.

Apply this diff to fix the issue:

-    <>
      {dateFrom === dateQueryString(today) ? (
        <>
          <span className="text-black">{t("today")}</span>
          <span className="pl-1 text-gray-500">
            ({formatDate(dateFrom, "dd MMM yyyy")})
          </span>
        </>
      ) : (
        <>
          <span className="text-black">{t("yesterday")}</span>
          <span className="pl-1 text-gray-500">
            ({formatDate(dateFrom, "dd MMM yyyy")})
          </span>
        </>
      )}
-    </>;

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 117-133: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

Copy link
Contributor

@Jacobjeevan Jacobjeevan left a comment

Choose a reason for hiding this comment

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

Hmm, we should do something about the dropdown placement 🤔 Since it keeps moving on different selection.

Otherwise lgtm.

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.

@abhimanyurajeesh for the thing which @Jacobjeevan mentioned:

let's keep that label (date as readable string) within the PopoverTrigger component, and maybe also set the PopoverContent's align prop to start to remove that jitter when trigger's width changes.

other than these two lgtm;

@abhimanyurajeesh
Copy link
Contributor Author

@abhimanyurajeesh for the thing which @Jacobjeevan mentioned:

let's keep that label (date as readable string) within the PopoverTrigger component, and maybe also set the PopoverContent's align prop to start to remove that jitter when trigger's width changes.

other than these two lgtm;

Okaii, 🙌

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 (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

Line range hint 789-789: Address TODO comments for token number and room information.

There are two pending implementations:

  1. Replace the fake token number with the actual token number
  2. Add the room information display

Would you like me to:

  1. Open GitHub issues to track these TODOs?
  2. Help implement these features by providing the necessary code?

Also applies to: 849-849

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 38d7f61 and 4593c3e.

📒 Files selected for processing (1)
  • src/pages/Appointments/AppointmentsPage.tsx (6 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/pages/Appointments/AppointmentsPage.tsx

[error] 117-133: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test
  • GitHub Check: cypress-run (1)
  • GitHub Check: CodeQL-Build
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (2)
src/pages/Appointments/AppointmentsPage.tsx (2)

458-465: LGTM! Improved date picker button UI.

The changes enhance the visual presentation and accessibility of the date picker:

  • Ghost variant provides a cleaner look
  • Edit3Icon improves user interaction affordance
  • Label wrapping enhances accessibility

110-133: 🛠️ Refactor suggestion

Remove unnecessary fragment and simplify the return statement.

The code can be improved by:

  1. Removing the redundant fragment wrapper
  2. Simplifying the return statement structure

Apply this diff to improve the code:

  // Case 1: Today only or Yesterday only
  if (
    (dateFrom === dateQueryString(today) &&
      dateTo === dateQueryString(today)) ||
    (dateFrom === dateQueryString(subDays(today, 1)) &&
      dateTo === dateQueryString(subDays(today, 1)))
  ) {
-    <>
-      {dateFrom === dateQueryString(today) ? (
-        <>
-          <span className="text-black">{t("today")}</span>
-          <span className="pl-1 text-gray-500">
-            ({formatDate(dateFrom, "dd MMM yyyy")})
-          </span>
-        </>
-      ) : (
-        <>
-          <span className="text-black">{t("yesterday")}</span>
-          <span className="pl-1 text-gray-500">
-            ({formatDate(dateFrom, "dd MMM yyyy")})
-          </span>
-        </>
-      )}
-    </>;
+    return (
+      <>
+        <span className="text-black">
+          {dateFrom === dateQueryString(today) ? t("today") : t("yesterday")}
+        </span>
+        <span className="pl-1 text-gray-500">
+          ({formatDate(dateFrom, "dd MMM yyyy")})
+        </span>
+      </>
+    );
  }

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 117-133: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

@abhimanyurajeesh
Copy link
Contributor Author

@rithviknishad its done.

@rithviknishad rithviknishad merged commit 23806f6 into ohcnetwork:develop Jan 20, 2025
17 checks passed
Copy link

@abhimanyurajeesh Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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.

UI Update Suggestions: Appointment Page (Date Picker Filter)
4 participants