-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Group chat stacked avatars are different in Search list and LHN #36403
Changes from 2 commits
4a1a2ab
4fd550f
a2663b8
34309fe
1fdc1a9
b2f6e7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,45 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import MultipleAvatars from '@components/MultipleAvatars'; | ||
import SubscriptAvatar from '@components/SubscriptAvatar'; | ||
import TextWithTooltip from '@components/TextWithTooltip'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import type {UserListItemProps} from './types'; | ||
|
||
function UserListItem({item, textStyles, alternateTextStyles, showTooltip, style}: UserListItemProps) { | ||
function UserListItem({item, textStyles, alternateTextStyles, showTooltip, style, isFocused, isHovered, shouldUseOnySubscriptAvatar = true}: UserListItemProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
const StyleUtils = useStyleUtils(); | ||
|
||
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor; | ||
const subscriptAvatarBorderColor = isFocused ? focusedBackgroundColor : theme.sidebar; | ||
const hoveredBackgroundColor = !!styles.sidebarLinkHover && 'backgroundColor' in styles.sidebarLinkHover ? styles.sidebarLinkHover.backgroundColor : theme.sidebar; | ||
|
||
return ( | ||
<> | ||
{!!item.icons && ( | ||
<SubscriptAvatar | ||
mainAvatar={item.icons[0]} | ||
secondaryAvatar={item.icons[1]} | ||
showTooltip={showTooltip} | ||
/> | ||
<> | ||
{item.shouldShowSubscript ?? shouldUseOnySubscriptAvatar ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain more about this condition and give the example for the case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that. Let's see how it goes, and I'll help test it thoroughly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I found only one place where we use UserListItem except Search |
||
<SubscriptAvatar | ||
mainAvatar={item.icons[0]} | ||
secondaryAvatar={item.icons[1]} | ||
showTooltip={showTooltip} | ||
backgroundColor={isHovered && !isFocused ? hoveredBackgroundColor : subscriptAvatarBorderColor} | ||
/> | ||
) : ( | ||
<MultipleAvatars | ||
icons={item.icons ?? []} | ||
shouldShowTooltip={showTooltip} | ||
secondAvatarStyle={[ | ||
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar), | ||
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined, | ||
isHovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined, | ||
]} | ||
/> | ||
)} | ||
</> | ||
)} | ||
<View style={[styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch, styles.optionRow]}> | ||
<TextWithTooltip | ||
|
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.
Typo
Could you give the case for this specific prop? I see that we pass
false
on the search page.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.
Just so as not to change the display logic on other places where we use UserListItem
I added this parameter so that we display SubscriptAvatar or MultipleAvatars only on the Search screen