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

Added Skeleton Loader for Care public page | Adjusted the roundness of Avatar #10124

Merged
merged 5 commits into from
Jan 24, 2025

Conversation

Rishith25
Copy link
Contributor

@Rishith25 Rishith25 commented Jan 23, 2025

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

Release Notes

  • UI Improvements

    • Enhanced avatar styling with rounded corners across multiple components
    • Updated loading states with more detailed skeleton loading effects
    • Improved responsive design for appointments and facilities pages
  • Performance

    • Refined loading state representations for better user experience
  • Style Updates

    • Added rounded corners to avatars in patient, facility, and user-related components
    • Adjusted responsive breakpoints for layout flexibility

@Rishith25 Rishith25 requested a review from a team as a code owner January 23, 2025 17:49
Copy link
Contributor

coderabbitai bot commented Jan 23, 2025

Walkthrough

This pull request focuses on enhancing the visual styling and loading experience across multiple components. The changes primarily involve adding rounded corners to Avatar components, updating responsive design classes, and replacing generic loading indicators with more detailed skeleton loaders. These modifications improve the user interface's consistency and provide more informative loading states in various pages like Facilities, Appointments, and Patient sections.

Changes

File Change Summary
src/components/Common/Avatar.tsx Updated className for AvatarPrimitive.Root and AvatarPrimitive.Image with improved styling flexibility
src/components/Patient/PatientInfoCard.tsx Added rounded class to Avatar container div
src/components/ui/sidebar/patient-switcher.tsx Increased Avatar size from h-4 w-4 to h-5 w-5
src/pages/Appointments/AppointmentsPage.tsx Updated responsive design classes from md: to lg: and xl:
src/pages/Facility/FacilitiesPage.tsx Replaced Loading with CardGridSkeleton for loading state
src/pages/Facility/components/UserCard.tsx Added rounded-lg class to Avatar
src/pages/Patient/index.tsx Replaced Loading with CardListSkeleton for more detailed loading representation

Assessment against linked issues

Objective Addressed Explanation
Add skeleton loaders for care public pages [#10103]
Make Avatars rounded at required places [#10103]
Fix search bar clipping in medium screens [#10103] Responsive class changes might help, but needs verification

Possibly related PRs

Suggested Labels

tested, reviewed

Suggested Reviewers

  • rithviknishad
  • Jacobjeevan

Poem

🐰 Hop, skip, and style with grace,
Avatars round, loading's new face!
Skeletons dance, components align,
CodeRabbit's magic makes design shine! 🎨✨


📜 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 faf69b4 and d4fceb7.

📒 Files selected for processing (2)
  • src/components/Common/Avatar.tsx (2 hunks)
  • src/components/ui/sidebar/patient-switcher.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/Common/Avatar.tsx
  • src/components/ui/sidebar/patient-switcher.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 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 d4fceb7
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/6793027b5650b50008cac9fb
😎 Deploy Preview https://deploy-preview-10124--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

🔭 Outside diff range comments (1)
src/pages/Appointments/AppointmentsPage.tsx (1)

Line range hint 356-673: Enhance accessibility for interactive elements

Add appropriate ARIA labels to improve accessibility:

  • Date range picker button
  • Status dropdown
  • Search input

Example improvements:

 <Input
   className="w-[300px]"
   placeholder={t("search")}
+  aria-label={t("search_appointments")}
   value={qParams.search ?? ""}
   onChange={(e) => setQParams({ ...qParams, search: e.target.value })}
 />
🧹 Nitpick comments (6)
src/components/Common/Avatar.tsx (2)

69-69: Review className prop handling.

The use of cn utility for className merging is good, but the same className prop is being applied twice - once to the root element and once to the image. This could lead to unexpected styling if the parent passes classes that should only apply to one of these elements.

Consider using separate className props or applying specific classes to each element:

-className={cn("aspect-square h-full w-full object-cover", className)}
+className="aspect-square h-full w-full object-cover"

Line range hint 34-39: Document className prop usage.

Since the component now supports className customization, it would be helpful to document its usage in the interface.

Add JSDoc comment to describe className behavior:

 interface AvatarProps {
   colors?: [string, string];
   name: string;
   imageUrl?: string;
+  /** Additional classes to apply to the avatar root element */
   className?: string;
 }
src/pages/Facility/FacilitiesPage.tsx (1)

109-111: LGTM! Well-structured skeleton loader implementation.

The skeleton loader implementation:

  • Matches the grid layout of actual facility cards
  • Uses appropriate gap spacing
  • Provides visual feedback during loading state

Consider extracting the grid layout className to a constant since it's duplicated between the skeleton and actual content sections:

const GRID_LAYOUT_CLASS = "grid grid-cols-1 md:grid-cols-2 gap-4";
src/pages/Patient/index.tsx (1)

67-78: LGTM! Well-structured loading state implementation.

The loading state implementation:

  • Uses appropriate skeleton components for different UI elements
  • Maintains visual hierarchy with header and content sections
  • Provides meaningful loading feedback

Consider extracting the skeleton layout to a separate component for better reusability:

const AppointmentsSkeleton = () => (
  <div>
    <div className="flex justify-between w-full mb-8">
      <Skeleton className="h-8 w-48" />
      <Skeleton className="h-8 w-48" />
    </div>
    <Skeleton className="h-8 w-48" />
    <div className="grid gap-4 mt-4">
      <CardListSkeleton count={6} />
    </div>
  </div>
);
src/pages/Appointments/AppointmentsPage.tsx (2)

Line range hint 10-10: Replace placeholder token number implementation

The TODO comment indicates a temporary implementation for token numbers. I can help implement a proper token number system.

Would you like me to help implement a proper token number system or create an issue to track this task?


356-357: Extract magic numbers into constants

The layout calculations use hardcoded values that should be extracted into named constants for better maintainability:

  • h-[calc(100vh-18rem)]
  • h-[calc(100vh-22rem)]

Consider creating a constants file for these values:

// constants.ts
export const LAYOUT = {
  BOARD_VIEW_HEIGHT: '18rem',
  LIST_VIEW_HEIGHT: '22rem',
} as const;

Also applies to: 671-673

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9bae571 and faf69b4.

📒 Files selected for processing (16)
  • src/components/Common/Avatar.tsx (1 hunks)
  • src/components/Patient/PatientDetailsTab/PatientUsers.tsx (2 hunks)
  • src/components/Patient/PatientInfoCard.tsx (1 hunks)
  • src/components/Patient/symptoms/SymptomTable.tsx (1 hunks)
  • src/components/Users/UserAvatar.tsx (1 hunks)
  • src/components/Users/UserBanner.tsx (1 hunks)
  • src/components/Users/UserListAndCard.tsx (2 hunks)
  • src/components/ui/sidebar/patient-switcher.tsx (2 hunks)
  • src/pages/Appointments/AppointmentsPage.tsx (1 hunks)
  • src/pages/Facility/FacilitiesPage.tsx (2 hunks)
  • src/pages/Facility/components/UserCard.tsx (1 hunks)
  • src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx (1 hunks)
  • src/pages/Organization/OrganizationPatients.tsx (1 hunks)
  • src/pages/Organization/OrganizationUsers.tsx (1 hunks)
  • src/pages/Patient/index.tsx (2 hunks)
  • src/pages/UserDashboard.tsx (3 hunks)
✅ Files skipped from review due to trivial changes (12)
  • src/components/Users/UserBanner.tsx
  • src/pages/Facility/components/UserCard.tsx
  • src/components/Users/UserAvatar.tsx
  • src/components/Patient/symptoms/SymptomTable.tsx
  • src/pages/Organization/OrganizationPatients.tsx
  • src/pages/FacilityOrganization/FacilityOrganizationUsers.tsx
  • src/pages/Organization/OrganizationUsers.tsx
  • src/components/Patient/PatientInfoCard.tsx
  • src/components/Users/UserListAndCard.tsx
  • src/components/ui/sidebar/patient-switcher.tsx
  • src/pages/UserDashboard.tsx
  • src/components/Patient/PatientDetailsTab/PatientUsers.tsx
🔇 Additional comments (3)
src/pages/Facility/FacilitiesPage.tsx (1)

11-11: LGTM! Import of skeleton loader component.

The addition of CardGridSkeleton aligns with the PR objective of implementing skeleton loaders for better loading states.

src/pages/Patient/index.tsx (1)

10-10: LGTM! Appropriate skeleton component imports.

The imports of both base Skeleton and CardListSkeleton components allow for flexible loading state representations.

Also applies to: 13-13

src/pages/Appointments/AppointmentsPage.tsx (1)

356-357: Review responsive layout adjustments

The changes improve the layout on medium-sized screens by:

  1. Using lg:flex-row instead of md:flex-row to maintain vertical stacking longer
  2. Replacing md:items-start with xl:flex-row to better handle the practitioner selection and date range components

However, consider testing these breakpoints to ensure optimal spacing and alignment across all screen sizes:

  • lg breakpoint (1024px) for the main container
  • xl breakpoint (1280px) for the nested container
✅ Verification successful

Responsive breakpoint changes are consistent with codebase patterns

The changes to use lg:flex-row and xl:flex-row align with the established responsive design patterns in the codebase, where:

  • Major layout transitions commonly occur at the lg breakpoint (1024px)
  • Complex nested containers often use xl breakpoint (1280px) for better spacing

These changes will provide a better experience on medium-sized screens by maintaining vertical stacking longer.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other responsive breakpoints in the codebase to ensure consistency
rg -A 2 "(?:sm|md|lg|xl|2xl):" --type ts --type tsx

Length of output: 81


Script:

#!/bin/bash
# First, find all TypeScript/React files
echo "=== TypeScript/React files ==="
fd "\.(tsx|ts)$"

echo -e "\n=== Responsive breakpoints usage ==="
# Search for Tailwind responsive prefixes with proper context
rg -C 2 "(sm|md|lg|xl|2xl):[a-zA-Z0-9-]+" --type-add 'tsx:*.tsx' --type-add 'ts:*.ts' --type tsx --type ts

Length of output: 70342

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.

can't we apply rounded-md inside the avatar components classNames itself since this is desired behaviour on all usages mostly?

@Rishith25
Copy link
Contributor Author

can't we apply rounded-md inside the avatar components classNames itself since this is desired behaviour on all usages mostly?

Yes.

@rithviknishad rithviknishad merged commit 19141a3 into ohcnetwork:develop Jan 24, 2025
19 checks passed
Copy link

@Rishith25 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
Copy link
Contributor Author

@rithviknishad Can you assign story points to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants