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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

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 a new label for "Resource Status" 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.
    • Introduced a loading state indicator while data is being fetched.
  • Bug Fixes

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

    • Updated styling and layout for the Resource List to enhance user experience.

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

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 pair: "resource_status": "Resource Status"
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

needs review, 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

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 4bb1ef0 and bb2e81f.

📒 Files selected for processing (2)
  • public/locale/en.json (1 hunks)
  • src/components/Resource/ResourceList.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • public/locale/en.json
  • 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 bb2e81f
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67349d3e542e0500084be3df
😎 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

@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
className="w-3/4 mt-1 h-fit flex h-5 shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium leading-4 overflow-hidden whitespace-nowrap text-ellipsis truncate bg-gray-200"
>
<CareIcon icon="l-truck" className="mr-2" />
<dd className="text-sky-600 truncate">{resource.status}</dd>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<dd className="text-sky-600 truncate">{resource.status}</dd>
<dd className="text-sky-600 truncate">{t(`resource_status__${resource.status}`)}</dd>

Add translations

Comment on lines +94 to +104
<dt
title={t("resource_status")}
className={`w-fit mt-1 h-fit flex h-5 shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium leading-4 ${
resource.status === "APPROVED"
? "bg-sky-200"
: "bg-yellow-200 text-yellow-500"
}`}
>
<CareIcon icon="l-truck" className="mr-2" />
<dd className="text-sky-600">{resource.status}</dd>
</dt>
Copy link
Member

Choose a reason for hiding this comment

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

Can we use the <Chip> component here?

<ResourceBlock resource={resource} />
return data.map((resource: ResourceModel, i) => (
<div key={i} className="w-full border-b-2 border-gray-100 col-span-6">
<div className="border-3 flex grid w-full gap-1 overflow-hidden bg-white p-4 shadow sm:grid-cols-1 md:grid-cols-1 lg:grid-cols-5">
Copy link
Member

Choose a reason for hiding this comment

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

We are moving away from shadows in our designs, lets use borders. gray-300 or gray-200 border would be fine

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
3 participants