-
-
Notifications
You must be signed in to change notification settings - Fork 488
💄 Update avatar component #1812
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis change removes support for the "xs" (extra small) avatar size throughout the codebase. All usages of the "xs" size in Changes
Sequence Diagram(s)sequenceDiagram
participant UI_Component as UI Component
participant OptimizedAvatarImage
participant Avatar
UI_Component->>OptimizedAvatarImage: Render with size="sm"
OptimizedAvatarImage->>Avatar: Pass size="sm"
Avatar-->>OptimizedAvatarImage: Rendered avatar (class-based size)
OptimizedAvatarImage-->>UI_Component: Avatar image rendered
Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (1)
apps/web/src/components/optimized-avatar-image.tsx (1)
41-44: Consider adding text size mapping for xl sizeThe fallback text size mappings are updated correctly for sm, md, and lg sizes, but the xl size doesn't have a corresponding text size class. Consider adding a text size mapping for xl to ensure consistent fallback text sizing across all avatar sizes.
className={cn("shrink-0", { "text-[10px]": size === "sm", "text-[12px]": size === "md", "text-md": size === "lg", + "text-lg": size === "xl", })}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
apps/web/src/app/[locale]/(space)/layout.tsx(1 hunks)apps/web/src/components/discussion/discussion.tsx(1 hunks)apps/web/src/components/optimized-avatar-image.tsx(2 hunks)apps/web/src/components/participant-avatar-bar.tsx(1 hunks)apps/web/src/components/participant.tsx(0 hunks)apps/web/src/components/poll/desktop-poll/participant-row-form.tsx(1 hunks)apps/web/src/components/poll/desktop-poll/participant-row.tsx(1 hunks)apps/web/src/components/poll/mobile-poll.tsx(1 hunks)apps/web/src/components/poll/mobile-poll/poll-option.tsx(3 hunks)apps/web/src/components/user-dropdown.tsx(1 hunks)packages/ui/src/avatar.tsx(2 hunks)
💤 Files with no reviewable changes (1)
- apps/web/src/components/participant.tsx
🧰 Additional context used
📓 Path-based instructions (5)
`**/*.{js,jsx,ts,tsx}`: Prefer implicit return values over explicit return value...
**/*.{js,jsx,ts,tsx}: Prefer implicit return values over explicit return values
Prefer double quotes for strings over single quotes
Only add comments when it is necessary to explain code that isn't self-explanatory
📄 Source: CodeRabbit Inference Engine (.windsurfrules)
List of files the instruction was applied to:
apps/web/src/components/poll/desktop-poll/participant-row.tsxapps/web/src/components/poll/desktop-poll/participant-row-form.tsxapps/web/src/components/user-dropdown.tsxapps/web/src/components/participant-avatar-bar.tsxapps/web/src/components/poll/mobile-poll.tsxapps/web/src/components/discussion/discussion.tsxapps/web/src/components/poll/mobile-poll/poll-option.tsxapps/web/src/app/[locale]/(space)/layout.tsxapps/web/src/components/optimized-avatar-image.tsxpackages/ui/src/avatar.tsx
`**/*.{ts,tsx}`: Create separate import statements for types
**/*.{ts,tsx}: Create separate import statements for types
📄 Source: CodeRabbit Inference Engine (.windsurfrules)
List of files the instruction was applied to:
apps/web/src/components/poll/desktop-poll/participant-row.tsxapps/web/src/components/poll/desktop-poll/participant-row-form.tsxapps/web/src/components/user-dropdown.tsxapps/web/src/components/participant-avatar-bar.tsxapps/web/src/components/poll/mobile-poll.tsxapps/web/src/components/discussion/discussion.tsxapps/web/src/components/poll/mobile-poll/poll-option.tsxapps/web/src/app/[locale]/(space)/layout.tsxapps/web/src/components/optimized-avatar-image.tsxpackages/ui/src/avatar.tsx
`**/*.tsx`: All text in the UI should be translated using either the Trans compo...
**/*.tsx: All text in the UI should be translated using either the Trans component or the useTranslation hook
Prefer composable components in the style of shadcn UI over large monolithic components
DropdownMenuItem is a flex container with a preset gap so there is no need to add margins to the children
The size and colour of an icon should be set by wrapping it with the component from @rallly/ui/icon which will give it the correct colour and size.
Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
All text in the UI should be translatable.
Use the component in client components from @/components/trans. Use thedefaultsprop to provide the default text.
Always use a composable patterns when building components
Usecn()from @rallly/ui to compose classes
Prefer using the React module APIs (e.g. React.useState) instead of standalone hooks (e.g. useState)
Add the "use client" directive to the top of any .tsx file that requires client-side javascript
📄 Source: CodeRabbit Inference Engine (.windsurfrules)
List of files the instruction was applied to:
apps/web/src/components/poll/desktop-poll/participant-row.tsxapps/web/src/components/poll/desktop-poll/participant-row-form.tsxapps/web/src/components/user-dropdown.tsxapps/web/src/components/participant-avatar-bar.tsxapps/web/src/components/poll/mobile-poll.tsxapps/web/src/components/discussion/discussion.tsxapps/web/src/components/poll/mobile-poll/poll-option.tsxapps/web/src/app/[locale]/(space)/layout.tsxapps/web/src/components/optimized-avatar-image.tsxpackages/ui/src/avatar.tsx
`**/*`: Always use kebab-case for file names
**/*: Always use kebab-case for file names
📄 Source: CodeRabbit Inference Engine (.windsurfrules)
List of files the instruction was applied to:
apps/web/src/components/poll/desktop-poll/participant-row.tsxapps/web/src/components/poll/desktop-poll/participant-row-form.tsxapps/web/src/components/user-dropdown.tsxapps/web/src/components/participant-avatar-bar.tsxapps/web/src/components/poll/mobile-poll.tsxapps/web/src/components/discussion/discussion.tsxapps/web/src/components/poll/mobile-poll/poll-option.tsxapps/web/src/app/[locale]/(space)/layout.tsxapps/web/src/components/optimized-avatar-image.tsxpackages/ui/src/avatar.tsx
`packages/ui/**/*.{ts,tsx}`: shadcn-ui components should be added to packages/ui
packages/ui/**/*.{ts,tsx}: shadcn-ui components should be added to packages/ui
📄 Source: CodeRabbit Inference Engine (.windsurfrules)
List of files the instruction was applied to:
packages/ui/src/avatar.tsx
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
apps/web/src/components/poll/desktop-poll/participant-row.tsx (2)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
apps/web/src/components/poll/desktop-poll/participant-row-form.tsx (1)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
apps/web/src/components/user-dropdown.tsx (4)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : DropdownMenuItem is a flex container with a preset gap so there is no need to add margins to the children
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Prefer composable components in the style of shadcn UI over large monolithic components
apps/web/src/components/participant-avatar-bar.tsx (3)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Prefer composable components in the style of shadcn UI over large monolithic components
apps/web/src/components/poll/mobile-poll.tsx (1)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
apps/web/src/components/discussion/discussion.tsx (3)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Prefer composable components in the style of shadcn UI over large monolithic components
apps/web/src/components/poll/mobile-poll/poll-option.tsx (1)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
apps/web/src/app/[locale]/(space)/layout.tsx (2)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : All text in the UI should be translatable.
apps/web/src/components/optimized-avatar-image.tsx (6)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Prefer composable components in the style of shadcn UI over large monolithic components
Learnt from: lukevella
PR: lukevella/rallly#1557
File: packages/emails/src/templates/abandoned-checkout.tsx:0-0
Timestamp: 2025-02-12T04:21:35.353Z
Learning: In React components that display discount values in email templates, make the discount configurable through props with a default value to improve maintainability and reduce duplication.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Use the <Trans> component in client components from @/components/trans. Use the `defaults` prop to provide the default text.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Use `cn()` from @rallly/ui to compose classes
packages/ui/src/avatar.tsx (5)
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : The size and colour of an icon should be set by wrapping it with the <Icon> component from @rallly/ui/icon which will give it the correct colour and size.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Prefer composable components in the style of shadcn UI over large monolithic components
Learnt from: lukevella
PR: lukevella/rallly#1557
File: packages/emails/src/templates/abandoned-checkout.tsx:0-0
Timestamp: 2025-02-12T04:21:35.353Z
Learning: In React components that display discount values in email templates, make the discount configurable through props with a default value to improve maintainability and reduce duplication.
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Use `cn()` from @rallly/ui to compose classes
Learnt from: CR
PR: lukevella/rallly#0
File: .windsurfrules:0-0
Timestamp: 2025-07-07T14:57:43.542Z
Learning: Applies to **/*.tsx : Keep the props of a component as minimal as possible. Pass only the bare minimum amount of information needed to it.
🧬 Code Graph Analysis (4)
apps/web/src/components/poll/desktop-poll/participant-row.tsx (1)
apps/web/src/components/optimized-avatar-image.tsx (1)
OptimizedAvatarImage(7-51)
apps/web/src/components/poll/desktop-poll/participant-row-form.tsx (1)
apps/web/src/components/optimized-avatar-image.tsx (1)
OptimizedAvatarImage(7-51)
apps/web/src/components/poll/mobile-poll.tsx (1)
apps/web/src/components/optimized-avatar-image.tsx (1)
OptimizedAvatarImage(7-51)
apps/web/src/components/poll/mobile-poll/poll-option.tsx (1)
apps/web/src/components/optimized-avatar-image.tsx (1)
OptimizedAvatarImage(7-51)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Integration tests
🔇 Additional comments (12)
packages/ui/src/avatar.tsx (3)
5-20: Well-implemented variant-based sizing system.The refactoring from inline styles to class-variance-authority variants is a good architectural improvement. The size variants are clearly defined with appropriate CSS classes and text sizes.
35-37: Correct forwardRef type update.The type change from
React.ElementReftoReact.ComponentRefis the correct modern approach for typing forwardRef components.
23-26: Action Required: Confirm all Avatarsizeprops use variant stringsI wasn’t able to definitively locate any numeric
sizeusages via automated searches—please manually verify that no<Avatar size={number}>remains and that all calls use one of the variant strings ("sm" | "md" | "lg" | "xl"). You can run a global grep or rely on TypeScript errors in consuming components to catch any lingering numeric values.apps/web/src/components/user-dropdown.tsx (1)
51-51: Consistent size prop update.The change from "xs" to "sm" aligns with the removal of the "xs" size option from the avatar system.
apps/web/src/components/participant-avatar-bar.tsx (1)
47-47: Consistent size prop update improves avatar visibility.The change from "xs" to "sm" will make participant avatars slightly larger, which could improve visibility in the avatar bar.
apps/web/src/components/poll/desktop-poll/participant-row.tsx (1)
55-55: Consistent size prop update for participant avatars.The change from "xs" to "sm" maintains consistency with the avatar system refactoring while making participant avatars slightly larger in the desktop poll view.
apps/web/src/components/poll/desktop-poll/participant-row-form.tsx (1)
65-65: Consistent size prop update for form avatars.The change from "xs" to "sm" maintains consistency with the avatar system refactoring in the participant row form.
apps/web/src/app/[locale]/(space)/layout.tsx (1)
43-43: LGTM: Consistent size updateThe avatar size change from "xs" to "sm" aligns perfectly with the removal of "xs" size support from the
OptimizedAvatarImagecomponent.apps/web/src/components/poll/mobile-poll/poll-option.tsx (1)
55-55: LGTM: Consistent avatar size updatesAll three avatar size changes from "xs" to "sm" are consistent and align with the removal of "xs" size support from the
OptimizedAvatarImagecomponent.Also applies to: 69-69, 85-85
apps/web/src/components/discussion/discussion.tsx (1)
207-207: LGTM: Avatar size update aligns with component APIThe avatar size change from "xs" to "sm" for the comment author avatar is consistent with the removal of "xs" size support.
apps/web/src/components/poll/mobile-poll.tsx (1)
107-107: LGTM: Participant avatar size updateThe avatar size change from "xs" to "sm" for participant avatars in the select dropdown is consistent with the component API update.
apps/web/src/components/optimized-avatar-image.tsx (1)
13-13: LGTM: Clean refactoring to delegate sizing to Avatar componentThe removal of "xs" size support and delegation of sizing to the
Avatarcomponent simplifies the component logic appropriately.Also applies to: 20-20
Summary by CodeRabbit
Refactor
Removals