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

Design of List View layout in Resource Page #9096

Merged

Conversation

AnveshNalimela
Copy link
Contributor

@AnveshNalimela AnveshNalimela commented Nov 12, 2024

Proposed Changes

@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

    • Added new labels for "Approved," "Pending," "Resource Status," and "Transportation" in English localization.
    • Enhanced the Resource List component with a new grid layout displaying detailed resource information, including title, category, status, and last modified date.
  • Bug Fixes

    • Improved rendering logic for resource status with conditional styling.
  • Style

    • Updated styling and layout for the Resource List to enhance user experience, including adjustments for better visual clarity and organization.

@AnveshNalimela AnveshNalimela requested a review from a team as a code owner November 12, 2024 18:53
Copy link
Contributor

coderabbitai bot commented Nov 12, 2024

Walkthrough

The changes introduced in this pull request involve updates to both localization and the user interface of the resource list. A new key for resource status has been added to the English locale JSON file, enhancing localization. Additionally, the ListView component in the ResourceList has undergone significant modifications, including a new layout, improved rendering logic for resource details, and the inclusion of a Link component for navigation. These updates aim to enhance visual consistency and improve the user experience across the application.

Changes

File Change Summary
public/locale/en.json Added new key-value pairs: "APPROVED": "Approved", "PENDING": "Pending", "resource_status": "Resource Status", "TRANSPORTATION TO BE ARRANGED": "Transportation"
src/components/Resource/ResourceList.tsx Updated ListView component: modified import, enhanced rendering logic, restructured layout, and added Link for navigation.

Assessment against linked issues

Objective Addressed Explanation
Update the List view Layout in Resources (#9090)

Possibly related PRs

Suggested labels

tested

Suggested reviewers

  • rithviknishad
  • shivankacker

Poem

In the land of code where the rabbits play,
A new status shines bright, lighting the way.
With lists now arranged in a beautiful sight,
Our resources are ready, all polished and bright!
Hops of joy echo, as we code and we cheer,
For every small change brings the user near! 🐇✨

Warning

Rate limit exceeded

@AnveshNalimela has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1d159 and fab7498.

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/components/Resource/ResourceList.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.json': Cannot find module '@typescript-eslint/parser'
Require stack:

  • /.eslintrc.json
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Function.resolve (node:internal/modules/helpers:145:19)
    at Object.resolve (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2346:46)
    at ConfigArrayFactory._loadParser (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3325:39)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3099:43)
    at _normalizeObjectConfigDataBody.next ()
    at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3040:20)
    at _normalizeObjectConfigData.next ()
    at ConfigArrayFactory.loadInDirectory (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2886:28)
    at CascadingConfigArrayFactory._loadConfigInAncestors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3871:46)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7f1d159 and fab7498.

📒 Files selected for processing (1)
  • src/components/Resource/ResourceList.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Resource/ResourceList.tsx

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 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 Nov 12, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit fab7498
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6736cf250c06a00008ef4a72
😎 Deploy Preview https://deploy-preview-9096--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.

@github-actions github-actions bot added needs-triage question Further information is requested labels Nov 12, 2024
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: 3

🧹 Outside diff range and nitpick comments (5)
src/components/Resource/ResourceList.tsx (5)

195-195: Remove Unnecessary Empty Div

At line 195, there is an empty <div> with styling that may not be necessary. Removing it can simplify the layout and reduce unnecessary DOM elements.

Apply this diff to remove the empty div:

- <div className="md:px-4"></div>

242-242: Simplify and Verify Translation Key for Category

The translation key {t("LOG_UPDATE_FIELD_LABEL__patient_category")} at line 242 is verbose and may not accurately reflect the resource category. Consider using a more appropriate and concise key, such as {t("resource_category")}, for clarity.


87-87: Simplify Complex Class Names

At line 87, the class names applied are complex and may reduce readability. Consider simplifying the class names or using utility classes for better maintainability.


209-209: Use Standard Spacing Classes for Consistency

At line 209, an arbitrary padding value py-[11px] is used. To maintain consistency with the design system, consider using standard spacing classes provided by Tailwind CSS, such as py-3.

Apply this diff to use a standard spacing class:

- <ButtonV2 className="py-[11px]" onClick={onBoardViewBtnClick}>
+ <ButtonV2 className="py-3" onClick={onBoardViewBtnClick}>

210-210: Use Appropriate Icon Instead of Rotating

At line 210, the icon l-list-ul is rotated by 90 degrees using className="rotate-90". Instead of rotating the icon, consider using an icon that directly represents the desired orientation to improve performance and clarity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb54b3 and 4bb1ef0.

📒 Files selected for processing (2)
  • public/locale/en.json (1 hunks)
  • src/components/Resource/ResourceList.tsx (5 hunks)
🔇 Additional comments (2)
public/locale/en.json (1)

1094-1094: LGTM! The new translation key follows conventions.

The addition of the resource_status key maintains consistent naming conventions, proper capitalization, and alphabetical ordering used throughout the localization file.

src/components/Resource/ResourceList.tsx (1)

102-103: Ensure Text Color Contrast Meets Accessibility Standards

At lines 102-103, the text color text-yellow-500 on a background bg-yellow-200 may not provide sufficient contrast for readability. Please verify that the color combination meets WCAG accessibility guidelines.

src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/Resource/ResourceList.tsx Show resolved Hide resolved
@rithviknishad
Copy link
Member

add readable titles for the PR @AnveshNalimela

@AnveshNalimela AnveshNalimela changed the title Issue/#9090/listview resources Design of List View layout in Resource Page Nov 13, 2024
@AnveshNalimela
Copy link
Contributor Author

@rithviknishad Could you check on these PR a

@rithviknishad rithviknishad added needs testing needs review and removed question Further information is requested needs-triage labels Nov 13, 2024
src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
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 and nitpick comments (3)
src/components/Resource/ResourceList.tsx (3)

110-110: Update translation key pattern

The direct status translation might not handle all cases consistently. Consider using a dedicated translation key pattern for resource statuses.

- text={t(`${resource.status}`)}
+ text={t(`resource_status__${resource.status.toLowerCase()}`)}

89-89: Improve accessibility attributes

The title attributes are good, but the elements could benefit from additional accessibility improvements:

  • Add aria-label for better screen reader support
  • Ensure color contrast meets WCAG standards
- className="w-3/4 mt-1 h-fit flex h-5 shrink-0 items-center px-2 py-0.5 text-xs font-medium leading-4  overflow-hidden whitespace-nowrap text-ellipsis truncate"
+ className="w-3/4 mt-1 h-fit flex h-5 shrink-0 items-center px-2 py-0.5 text-xs font-medium leading-4  overflow-hidden whitespace-nowrap text-ellipsis truncate"
+ aria-label={t("resource_status_label")}
+ role="status"

Also applies to: 101-102


85-85: Simplify responsive classes

The responsive classes are quite complex and could be simplified using Tailwind's responsive modifiers more effectively.

- className="3xl:flex-row mb-2 flex gap-2 sm:flex-row md:flex-row lg:flex-col xl:flex-row 2xl:flex-row "
+ className="mb-2 flex gap-2 flex-col lg:flex-row"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bb2e81f and 38eb8e6.

📒 Files selected for processing (2)
  • public/locale/en.json (4 hunks)
  • src/components/Resource/ResourceList.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • public/locale/en.json
🧰 Additional context used
📓 Learnings (1)
src/components/Resource/ResourceList.tsx (1)
Learnt from: AnveshNalimela
PR: ohcnetwork/care_fe#9096
File: src/components/Resource/ResourceList.tsx:245-245
Timestamp: 2024-11-13T12:33:52.373Z
Learning: When displaying the resource status in `ResourceList.tsx`, use `{t("consent__status")}` instead of adding a new translation key `{t("resource_status")}`.
🔇 Additional comments (1)
src/components/Resource/ResourceList.tsx (1)

86-118: Verify consistent status handling

Let's verify that the status handling is consistent across the codebase.

✅ Verification successful

Status handling is consistent across the codebase

The verification shows that the status handling in ResourceList.tsx is consistent with the rest of the codebase:

  • The statuses "TRANSPORTATION TO BE ARRANGED" and "APPROVED" are properly defined in translation files (public/locale/en.json)
  • These statuses are consistently used in constants (src/common/constants.tsx)
  • The UI treatment (Chip component styling) is consistent with other status displays in the codebase
  • The conditional rendering based on status matches the pattern used in other components
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for all resource status usages
echo "Checking resource status handling patterns..."
rg -l "resource\.status" --type tsx --type ts

# Check for different translation patterns used with status
echo "\nChecking translation patterns for status..."
rg "t\(['\"`].*status.*['\"`]\)" --type tsx --type ts

Length of output: 462


Script:

#!/bin/bash
# Search for all resource status usages with proper file type
echo "Checking resource status handling patterns..."
rg -l "resource\.status" -t typescript -t javascriptreact -t typescriptreact

# Check for different translation patterns used with status
echo -e "\nChecking translation patterns for status..."
rg "t\(['\"].*status.*['\"]\)" -t typescript -t javascriptreact -t typescriptreact

Length of output: 441


Script:

#!/bin/bash
# Search for all resource status usages without file type filters
echo "Checking resource status handling patterns..."
rg "resource\.status.*==="

# Look for status-related string literals and translations
echo -e "\nChecking status-related patterns..."
rg "(TRANSPORTATION TO BE ARRANGED|APPROVED)"

# Look for Chip components with status-related props
echo -e "\nChecking Chip component usage with status..."
rg "status.*===.*['\"]" -A 2 -B 2

Length of output: 21023

src/components/Resource/ResourceList.tsx Outdated Show resolved Hide resolved
@khavinshankar
Copy link
Member

@nihal467 can u please look into the cypress failure

Copy link
Member

@shivankacker shivankacker left a comment

Choose a reason for hiding this comment

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

LGTM, tests are failing

@AnveshNalimela
Copy link
Contributor Author

I Dont Know Why they are failing. HCX claim specs are failing .

@nihal467
Copy link
Member

LGTM

@rithviknishad rithviknishad merged commit a8beedc into ohcnetwork:develop Nov 18, 2024
23 checks passed
Copy link

@AnveshNalimela 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! 🙌

Rishith25 pushed a commit to Rishith25/care_fe that referenced this pull request Nov 25, 2024
UdaySagar-Git pushed a commit to UdaySagar-Git/care_fe that referenced this pull request Dec 3, 2024
@AnveshNalimela AnveshNalimela deleted the issue/#9090/listview-resources branch December 11, 2024 14:01
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.

Update the List view Layout in Resources
6 participants