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

Resolved the unwanted hover effect and the text colour remains constant #10120

Conversation

NikhilA8606
Copy link
Contributor

@NikhilA8606 NikhilA8606 commented Jan 23, 2025

Proposed Changes

Here is the screenshot
image

@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

  • New Features

    • Enhanced visual feedback for selected appointment slots.
    • Improved slot selection highlighting in the calendar component.
  • Bug Fixes

    • Refined error handling for slot queries.
    • Corrected text color display for selected and available slots.

@NikhilA8606 NikhilA8606 requested a review from a team as a code owner January 23, 2025 10:57
Copy link
Contributor

coderabbitai bot commented Jan 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request focuses on enhancing the visual feedback for selected appointment slots in two components: AppointmentSlotPicker.tsx and Schedule.tsx. The primary modification involves adjusting the text color rendering logic when a slot is selected, ensuring that the selected slot is clearly distinguishable while maintaining the existing color-coding for slot availability. The changes aim to improve user interface clarity by providing a more intuitive visual indication of the selected time slot.

Changes

File Change Summary
src/pages/Appointments/components/AppointmentSlotPicker.tsx Updated text color rendering logic to apply "text-white" when a slot is selected
src/pages/PublicAppointments/Schedule.tsx Modified slot button rendering to highlight selected slot with "text-white" class; adjusted error handling for slot queries

Assessment against linked issues

Objective Addressed Explanation
Remove Unwanted Hover Effect [#10118]

Possibly related PRs

Suggested labels

tested, reviewed

Poem

🐰 Slots of time, now crystal clear,
White text dancing, selection near,
A rabbit's touch of UI delight,
Making choices shine so bright!
Hop, hop, hooray for clarity's might! 🕒


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6171445 and c309bcb.

📒 Files selected for processing (2)
  • src/pages/Appointments/components/AppointmentSlotPicker.tsx (1 hunks)
  • src/pages/PublicAppointments/Schedule.tsx (1 hunks)

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

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit c309bcb
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/679228f6cc014100087693c0
😎 Deploy Preview https://deploy-preview-10120--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: 0

🧹 Nitpick comments (1)
src/pages/PublicAppointments/Schedule.tsx (1)

334-342: Consider simplifying the nested ternary operators.

While the changes correctly address the text color consistency, the deeply nested ternary operators could be simplified for better maintainability.

Consider extracting the color logic into a separate function:

-selectedSlot?.id === slot.id
-  ? "text-white"
-  : percentage >= 1
-    ? "text-gray-400"
-    : percentage >= 0.8
-      ? "text-red-600"
-      : percentage >= 0.6
-        ? "text-yellow-600"
-        : "text-green-600"
+getSlotTextColor(selectedSlot?.id === slot.id, percentage)

+// Add this function above the component or in a utils file
+function getSlotTextColor(isSelected: boolean, percentage: number): string {
+  if (isSelected) return "text-white";
+  if (percentage >= 1) return "text-gray-400";
+  if (percentage >= 0.8) return "text-red-600";
+  if (percentage >= 0.6) return "text-yellow-600";
+  return "text-green-600";
+}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 999a41b and 6171445.

📒 Files selected for processing (2)
  • src/pages/Appointments/components/AppointmentSlotPicker.tsx (1 hunks)
  • src/pages/PublicAppointments/Schedule.tsx (1 hunks)
🔇 Additional comments (1)
src/pages/Appointments/components/AppointmentSlotPicker.tsx (1)

215-223: LGTM! The text color logic enhancement improves readability.

The changes effectively address the text color consistency issue by:

  1. Setting white text for selected slots
  2. Maintaining the existing color-coding for availability status
  3. Using group-hover for consistent hover state

Comment on lines 215 to 224
selectedSlotId === slot.id
? "text-white"
: percentage >= 1
? "text-gray-400"
: percentage >= 0.8
? "text-red-600"
: percentage >= 0.6
? "text-yellow-600"
: "text-green-600",
)}
Copy link
Member

Choose a reason for hiding this comment

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

let's simplify this logic.

@github-actions github-actions bot added the Deploy-Failed Deplyment is not showing preview label Jan 23, 2025
@rithviknishad rithviknishad merged commit 074d97a into ohcnetwork:develop Jan 23, 2025
11 checks passed
@rithviknishad rithviknishad removed the Deploy-Failed Deplyment is not showing preview label Jan 23, 2025
Copy link

@NikhilA8606 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Unwanted Hover Effect After Field Selection
2 participants