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: Minor UI changes #10056

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Fix: Minor UI changes #10056

wants to merge 1 commit into from

Conversation

Jeffrin2005
Copy link
Contributor

@Jeffrin2005 Jeffrin2005 commented Jan 19, 2025

Proposed Changes

Edit button

v1.mp4

Closing Button

v2.mp4
  • "Add questionnaire - alignment already fixed"

@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

Release Notes

  • UI Improvements

    • Updated focus styles for dialog and sheet close buttons to improve keyboard navigation accessibility
    • Refined organization selection interface for better user experience
  • Bug Fixes

    • Simplified organization selection logic to prevent potential multi-level selection issues
  • Refactor

    • Streamlined state management for facility organization selector
    • Consolidated organization query logic

@Jeffrin2005 Jeffrin2005 requested a review from a team as a code owner January 19, 2025 16:56
Copy link
Contributor

coderabbitai bot commented Jan 19, 2025

Walkthrough

The pull request introduces focused UI enhancements across multiple components. The changes primarily involve modifying focus ring behaviors in dialog and sheet components by replacing focus:ring-2 with focus-visible:ring-2, which ensures ring effects are only visible during keyboard navigation. Additionally, the FacilityOrganizationSelector component undergoes a significant refactoring, simplifying its organization selection logic from a multi-level hierarchy to a single organization selection approach.

Changes

File Change Summary
src/components/ui/dialog.tsx Updated DialogPrimitive.Close focus ring class from focus:ring-2 to focus-visible:ring-2
src/components/ui/sheet.tsx Updated SheetPrimitive.Close focus ring class from focus:ring-2 to focus-visible:ring-2
src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx Simplified organization selection logic, replaced multi-level state with single organization selection, consolidated organization queries

Assessment against linked issues

Objective Addressed Explanation
Remove black color ring Focus ring modifications address visual styling concerns
Simplify UI component interactions Changes streamline organization selector component

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 A rabbit's tale of UI delight,
Focus rings now dance just right,
Keyboards lead the visual way,
Simplicity wins the day!
Code hops, components gleam 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 19, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit c501e36
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/678d2eb1a918b700080cde5c
😎 Deploy Preview https://deploy-preview-10056--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 (2)
src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx (2)

35-42: Consider maintaining query flexibility for future requirements.

While the current implementation works for single organization selection, hardcoding parent: "" might limit future extensibility if hierarchical organization selection is needed later.

Consider parameterizing the parent filter:

- parent: "",
+ parent: props.parentId || "",

71-89: Add loading state handling for better UX.

The UI implementation looks clean, but it should handle loading states to prevent potential UI flickers or unresponsive appearances during data fetching.

Consider adding loading states:

- const { data: organizations } = useQuery<{
+ const { data: organizations, isLoading } = useQuery<{
   results: FacilityOrganization[];
 }>({

  return (
    <>
      <Label className="mb-2">
        {t("select_department")}
        {required && <span className="text-red-500">*</span>}
      </Label>
      <div className="space-y-4">
        <Autocomplete
          value={selectedOrg}
          options={getOrganizationOptions(organizations?.results)}
          onChange={handleOrgChange}
          placeholder={t("select_department")}
+         disabled={isLoading}
+         loading={isLoading}
        />
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 206ee47 and c501e36.

📒 Files selected for processing (3)
  • src/components/ui/dialog.tsx (1 hunks)
  • src/components/ui/sheet.tsx (1 hunks)
  • src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (4)
src/components/ui/dialog.tsx (1)

47-47: LGTM! Enhanced keyboard navigation focus behavior.

The change from focus:ring-2 to focus-visible:ring-2 improves accessibility by showing the focus ring only during keyboard navigation, reducing visual noise for mouse users while maintaining keyboard accessibility.

src/components/ui/sheet.tsx (1)

67-67: LGTM! Consistent focus behavior across components.

The focus behavior change matches the Dialog component, ensuring a consistent keyboard navigation experience throughout the application.

src/pages/FacilityOrganization/components/FacilityOrganizationSelector.tsx (2)

31-32: LGTM! Simplified state management.

The refactor from multi-level to single organization selection simplifies the state management and improves maintainability.


57-61: LGTM! Clean selection handler implementation.

The handler properly manages both the organization ID and its associated data, with appropriate null checks.

@Jeffrin2005
Copy link
Contributor Author

@rithviknishad @Jacobjeevan Any changes required ?

@github-actions github-actions bot added needs-triage question Further information is requested labels Jan 19, 2025
Comment on lines 46 to 47

const handleLevelChange = (value: string, level: number) => {
const orgList =
level === 0
? getAllOrganizations?.results
: currentLevelOrganizations?.results;

const selectedOrg = orgList?.find((org) => org.id === value);
if (!selectedOrg) return;

const newLevels = selectedLevels.slice(0, level);
newLevels.push(selectedOrg);
setSelectedLevels(newLevels);
setSelectedOrganization(selectedOrg);

// Always update the selected value, regardless of children
onChange(selectedOrg.id);
};

const getOrganizationOptions = (
Copy link
Contributor

Choose a reason for hiding this comment

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

the issue was about changing the icons right?
is this required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minor UI Enhancement
2 participants