Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import { getDistinctColorBasedOnHash, getForegroundColor, hexaToRGBA } from './u

export interface PhotoPlaceholderProps extends StyleProps {
name: string;
email: string;
indicator: string;
width?: ViewProps<5>['width'];
height?: ViewProps<5>['height'];
borderRadius?: string;
}

export const PhotoPlaceholder: FC<PhotoPlaceholderProps> = ({
name,
email,
indicator,
width = 'size-1600',
height = 'size-1600',
borderRadius = '50%',
...viewProps
}) => {
const backgroundColor = getDistinctColorBasedOnHash(email);
const letter = (isEmpty(name.trim()) ? email : name).charAt(0);
const backgroundColor = getDistinctColorBasedOnHash(indicator);
const letter = (isEmpty(name.trim()) ? indicator : name).charAt(0);

const color = getForegroundColor(
hexaToRGBA(backgroundColor),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const OrganizationOverview = () => {
<View paddingX={'size-300'} UNSAFE_className={classes.organizationOverviewPicture}>
<PhotoPlaceholder
name={organization.name}
email={organization.name}
indicator={organization.name}
width={'size-1600'}
height={'size-1600'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface OrganizationNameCellProps {
export const OrganizationNameCell = ({ id, name }: OrganizationNameCellProps) => {
return (
<Flex width={'100%'} alignItems={'center'} gap={'size-100'}>
<PhotoPlaceholder name={name} email={name} width={'size-300'} height={'size-300'} />
<PhotoPlaceholder name={name} indicator={name} width={'size-300'} height={'size-300'} />
<TooltipTrigger placement={'bottom left'}>
<PressableElement>
<TruncatedText>{name}</TruncatedText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ChangeRoleDialogInner: FC<ChangeRoleDialogInnerProps> = ({ membership, onC
<Flex alignItems={'center'} gap={'size-100'} marginBottom={'size-250'} marginTop={'size-150'}>
<PhotoPlaceholder
name={membership.organizationName}
email={membership.organizationName}
indicator={membership.organizationName}
width={'size-300'}
height={'size-300'}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export const SidebarHeader: FC<SidebarHeaderProps> = ({ name, email }) => {
<Flex flex={1} gap={'size-200'} alignItems={'center'} height={'100%'}>
{name ? (
<>
<PhotoPlaceholder name={name} email={email ?? name} width={'size-500'} height={'size-500'} />
<PhotoPlaceholder
name={name}
indicator={email ?? name}
width={'size-500'}
height={'size-500'}
/>
<TruncatedTextWithTooltip UNSAFE_className={classes.sidebarHeaderText}>
{name}
</TruncatedTextWithTooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const OrganizationsPicker = ({ isLargeSize }: OrganizationsPickerProps) =
>
<PhotoPlaceholder
name={orgName}
email={orgName}
indicator={orgName}
width={'size-400'}
height={'size-400'}
borderRadius={'20%'}
Expand Down Expand Up @@ -113,7 +113,7 @@ export const OrganizationsPicker = ({ isLargeSize }: OrganizationsPickerProps) =
>
<PhotoPlaceholder
name={orgName}
email={orgName}
indicator={orgName}
width={'size-400'}
height={'size-400'}
borderRadius={'20%'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const UserPhotoPlaceholder = ({
: ''
}
>
<PhotoPlaceholder name={userName} email={email} width={width} height={height} />
<PhotoPlaceholder name={userName} indicator={email} width={width} height={height} />
</div>
{handleUploadClick && !disableUpload && (
<ActionButton isQuiet marginTop={'size-200'} onPress={handleUploadClick} colorVariant={'blue'}>
Expand Down
Loading