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

Update the Card Design in Notice Board #9343

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

Conversation

AnveshNalimela
Copy link
Contributor

@AnveshNalimela AnveshNalimela commented Dec 9, 2024

Proposed Changes

Before
image

After:
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 layout and styling of the NoticeBoard component for improved visual presentation.
    • Introduced the Avatar component for displaying user avatars in notifications.
  • Bug Fixes

    • Improved spacing and organization of notification details, including better margin and padding adjustments.

@AnveshNalimela AnveshNalimela requested a review from a team as a code owner December 9, 2024 17:57
Copy link
Contributor

coderabbitai bot commented Dec 9, 2024

Walkthrough

The NoticeBoard component in src/components/Notifications/NoticeBoard.tsx has been modified to improve its rendering logic and styling. Key changes include the addition of a margin-top class, a new layout featuring a CareIcon alongside the notification message, and an encapsulating background container for notification details. The styling adjustments enhance the visual presentation of the notifications, including improved spacing and font weight for the caused_by information and creation date.

Changes

File Change Summary
src/components/Notifications/NoticeBoard.tsx Added mt-4 class for margin-top, replaced notification message container with CareIcon and styled message text in a span with font-mono, introduced bg-gray-200 for background, and adjusted styling for caused_by and date display.

Assessment against linked issues

Objective Addressed Explanation
Update Notice Card UI in the notice_board Page (#9339)

Possibly related PRs

Suggested labels

needs review, tested

Suggested reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐇 In the notice board, a change so bright,
With icons and styles, it’s a lovely sight!
Messages wrapped in a cozy embrace,
With margins and padding, they’ve found their place.
Hopping with joy, we celebrate this cheer,
For a better UI, let’s give a big cheer! 🎉


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. (Experiment)
  • @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 Dec 9, 2024

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit 3eec6d3
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/675c5b43161e5700088dcacd
😎 Deploy Preview https://deploy-preview-9343--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: 1

🧹 Outside diff range and nitpick comments (1)
src/components/Notifications/NoticeBoard.tsx (1)

26-26: Consider adjusting card margin for consistency

While the card styling looks good, the my-1 margin seems inconsistent with the gap-6 used in the grid. Consider removing the margin since the grid gap already provides sufficient spacing.

-className="overflow-hidden rounded shadow-md my-1"
+className="overflow-hidden rounded shadow-md"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0f58adc and 3d8ec40.

📒 Files selected for processing (1)
  • src/components/Notifications/NoticeBoard.tsx (1 hunks)
🔇 Additional comments (2)
src/components/Notifications/NoticeBoard.tsx (2)

22-22: LGTM! Responsive grid layout with proper spacing

The grid container implementation with responsive columns and consistent gaps provides a clean layout across different screen sizes.


36-44: Consider using a more appropriate icon for user attribution

The Facebook Messenger icon (l-facebook-messenger) seems out of place for representing the user who caused the notification. Consider using a more appropriate icon like l-user or l-user-circle.

 <div className="text-md my-1 text-secondary-700 mx-2 px-3">
-  <CareIcon icon="l-facebook-messenger" className="mr-2" />
+  <CareIcon icon="l-user" className="mr-2" />
   {formatName(item.caused_by)} -{" "}

Let's verify that all text strings are properly internationalized:

src/components/Notifications/NoticeBoard.tsx Outdated Show resolved Hide resolved
@Jacobjeevan
Copy link
Contributor

Closing as duplicate of #9342

Please update the original PR instead 👍

@AnveshNalimela
Copy link
Contributor Author

@Jacobjeevan i closed the original PR becuase many unwanted changes got commited into that . Try to open these and get reviewd

@rithviknishad
Copy link
Member

rithviknishad commented Dec 10, 2024

But both PRs are using the same branch @AnveshNalimela. So it's equivalent to re-opening your old PR right?

@AnveshNalimela
Copy link
Contributor Author

@rithviknishad i just seen the in that PR 5 files got changed which are irrelavent and lot of commits
{9CD137DF-9C35-4023-B972-0FED2ADA0007}

so i closed that and reverted all changes and made the new PR

@github-actions github-actions bot added needs-triage question Further information is requested labels Dec 10, 2024
@rithviknishad
Copy link
Member

@Jacobjeevan reopening this as github doesn't allow reopening old PR's if there are force pushes on to the same branch.

@rithviknishad rithviknishad reopened this Dec 10, 2024
@rithviknishad rithviknishad removed question Further information is requested needs-triage labels Dec 10, 2024
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.

Since we are now capturing user's avatar too, let's show that too.

@rithviknishad rithviknishad removed their request for review December 11, 2024 16:05
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.

by avatar in my previous change request, I meant this: https://github.com/ohcnetwork/care_fe/blob/develop/src/components/Common/Avatar.tsx

Not an icon.

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 (2)
src/components/Notifications/NoticeBoard.tsx (2)

12-12: Consider using alias import path for consistency

The Avatar import uses a relative path while other component imports use the @/components alias. Consider updating for consistency:

-import { Avatar } from "../Common/Avatar";
+import { Avatar } from "@/components/Common/Avatar";

Line range hint 76-76: Add missing translations for internationalization compliance

The PR objectives mention I18n compliance. The text "No Notice Available" should use the translation function:

-            No Notice Available
+            {t("no_notice_available")}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fe11134 and 3eec6d3.

📒 Files selected for processing (1)
  • src/components/Notifications/NoticeBoard.tsx (2 hunks)
🔇 Additional comments (2)
src/components/Notifications/NoticeBoard.tsx (2)

24-28: LGTM! Improved card layout and responsiveness

The grid layout with responsive columns and visual enhancements (shadow, rounded corners) improves the overall design.


30-39: Reconsider the messenger icon choice

The l-facebook-messenger icon might not be the most appropriate choice for system notifications. Consider using a more generic notification or system message icon like l-bell or l-envelope.

Previous accessibility and readability concerns remain unaddressed

As mentioned in the previous review:

  1. Add an aria-label for accessibility
  2. Reconsider using font-mono for better readability of longer messages

Comment on lines +41 to +55
<div className="bg-gray-200 py-2 flex items-center ">
<Avatar
name={item.caused_by.user_type || ""}
className="border-0 border-b border-b-secondary-300 rounded-full h-10 w-10 ml-5"
/>
<div className="text-md my-1 text-secondary-700 px-3">
<div className="flex items-center">
{formatName(item.caused_by)} -{" "}
<span className="font-bold text-primary-700 ml-1">
{item.caused_by.user_type}
</span>
</div>
<div className="text-xs text-secondary-900 font-medium ">
{t("on")}: {formatDateTime(item.created_date)}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance accessibility and reduce redundancy

The user info section has two areas of improvement:

  1. The Avatar component should have an alt text or aria-label for accessibility
  2. The user type is displayed twice (in Avatar and text), which is redundant
 <Avatar
   name={item.caused_by.user_type || ""}
+  aria-label={`${formatName(item.caused_by)}'s avatar`}
   className="border-0 border-b border-b-secondary-300 rounded-full h-10 w-10 ml-5"
 />
 <div className="text-md my-1 text-secondary-700  px-3">
   <div className="flex items-center">
-    {formatName(item.caused_by)} -{" "}
-    <span className="font-bold text-primary-700 ml-1">
-      {item.caused_by.user_type}
-    </span>
+    {formatName(item.caused_by)}
   </div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="bg-gray-200 py-2 flex items-center ">
<Avatar
name={item.caused_by.user_type || ""}
className="border-0 border-b border-b-secondary-300 rounded-full h-10 w-10 ml-5"
/>
<div className="text-md my-1 text-secondary-700 px-3">
<div className="flex items-center">
{formatName(item.caused_by)} -{" "}
<span className="font-bold text-primary-700 ml-1">
{item.caused_by.user_type}
</span>
</div>
<div className="text-xs text-secondary-900 font-medium ">
{t("on")}: {formatDateTime(item.created_date)}
</div>
<div className="bg-gray-200 py-2 flex items-center ">
<Avatar
name={item.caused_by.user_type || ""}
aria-label={`${formatName(item.caused_by)}'s avatar`}
className="border-0 border-b border-b-secondary-300 rounded-full h-10 w-10 ml-5"
/>
<div className="text-md my-1 text-secondary-700 px-3">
<div className="flex items-center">
{formatName(item.caused_by)}
</div>
<div className="text-xs text-secondary-900 font-medium ">
{t("on")}: {formatDateTime(item.created_date)}
</div>

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 Notice Card UI in the notice_board Page
3 participants