Skip to content

The open alternative to Salesforce, designed for AI.

Migrate Avatar to the new twenty-ui API (#25787)

Raphaël Bosi387f375b2edf
diff --git a/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx b/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx
index 07370138f74..a1109693a34 100644
--- a/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx
+++ b/packages/create-twenty-app/src/constants/template/src/front-components/main-page.tsx
@@ -93,13 +93,13 @@ const CategoryCard = ({
const CategoryIcon = () => {
if (title === 'Data model') {
- return <IconHierarchy color={color} size={'20px'} />;
+ return <IconHierarchy color={color} size="20px" />;
}
if (title === 'Logic') {
- return <IconSettingsAutomation color={color} size={'20px'} />;
+ return <IconSettingsAutomation color={color} size="20px" />;
}
if (title === 'Layout') {
- return <IconLayout color={color} size={'20px'} />;
+ return <IconLayout color={color} size="20px" />;
}
};
@@ -168,7 +168,7 @@ const CategoryCard = ({
transition: 'background 0.15s',
}}
>
- <IconBox color={color} size={'20px'} />
+ <IconBox color={color} size="20px" />
<span
style={{
fontSize: '13px',
@@ -204,11 +204,7 @@ const MainPage = () => {
padding: '40px',
}}
>
- <Avatar
- placeholder={APP_DISPLAY_NAME}
- placeholderColorSeed={APP_DISPLAY_NAME}
- size="xl"
- />
+ <Avatar name={APP_DISPLAY_NAME} colorSeed={APP_DISPLAY_NAME} size="xl" />
<span
style={{
fontSize: '24px',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
index a961b9ff4dc..2948c1b7430 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
@@ -16,6 +16,7 @@ import {
import {
statusControlsTest,
tagControlsTest,
+ avatarControlsTest,
} from '@/__stories__/twenty-ui-gallery/utils/displayControlTests';
import { createGalleryStory } from '@/__stories__/twenty-ui-gallery/utils/createGalleryStory';
import {
@@ -382,3 +383,15 @@ export const TagControlsPreact: Story = createGalleryStory({
runtime: 'preact',
play: tagControlsTest,
});
+
+export const AvatarControlsReact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-avatar-controls',
+ runtime: 'react',
+ play: avatarControlsTest,
+});
+
+export const AvatarControlsPreact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-avatar-controls',
+ runtime: 'preact',
+ play: avatarControlsTest,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx
new file mode 100644
index 00000000000..9b84b0dad4f
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-avatar-controls.front-component.tsx
@@ -0,0 +1,58 @@
+import { useState } from 'react';
+import { defineFrontComponent } from 'twenty-sdk/define';
+import { Avatar } from 'twenty-ui/data-display';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
+import 'twenty-ui/style.css';
+
+import { ComponentGallery } from '../shared/front-components/component-gallery';
+
+const AvatarControls = () => {
+ const [activations, setActivations] = useState(0);
+ const handleClick = () => setActivations((count) => count + 1);
+ return (
+ <ThemeProvider colorScheme="light">
+ <ComponentGallery
+ title="Avatar controls"
+ entries={[
+ {
+ name: 'AvatarImage',
+ node: (
+ <Avatar
+ src="data:image/png;base64,invalid"
+ name="Image fallback"
+ />
+ ),
+ },
+ {
+ name: 'Avatar',
+ node: (
+ <>
+ <Avatar
+ name="Jane"
+ onClick={handleClick}
+ shape="circle"
+ size="xl"
+ />
+ <Avatar name="Disabled avatar" onClick={handleClick} disabled />
+ <Avatar
+ name="Acme"
+ shape="rounded-square"
+ variant="outline"
+ size="lg"
+ />
+ </>
+ ),
+ },
+ ]}
+ />
+ <output aria-label="Activations">{activations}</output>
+ </ThemeProvider>
+ );
+};
+
+export default defineFrontComponent({
+ universalIdentifier: '3216e89b-f4f5-45cd-afcd-0e8a4db46d05',
+ name: 'twenty-ui-avatar-controls',
+ description: 'Avatar APIs and interactions in the sandbox',
+ component: AvatarControls,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
index c1e245ebf88..804988568a8 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
@@ -31,22 +31,22 @@ const DATA_DISPLAY_ENTRIES: GalleryEntry[] = [
},
{
name: 'Avatar',
- node: <Avatar placeholder="John Doe" size="md" type="rounded" />,
+ node: <Avatar name="John Doe" size="md" shape="circle" />,
},
{
name: 'AvatarGroup',
node: (
<AvatarGroup
avatars={[
- <Avatar key="a" placeholder="Alice" />,
- <Avatar key="b" placeholder="Bob" />,
+ <Avatar key="a" name="Alice" />,
+ <Avatar key="b" name="Bob" />,
]}
/>
),
},
{
name: 'AvatarOrIcon',
- node: <AvatarOrIcon placeholder="Jane" Icon={IconStar} />,
+ node: <AvatarOrIcon name="Jane" Icon={IconStar} />,
},
{
name: 'Checkmark',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/displayControlTests.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/displayControlTests.ts
index 1b27b2a47e3..9829cfb461b 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/displayControlTests.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/displayControlTests.ts
@@ -2,6 +2,7 @@ import { expect, userEvent, waitFor, within } from 'storybook/test';
import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
import { galleryRenderTest } from '@/__stories__/twenty-ui-gallery/utils/galleryRenderTests';
+import { createGalleryRenderTest } from '@/__stories__/twenty-ui-gallery/utils/createGalleryRenderTest';
type CreateDisplayControlTestOptions = {
buttonName: string;
@@ -54,3 +55,23 @@ export const tagControlsTest = createDisplayControlTest({
disabledButtonName: 'Disabled tag',
staticContent: 'Static tag',
});
+
+// Image loading requires window.Image, which the sandbox does not provide.
+const avatarGalleryTest: TwentyUiGalleryPlayFunction = async (context) => {
+ await createGalleryRenderTest({ expectedFailedComponents: ['AvatarImage'] })(
+ context,
+ );
+ await expect(
+ within(context.canvasElement).getByTestId('gallery-status'),
+ ).toHaveAttribute(
+ 'data-failed-messages',
+ 'AvatarImage: window.Image is not a constructor',
+ );
+};
+
+export const avatarControlsTest = createDisplayControlTest({
+ buttonName: 'Jane',
+ disabledButtonName: 'Disabled avatar',
+ staticContent: 'A',
+ checkGallery: avatarGalleryTest,
+});
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsAvatarGroup.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsAvatarGroup.tsx
index 88ad72a8a1e..50af66d8364 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsAvatarGroup.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventParticipantsAvatarGroup.tsx
@@ -64,16 +64,16 @@ export const CalendarEventParticipantsAvatarGroup = ({
key={[participant.workspaceMemberId, participant.displayName]
.filter(isDefined)
.join('-')}
- avatarUrl={getAbsoluteImageUrl(participant.avatarUrl)}
- placeholder={
+ src={getAbsoluteImageUrl(participant.avatarUrl)}
+ name={
participant.firstName && participant.lastName
? `${participant.firstName} ${participant.lastName}`
: participant.displayName
}
- placeholderColorSeed={
+ colorSeed={
participant.workspaceMemberId || participant.personId || ''
}
- type="rounded"
+ shape="circle"
/>
)),
]}
diff --git a/packages/twenty-front/src/modules/activities/components/ParticipantChip.tsx b/packages/twenty-front/src/modules/activities/components/ParticipantChip.tsx
index f95a3565ec3..658411f8ba0 100644
--- a/packages/twenty-front/src/modules/activities/components/ParticipantChip.tsx
+++ b/packages/twenty-front/src/modules/activities/components/ParticipantChip.tsx
@@ -71,12 +71,10 @@ export const ParticipantChip = ({
<StyledChip>
<StyledAvatarContainer>
<Avatar
- avatarUrl={getAbsoluteImageUrl(avatarUrl)}
- type="rounded"
- placeholder={displayName}
- placeholderColorSeed={getEmailParticipantAvatarColorSeed(
- participant,
- )}
+ src={getAbsoluteImageUrl(avatarUrl)}
+ shape="circle"
+ name={displayName}
+ colorSeed={getEmailParticipantAvatarColorSeed(participant)}
size="sm"
/>
</StyledAvatarContainer>
diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
index 8503d26e291..22eaffc651b 100644
--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadPreview.tsx
@@ -143,34 +143,34 @@ export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
<StyledHeading unread={!thread.read}>
<StyledParticipantsContainer>
<Avatar
- avatarUrl={getAbsoluteImageUrl(thread?.firstParticipant?.avatarUrl)}
- placeholder={thread.firstParticipant.displayName}
- placeholderColorSeed={getEmailParticipantAvatarColorSeed(
+ src={getAbsoluteImageUrl(thread?.firstParticipant?.avatarUrl)}
+ name={thread.firstParticipant.displayName}
+ colorSeed={getEmailParticipantAvatarColorSeed(
thread.firstParticipant,
)}
- type="rounded"
+ shape="circle"
/>
{isDefined(thread?.lastTwoParticipants?.[0]) && (
<StyledAvatarWrapper>
<Avatar
- avatarUrl={getAbsoluteImageUrl(
+ src={getAbsoluteImageUrl(
thread.lastTwoParticipants[0].avatarUrl,
)}
- placeholder={thread.lastTwoParticipants[0].displayName}
- placeholderColorSeed={getEmailParticipantAvatarColorSeed(
+ name={thread.lastTwoParticipants[0].displayName}
+ colorSeed={getEmailParticipantAvatarColorSeed(
thread.lastTwoParticipants[0],
)}
- type="rounded"
+ shape="circle"
/>
</StyledAvatarWrapper>
)}
{displayedName && (
<StyledAvatarWrapper>
<Avatar
- avatarUrl={getAbsoluteImageUrl(avatarUrl)}
- placeholder={displayedName}
- placeholderColorSeed={placeholderColorSeed}
- type="rounded"
+ src={getAbsoluteImageUrl(avatarUrl)}
+ name={displayedName}
+ colorSeed={placeholderColorSeed}
+ shape="circle"
color={isCountIcon ? theme.grayScale.gray11 : undefined}
backgroundColor={
isCountIcon ? theme.grayScale.gray2 : undefined
diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx
index 2b3c475d9fe..c9d60430343 100644
--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientChipMenuContent.tsx
@@ -95,13 +95,13 @@ export const EmailRecipientChipMenuContent = ({
{isDefined(workspaceMember) ? (
<MenuItemAvatar
avatar={{
- avatarUrl: getAbsoluteImageUrl(workspaceMember.avatarUrl),
- placeholder: isNonEmptyString(workspaceMemberFullName)
+ src: getAbsoluteImageUrl(workspaceMember.avatarUrl),
+ name: isNonEmptyString(workspaceMemberFullName)
? workspaceMemberFullName
: recipient.address,
- placeholderColorSeed: workspaceMember.id,
+ colorSeed: workspaceMember.id,
size: 'md',
- type: 'rounded',
+ shape: 'circle',
}}
text={
isNonEmptyString(workspaceMemberFullName)
@@ -113,13 +113,13 @@ export const EmailRecipientChipMenuContent = ({
) : isDefined(person) ? (
<MenuItemAvatar
avatar={{
- avatarUrl: getAbsoluteImageUrl(person.avatarUrl),
- placeholder: isNonEmptyString(personFullName)
+ src: getAbsoluteImageUrl(person.avatarUrl),
+ name: isNonEmptyString(personFullName)
? personFullName
: recipient.address,
- placeholderColorSeed: person.id,
+ colorSeed: person.id,
size: 'md',
- type: 'rounded',
+ shape: 'circle',
}}
text={
isNonEmptyString(personFullName)
diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx
index 01863de4fbd..56e2beeab03 100644
--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientSuggestionMenuItem.tsx
@@ -34,11 +34,11 @@ export const EmailRecipientSuggestionMenuItem = ({
focused={isSelectedItemId}
avatar={
<Avatar
- avatarUrl={getAbsoluteImageUrl(suggestion.avatarUrl)}
- placeholder={suggestion.label}
- placeholderColorSeed={suggestion.avatarColorSeed}
+ src={getAbsoluteImageUrl(suggestion.avatarUrl)}
+ name={suggestion.label}
+ colorSeed={suggestion.avatarColorSeed}
size="md"
- type="rounded"
+ shape="circle"
/>
}
/>
diff --git a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldChip.tsx b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldChip.tsx
index c85a1507b64..87f2e2e810e 100644
--- a/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldChip.tsx
+++ b/packages/twenty-front/src/modules/activities/emails/recipients/components/EmailRecipientsFieldChip.tsx
@@ -58,13 +58,13 @@ export const EmailRecipientsFieldChip = ({
const avatar =
isDefined(workspaceMember) || isDefined(person) ? (
<Avatar
- avatarUrl={getAbsoluteImageUrl(
+ src={getAbsoluteImageUrl(
workspaceMember?.avatarUrl ?? person?.avatarUrl,
)}
- placeholder={resolvedLabel}
- placeholderColorSeed={workspaceMember?.id ?? person?.id}
+ name={resolvedLabel}
+ colorSeed={workspaceMember?.id ?? person?.id}
size="sm"
- type="rounded"
+ shape="circle"
/>
) : undefined;
diff --git a/packages/twenty-front/src/modules/ai/hooks/useChatReferenceTarget.tsx b/packages/twenty-front/src/modules/ai/hooks/useChatReferenceTarget.tsx
index 7a54731fcc5..0739bc4bbdc 100644
--- a/packages/twenty-front/src/modules/ai/hooks/useChatReferenceTarget.tsx
+++ b/packages/twenty-front/src/modules/ai/hooks/useChatReferenceTarget.tsx
@@ -90,10 +90,10 @@ export const useChatReferenceTarget = (
path: isNonEmptyString(recordPath) ? recordPath : undefined,
leftComponent: (
<AvatarOrIcon
- placeholder={reference.displayName}
- placeholderColorSeed={reference.recordId}
- avatarType="rounded"
- avatarUrl=""
+ name={reference.displayName}
+ colorSeed={reference.recordId}
+ shape="circle"
+ src=""
/>
),
};
diff --git a/packages/twenty-front/src/modules/applications/components/AppChip.tsx b/packages/twenty-front/src/modules/applications/components/AppChip.tsx
index 7143cab7e65..8e28494ebcd 100644
--- a/packages/twenty-front/src/modules/applications/components/AppChip.tsx
+++ b/packages/twenty-front/src/modules/applications/components/AppChip.tsx
@@ -51,11 +51,12 @@ export const AppChip = ({
return (
<StyledContainer className={className}>
<Avatar
- type={rounded ? 'rounded' : 'app'}
+ shape={rounded ? 'circle' : 'square'}
+ variant={rounded ? 'soft' : 'outline'}
size={size}
- avatarUrl={getAbsoluteImageUrl(logoUrl ?? applicationChipData.logo)}
- placeholder={applicationChipData.name}
- placeholderColorSeed={applicationChipData.seed}
+ src={getAbsoluteImageUrl(logoUrl ?? applicationChipData.logo)}
+ name={applicationChipData.name}
+ colorSeed={applicationChipData.seed}
color={applicationChipData.colors?.color}
backgroundColor={applicationChipData.colors?.backgroundColor}
borderColor={applicationChipData.colors?.borderColor}
diff --git a/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx b/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx
index 366d8f0bc9e..e319952cc1c 100644
--- a/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx
+++ b/packages/twenty-front/src/modules/applications/components/AppConnectionHeader.tsx
@@ -79,12 +79,7 @@ export const AppConnectionHeader = ({
onError={() => setHasAppLogoError(true)}
/>
) : (
- <Avatar
- size="xl"
- placeholder={appName}
- placeholderColorSeed={appName}
- type="squared"
- />
+ <Avatar size="xl" name={appName} colorSeed={appName} shape="square" />
)}
</StyledAppLogoTile>
</StyledContainer>
diff --git a/packages/twenty-front/src/modules/auth/components/Logo.tsx b/packages/twenty-front/src/modules/auth/components/Logo.tsx
index d87338b3011..511b652c41c 100644
--- a/packages/twenty-front/src/modules/auth/components/Logo.tsx
+++ b/packages/twenty-front/src/modules/auth/components/Logo.tsx
@@ -97,9 +97,9 @@ export const Logo = ({
<StyledSecondaryLogoContainer>
<Avatar
size="lg"
- placeholder={placeholder}
- type="squared"
- placeholderColorSeed={placeholder}
+ name={placeholder}
+ shape="square"
+ colorSeed={placeholder}
/>
</StyledSecondaryLogoContainer>
)
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
index a5c363d7919..f26f589c148 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx
@@ -178,8 +178,8 @@ export const SignInUpGlobalScopeForm = () => {
<StyledWorkspaceItem>
<StyledWorkspaceContent>
<Avatar
- placeholder={availableWorkspace.displayName || ''}
- avatarUrl={getAbsoluteImageUrl(
+ name={availableWorkspace.displayName || ''}
+ src={getAbsoluteImageUrl(
availableWorkspace.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
size="lg"
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx
index 4fff1b50144..9adc1b997a0 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceCreationForm.tsx
@@ -250,12 +250,10 @@ export const SignInUpWorkspaceCreationForm = () => {
<OnboardingStepAnimatedItem index={2}>
<StyledLogoRow>
<StyledLogoAvatar
- avatarUrl={logoPreviewUrl}
- placeholder={
- isNonEmptyString(workspaceName) ? workspaceName : '?'
- }
- placeholderColorSeed={workspaceName}
- type="squared"
+ src={logoPreviewUrl}
+ name={isNonEmptyString(workspaceName) ? workspaceName : '?'}
+ colorSeed={workspaceName}
+ shape="square"
size="xl"
onClick={openFilePicker}
/>
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/__tests__/SignInUpWorkspaceCreationForm.test.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/__tests__/SignInUpWorkspaceCreationForm.test.tsx
index bcb02ce1c64..a6b5d87d952 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/__tests__/SignInUpWorkspaceCreationForm.test.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/__tests__/SignInUpWorkspaceCreationForm.test.tsx
@@ -75,6 +75,9 @@ describe('SignInUpWorkspaceCreationForm', () => {
renderForm();
+ expect(screen.getByPlaceholderText('Apple')).toBeInTheDocument();
+ expect(screen.getByPlaceholderText('apple')).toBeInTheDocument();
+
const createButton = screen.getByRole('button', {
name: 'Create workspace',
});
diff --git a/packages/twenty-front/src/modules/mention/components/MentionMenuListItem.tsx b/packages/twenty-front/src/modules/mention/components/MentionMenuListItem.tsx
index 19b8b9cf9df..989f7756bdc 100644
--- a/packages/twenty-front/src/modules/mention/components/MentionMenuListItem.tsx
+++ b/packages/twenty-front/src/modules/mention/components/MentionMenuListItem.tsx
@@ -1,7 +1,7 @@
import { type MouseEvent } from 'react';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
-import { getAvatarType } from '@/object-metadata/utils/getAvatarType';
+import { getAvatarShape } from '@/object-metadata/utils/getAvatarShape';
import { Avatar } from 'twenty-ui/data-display';
import { MenuItemSuggestion } from 'twenty-ui/navigation';
import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
@@ -46,10 +46,10 @@ export const MentionMenuListItem = ({
contextualTextPosition="left"
LeftIcon={() => (
<Avatar
- placeholder={label}
- placeholderColorSeed={recordId}
- avatarUrl={getAbsoluteImageUrl(imageUrl)}
- type={getAvatarType(objectMetadataItem)}
+ name={label}
+ colorSeed={recordId}
+ src={getAbsoluteImageUrl(imageUrl)}
+ shape={getAvatarShape(objectMetadataItem)}
size="sm"
/>
)}
diff --git a/packages/twenty-front/src/modules/mention/components/MentionRecordChip.tsx b/packages/twenty-front/src/modules/mention/components/MentionRecordChip.tsx
index 7409528639f..8a4440f6632 100644
--- a/packages/twenty-front/src/modules/mention/components/MentionRecordChip.tsx
+++ b/packages/twenty-front/src/modules/mention/components/MentionRecordChip.tsx
@@ -57,10 +57,10 @@ export const MentionRecordChip = ({
className={className}
leftComponent={
<AvatarOrIcon
- placeholder={label}
- placeholderColorSeed={recordId}
- avatarType="rounded"
- avatarUrl={getAbsoluteImageUrl(imageUrl)}
+ name={label}
+ colorSeed={recordId}
+ shape="circle"
+ src={getAbsoluteImageUrl(imageUrl)}
/>
}
/>
diff --git a/packages/twenty-front/src/modules/mention/components/MentionSuggestionMenu.tsx b/packages/twenty-front/src/modules/mention/components/MentionSuggestionMenu.tsx
index a9681c96ed9..d80daf8d9e4 100644
--- a/packages/twenty-front/src/modules/mention/components/MentionSuggestionMenu.tsx
+++ b/packages/twenty-front/src/modules/mention/components/MentionSuggestionMenu.tsx
@@ -18,10 +18,10 @@ const renderItem = (
<MenuItemSuggestion
LeftIcon={() => (
<AvatarOrIcon
- placeholder={item.label}
- placeholderColorSeed={item.recordId}
- avatarType="rounded"
- avatarUrl={getAbsoluteImageUrl(item.imageUrl)}
+ name={item.label}
+ colorSeed={item.recordId}
+ shape="circle"
+ src={getAbsoluteImageUrl(item.imageUrl)}
/>
)}
text={item.label}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/__tests__/recordIdentifierToObjectRecordIdentifier.test.ts b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/__tests__/recordIdentifierToObjectRecordIdentifier.test.ts
index 2e8e41bcfa8..948c30be8a9 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/__tests__/recordIdentifierToObjectRecordIdentifier.test.ts
+++ b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/__tests__/recordIdentifierToObjectRecordIdentifier.test.ts
@@ -2,8 +2,8 @@ import { recordIdentifierToObjectRecordIdentifier } from '@/navigation-menu-item
import { CoreObjectNameSingular } from 'twenty-shared/types';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
-jest.mock('@/object-metadata/utils/getAvatarType', () => ({
- getAvatarType: jest.fn(() => 'rounded'),
+jest.mock('@/object-metadata/utils/getAvatarShape', () => ({
+ getAvatarShape: jest.fn(() => 'circle'),
}));
jest.mock('@/object-metadata/utils/getBasePathToShowPage', () => ({
@@ -28,7 +28,7 @@ describe('recordIdentifierToObjectRecordIdentifier', () => {
jest.clearAllMocks();
});
- it('should return ObjectRecordIdentifier with id, name, avatarUrl, avatarType, and linkToShowPage', () => {
+ it('should return ObjectRecordIdentifier with id, name, avatarUrl, avatarShape, and linkToShowPage', () => {
const result = recordIdentifierToObjectRecordIdentifier({
recordIdentifier: baseRecordIdentifier,
objectMetadataItem: baseObjectMetadataItem,
@@ -38,7 +38,7 @@ describe('recordIdentifierToObjectRecordIdentifier', () => {
id: 'record-123',
name: 'John Doe',
avatarUrl: 'https://example.com/avatar.jpg',
- avatarType: 'rounded',
+ avatarShape: 'circle',
linkToShowPage: '/object/person/record-123',
});
});
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/recordIdentifierToObjectRecordIdentifier.ts b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/recordIdentifierToObjectRecordIdentifier.ts
index 34bdb449696..dab0aaa472a 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/common/utils/recordIdentifierToObjectRecordIdentifier.ts
+++ b/packages/twenty-front/src/modules/navigation-menu-item/common/utils/recordIdentifierToObjectRecordIdentifier.ts
@@ -1,6 +1,6 @@
import { CoreObjectNameSingular } from 'twenty-shared/types';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
-import { getAvatarType } from '@/object-metadata/utils/getAvatarType';
+import { getAvatarShape } from '@/object-metadata/utils/getAvatarShape';
import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier';
import { isDefined } from 'twenty-shared/utils';
@@ -18,7 +18,7 @@ export const recordIdentifierToObjectRecordIdentifier = ({
recordIdentifier: RecordIdentifierDTO;
objectMetadataItem: EnrichedObjectMetadataItem;
}): ObjectRecordIdentifier => {
- const avatarType = getAvatarType(objectMetadataItem);
+ const avatarShape = getAvatarShape(objectMetadataItem);
const basePathToShowPage = getBasePathToShowPage({
objectNameSingular: objectMetadataItem.nameSingular,
@@ -45,7 +45,7 @@ export const recordIdentifierToObjectRecordIdentifier = ({
id: recordIdentifier.id,
name: recordIdentifier.labelIdentifier,
avatarUrl: recordIdentifier.imageIdentifier ?? undefined,
- avatarType,
+ avatarShape,
linkToShowPage,
};
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
index 20895b4d7f6..a91d7887c80 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
@@ -74,7 +74,7 @@ export const NavigationMenuItemIcon = ({
}
if (navigationMenuItem.type === NavigationMenuItemType.PAGE_LAYOUT) {
- const pageLayoutIcon = isDefined(navigationMenuItem.icon)
+ const PageLayoutIcon = isDefined(navigationMenuItem.icon)
? getIcon(navigationMenuItem.icon)
: undefined;
const pageLayoutColor = getNavigationMenuItemColor(navigationMenuItem);
@@ -87,10 +87,13 @@ export const NavigationMenuItemIcon = ({
>
<Avatar
size="sm"
- type="icon"
- Icon={pageLayoutIcon}
- iconColor={pageLayoutIconStyle.iconColor}
- placeholder={navigationMenuItem.name ?? ''}
+ shape="rounded-square"
+ icon={
+ isDefined(PageLayoutIcon) ? (
+ <PageLayoutIcon color={pageLayoutIconStyle.iconColor} />
+ ) : undefined
+ }
+ name={navigationMenuItem.name ?? ''}
/>
</StyledTintedIconTileContainer>
);
@@ -117,7 +120,7 @@ export const NavigationMenuItemIcon = ({
: objectMetadataItem?.icon
? getIcon(objectMetadataItem.icon)
: undefined;
- const iconToUse = StandardIcon ?? itemIcon;
+ const IconToUse = StandardIcon ?? itemIcon;
const effectiveColor = getNavigationMenuItemColor(
navigationMenuItem,
@@ -153,12 +156,13 @@ export const NavigationMenuItemIcon = ({
const avatar = (
<Avatar
size={iconStyle ? 'sm' : 'md'}
- type={recordIdentifier?.avatarType ?? 'icon'}
- Icon={iconToUse}
- iconColor={iconColorToUse}
- avatarUrl={getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? '')}
- placeholder={labelIdentifier}
- placeholderColorSeed={navigationMenuItem.targetRecordId ?? undefined}
+ shape={recordIdentifier?.avatarShape ?? 'rounded-square'}
+ icon={
+ isDefined(IconToUse) ? <IconToUse color={iconColorToUse} /> : undefined
+ }
+ src={getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? '')}
+ name={labelIdentifier}
+ colorSeed={navigationMenuItem.targetRecordId ?? undefined}
/>
);
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
index 0ee025bdf00..eb079813a0f 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
@@ -149,14 +149,14 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
const Icon = isRecord
? () => (
<Avatar
- type={
+ shape={
objectMetadataItem.nameSingular === CoreObjectNameSingular.Company
- ? 'squared'
- : 'rounded'
+ ? 'square'
+ : 'circle'
}
- avatarUrl={getAbsoluteImageUrl(recordIdentifier?.avatarUrl)}
- placeholderColorSeed={navigationMenuItem!.targetRecordId ?? undefined}
- placeholder={itemLabel}
+ src={getAbsoluteImageUrl(recordIdentifier?.avatarUrl)}
+ colorSeed={navigationMenuItem!.targetRecordId ?? undefined}
+ name={itemLabel}
/>
)
: isViewWithResolvedView && isDefined(view?.icon)
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
index ef2c247e288..25457283e28 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
@@ -89,8 +89,8 @@ export const SidePanelNewSidebarItemMainMenu = ({
<CommandMenuItem
Icon={() => (
<Avatar
- placeholder="L"
- type="rounded"
+ name="L"
+ shape="circle"
backgroundColor={themeCssVariables.color.green4}
/>
)}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordItem.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordItem.tsx
index 13a60c618b2..bc2fe485b96 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordItem.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemRecordItem.tsx
@@ -86,14 +86,14 @@ export const SidePanelNewSidebarItemRecordItem = ({
<SidePanelItemWithAddToNavigationDrag
customIconContent={
<Avatar
- type={
+ shape={
record.objectNameSingular === CoreObjectNameSingular.Company
- ? 'squared'
- : 'rounded'
+ ? 'square'
+ : 'circle'
}
- avatarUrl={getAbsoluteImageUrl(record.imageUrl)}
- placeholderColorSeed={record.recordId}
- placeholder={record.label}
+ src={getAbsoluteImageUrl(record.imageUrl)}
+ colorSeed={record.recordId}
+ name={record.label}
/>
}
label={record.label}
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapToObjectRecordIdentifier.test.tsx b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapToObjectRecordIdentifier.test.tsx
index 46e5249f2f0..a81b16324e3 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapToObjectRecordIdentifier.test.tsx
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useMapToObjectRecordIdentifier.test.tsx
@@ -31,7 +31,7 @@ describe('useMapToObjectRecordIdentifier', () => {
id: 'id',
name: 'Sheldon Cooper',
avatarUrl: '',
- avatarType: 'rounded',
+ avatarShape: 'circle',
linkToShowPage: '/object/person/id',
});
});
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/generateDefaultRecordChipData.ts b/packages/twenty-front/src/modules/object-metadata/utils/generateDefaultRecordChipData.ts
index 3fa53811b6d..188478a4061 100644
--- a/packages/twenty-front/src/modules/object-metadata/utils/generateDefaultRecordChipData.ts
+++ b/packages/twenty-front/src/modules/object-metadata/utils/generateDefaultRecordChipData.ts
@@ -15,7 +15,7 @@ export const generateDefaultRecordChipData = ({
: (record.name ?? '');
return {
- avatarType: 'rounded',
+ avatarShape: 'circle',
avatarUrl: name,
isLabelIdentifier: false,
name,
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/getAvatarType.ts b/packages/twenty-front/src/modules/object-metadata/utils/getAvatarShape.ts
similarity index 86%
rename from packages/twenty-front/src/modules/object-metadata/utils/getAvatarType.ts
rename to packages/twenty-front/src/modules/object-metadata/utils/getAvatarShape.ts
index 11919c25b7c..7951c149204 100644
--- a/packages/twenty-front/src/modules/object-metadata/utils/getAvatarType.ts
+++ b/packages/twenty-front/src/modules/object-metadata/utils/getAvatarShape.ts
@@ -3,20 +3,20 @@ import { getImageIdentifierFieldMetadataItem } from '@/object-metadata/utils/get
import { CoreObjectNameSingular, FieldMetadataType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-export const getAvatarType = (
+export const getAvatarShape = (
objectMetadataItem?: Pick<
EnrichedObjectMetadataItem,
'fields' | 'imageIdentifierFieldMetadataId' | 'nameSingular'
>,
) => {
if (!isDefined(objectMetadataItem)) {
- return 'rounded';
+ return 'circle';
}
if (
objectMetadataItem.nameSingular === CoreObjectNameSingular.WorkspaceMember
) {
- return 'rounded';
+ return 'circle';
}
const imageIdentifierFieldMetadataItem =
@@ -25,9 +25,9 @@ export const getAvatarType = (
if (isDefined(imageIdentifierFieldMetadataItem)) {
switch (imageIdentifierFieldMetadataItem.type) {
case FieldMetadataType.LINKS:
- return 'squared';
+ return 'square';
case FieldMetadataType.FILES:
- return 'rounded';
+ return 'circle';
}
}
@@ -35,8 +35,8 @@ export const getAvatarType = (
objectMetadataItem.nameSingular === CoreObjectNameSingular.Task ||
objectMetadataItem.nameSingular === CoreObjectNameSingular.Note
) {
- return 'icon';
+ return 'rounded-square';
}
- return 'rounded';
+ return 'circle';
};
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/getObjectRecordIdentifier.ts b/packages/twenty-front/src/modules/object-metadata/utils/getObjectRecordIdentifier.ts
index a30d3d61eb0..7f2d844edd0 100644
--- a/packages/twenty-front/src/modules/object-metadata/utils/getObjectRecordIdentifier.ts
+++ b/packages/twenty-front/src/modules/object-metadata/utils/getObjectRecordIdentifier.ts
@@ -4,7 +4,7 @@ import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/get
import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier';
-import { getAvatarType } from './getAvatarType';
+import { getAvatarShape } from './getAvatarShape';
import { getAvatarUrl } from './getAvatarUrl';
import { getLabelIdentifierFieldValue } from './getLabelIdentifierFieldValue';
import { getLinkToShowPage } from './getLinkToShowPage';
@@ -35,7 +35,7 @@ export const getObjectRecordIdentifier = ({
const imageIdentifierFieldMetadata =
getImageIdentifierFieldMetadataItem(objectMetadataItem);
- const avatarType = getAvatarType(objectMetadataItem);
+ const avatarShape = getAvatarShape(objectMetadataItem);
const avatarUrl = getAvatarUrl(
objectMetadataItem.nameSingular,
@@ -53,7 +53,7 @@ export const getObjectRecordIdentifier = ({
id: record.id,
name: `${labelIdentifierFieldValue}`,
avatarUrl,
- avatarType,
+ avatarShape,
linkToShowPage,
};
};
diff --git a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
index ade9b92b539..80203e4bdd9 100644
--- a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
+++ b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx
@@ -86,10 +86,10 @@ export const RecordChip = ({
leftComponent={
isIconHidden ? null : (
<AvatarOrIcon
- placeholder={recordChipData.name}
- placeholderColorSeed={record.id}
- avatarType={recordChipData.avatarType}
- avatarUrl={getAbsoluteImageUrl(recordChipData.avatarUrl ?? '')}
+ name={recordChipData.name}
+ colorSeed={record.id}
+ shape={recordChipData.avatarShape}
+ src={getAbsoluteImageUrl(recordChipData.avatarUrl ?? '')}
/>
)
}
@@ -108,10 +108,10 @@ export const RecordChip = ({
leftComponent={
isIconHidden ? null : (
<AvatarOrIcon
- placeholder={recordChipData.name}
- placeholderColorSeed={record.id}
- avatarType={recordChipData.avatarType}
- avatarUrl={getAbsoluteImageUrl(recordChipData.avatarUrl ?? '')}
+ name={recordChipData.name}
+ colorSeed={record.id}
+ shape={recordChipData.avatarShape}
+ src={getAbsoluteImageUrl(recordChipData.avatarUrl ?? '')}
/>
)
}
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordPinnedItems.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordPinnedItems.tsx
index 9b4b6bc475c..e7a98f30f5f 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordPinnedItems.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordPinnedItems.tsx
@@ -32,10 +32,10 @@ export const ObjectFilterDropdownRecordPinnedItems = (props: {
avatar={
selectableItem.avatarUrl ? (
<Avatar
- avatarUrl={getAbsoluteImageUrl(selectableItem.avatarUrl)}
- placeholderColorSeed={selectableItem.id}
- placeholder={selectableItem.name}
- type={selectableItem.avatarType}
+ src={getAbsoluteImageUrl(selectableItem.avatarUrl)}
+ colorSeed={selectableItem.id}
+ name={selectableItem.name}
+ shape={selectableItem.avatarShape}
size="md"
/>
) : (
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/turnCurrencyIntoSelectableItem.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/turnCurrencyIntoSelectableItem.ts
index 5e4214ccf3b..21bf37ada35 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/turnCurrencyIntoSelectableItem.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/turnCurrencyIntoSelectableItem.ts
@@ -6,7 +6,7 @@ export const turnCurrencyIntoSelectableItem = (
): SelectableItem => ({
id: currency.value,
AvatarIcon: currency.Icon,
- avatarType: 'icon',
+ avatarShape: 'rounded-square',
name: `${currency.label}`,
isSelected: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/types/RecordChipData.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/types/RecordChipData.ts
index 3d3dff2cac4..01ffe5321c6 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/types/RecordChipData.ts
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/types/RecordChipData.ts
@@ -1,8 +1,8 @@
-import { type AvatarType } from 'twenty-ui/data-display';
+import { type AvatarShape } from 'twenty-ui/data-display';
export type RecordChipData = {
recordId: string;
name: string;
- avatarType: AvatarType;
+ avatarShape: AvatarShape;
avatarUrl: string;
isLabelIdentifier: boolean;
objectNameSingular: string;
diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx
index 60371539d98..1f8ffeb368c 100644
--- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx
@@ -1,7 +1,7 @@
import { t } from '@lingui/core/macro';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
-import { getAvatarType } from '@/object-metadata/utils/getAvatarType';
+import { getAvatarShape } from '@/object-metadata/utils/getAvatarShape';
import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext';
import { multipleRecordPickerIsSelectedComponentFamilySelector } from '@/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerIsSelectedComponentFamilySelector';
import { getMultipleRecordPickerSelectableListId } from '@/object-record/record-picker/multiple-record-picker/utils/getMultipleRecordPickerSelectableListId';
@@ -84,11 +84,11 @@ export const MultipleRecordPickerMenuItemContent = ({
selected={isRecordSelectedWithObjectItem}
avatar={
<Avatar
- avatarUrl={getAbsoluteImageUrl(searchRecord.imageUrl)}
- placeholderColorSeed={searchRecord.recordId}
- placeholder={displayText}
+ src={getAbsoluteImageUrl(searchRecord.imageUrl)}
+ colorSeed={searchRecord.recordId}
+ name={displayText}
size="md"
- type={getAvatarType(objectMetadataItem)}
+ shape={getAvatarShape(objectMetadataItem)}
/>
}
text={displayText}
diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx
index 21db14e8f41..6ce45af1530 100644
--- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
-import { getAvatarType } from '@/object-metadata/utils/getAvatarType';
+import { getAvatarShape } from '@/object-metadata/utils/getAvatarShape';
import { searchRecordStoreFamilyState } from '@/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState';
import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext';
import { singleRecordPickerSearchableObjectMetadataItemsComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchableObjectMetadataItemsComponentState';
@@ -89,11 +89,11 @@ export const SingleRecordPickerMenuItem = ({
focused={isSelectedItemId}
avatar={
<Avatar
- avatarUrl={getAbsoluteImageUrl(searchRecordStore.imageUrl)}
- placeholderColorSeed={morphItem.recordId}
- placeholder={searchRecordStore.label}
+ src={getAbsoluteImageUrl(searchRecordStore.imageUrl)}
+ colorSeed={morphItem.recordId}
+ name={searchRecordStore.label}
size="md"
- type={getAvatarType(objectMetadataItem)}
+ shape={getAvatarShape(objectMetadataItem)}
/>
}
contextualText={
diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
index f9907647244..a2d05c0bd08 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/components/ObjectRecordShowPageBreadcrumb.tsx
@@ -155,11 +155,11 @@ export const ObjectRecordShowPageBreadcrumb = ({
isDefined(recordIdentifier) && (
<StyledAvatarContainer>
<Avatar
- avatarUrl={getAbsoluteImageUrl(recordIdentifier.avatarUrl)}
- placeholder={recordIdentifier.name}
- placeholderColorSeed={objectRecordId}
+ src={getAbsoluteImageUrl(recordIdentifier.avatarUrl)}
+ name={recordIdentifier.name}
+ colorSeed={objectRecordId}
size="md"
- type={recordIdentifier.avatarType}
+ shape={recordIdentifier.avatarShape ?? undefined}
/>
</StyledAvatarContainer>
)
diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarTitle.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarTitle.tsx
index 8d9e64de47b..a71ae78f737 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarTitle.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/components/RecordIdentifierBarTitle.tsx
@@ -85,13 +85,13 @@ export const RecordIdentifierBarTitle = ({
<HeaderIdentifier
fontSize={isInSidePanel ? 'md' : 'lg'}
avatar={{
- avatarUrl: getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? ''),
+ src: getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? ''),
onClick: isAvatarEditable
? () => inputFileRef.current?.click?.()
: undefined,
- placeholderColorSeed: objectRecordId,
- placeholder: recordIdentifier?.name ?? '',
- type: recordIdentifier?.avatarType ?? 'rounded',
+ colorSeed: objectRecordId,
+ name: recordIdentifier?.name ?? '',
+ shape: recordIdentifier?.avatarShape ?? 'circle',
}}
title={
// A writable title has to stay click-to-edit, so only a read-only one
diff --git a/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetRelationPickerMenuItem.tsx b/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetRelationPickerMenuItem.tsx
index 90f81ba67d0..d9c67889638 100644
--- a/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetRelationPickerMenuItem.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table-widget/components/RecordTableWidgetRelationPickerMenuItem.tsx
@@ -39,11 +39,11 @@ export const RecordTableWidgetRelationPickerMenuItem = ({
focused={isSelectedItemId}
avatar={
<Avatar
- avatarUrl={getAbsoluteImageUrl(relationRecord.avatarUrl)}
- placeholderColorSeed={relationRecord.id}
- placeholder={relationRecord.name}
+ src={getAbsoluteImageUrl(relationRecord.avatarUrl)}
+ colorSeed={relationRecord.id}
+ name={relationRecord.name}
size="md"
- type={relationRecord.avatarType ?? 'rounded'}
+ shape={relationRecord.avatarShape ?? 'circle'}
/>
}
/>
diff --git a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
index 3368dab797f..fa71b09800a 100644
--- a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
+++ b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx
@@ -108,11 +108,11 @@ export const MultipleSelectDropdown = ({
text={item.name}
avatar={
<Avatar
- avatarUrl={getAbsoluteImageUrl(item.avatarUrl)}
- placeholderColorSeed={item.id}
- placeholder={item.name}
+ src={getAbsoluteImageUrl(item.avatarUrl)}
+ colorSeed={item.id}
+ name={item.name}
size="md"
- type={item.avatarType}
+ shape={item.avatarShape}
/>
}
/>
diff --git a/packages/twenty-front/src/modules/object-record/select/types/SelectableItem.ts b/packages/twenty-front/src/modules/object-record/select/types/SelectableItem.ts
index 2a3ec6260db..02c4668b7e2 100644
--- a/packages/twenty-front/src/modules/object-record/select/types/SelectableItem.ts
+++ b/packages/twenty-front/src/modules/object-record/select/types/SelectableItem.ts
@@ -1,11 +1,11 @@
-import { type AvatarType } from 'twenty-ui/data-display';
+import { type AvatarShape } from 'twenty-ui/data-display';
import { type IconComponent } from 'twenty-ui/icon';
export type SelectableItem<T = object> = T & {
id: string;
name: string;
avatarUrl?: string;
- avatarType?: AvatarType;
+ avatarShape?: AvatarShape;
AvatarIcon?: IconComponent;
isSelected: boolean;
isIconInverted?: boolean;
diff --git a/packages/twenty-front/src/modules/object-record/types/ObjectRecordIdentifier.ts b/packages/twenty-front/src/modules/object-record/types/ObjectRecordIdentifier.ts
index 42c98e37126..0219854bea9 100644
--- a/packages/twenty-front/src/modules/object-record/types/ObjectRecordIdentifier.ts
+++ b/packages/twenty-front/src/modules/object-record/types/ObjectRecordIdentifier.ts
@@ -1,8 +1,8 @@
-import { type AvatarType } from 'twenty-ui/data-display';
+import { type AvatarShape } from 'twenty-ui/data-display';
export type ObjectRecordIdentifier = {
id: string;
name: string;
avatarUrl?: string;
- avatarType?: AvatarType | null;
+ avatarShape?: AvatarShape | null;
linkToShowPage?: string;
};
diff --git a/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts b/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts
index 4e34a9a96c9..af09a76465e 100644
--- a/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/getRecordChipGenerators.ts
@@ -3,7 +3,7 @@ import {
type IdentifierChipGeneratorPerObject,
} from '@/object-metadata/contexts/PreComputedChipGeneratorsContext';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
-import { getAvatarType } from '@/object-metadata/utils/getAvatarType';
+import { getAvatarShape } from '@/object-metadata/utils/getAvatarShape';
import { getAvatarUrl } from '@/object-metadata/utils/getAvatarUrl';
import { getImageIdentifierFieldMetadataItem } from '@/object-metadata/utils/getImageIdentifierFieldMetadataItem';
import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem';
@@ -75,7 +75,7 @@ export const getRecordChipGenerators = (
const imageIdentifierFieldMetadataToUse =
getImageIdentifierFieldMetadataItem(objectMetadataItemToUse);
- const avatarType = getAvatarType(objectMetadataItemToUse);
+ const avatarShape = getAvatarShape(objectMetadataItemToUse);
return [
fieldMetadataItem.name,
@@ -92,7 +92,7 @@ export const getRecordChipGenerators = (
imageIdentifierFieldMetadataToUse,
allowRequestsToTwentyIcons,
),
- avatarType,
+ avatarShape,
isLabelIdentifier,
objectNameSingular: objectNameSingularToFind,
}) satisfies RecordChipData,
diff --git a/packages/twenty-front/src/modules/onboarding/components/WelcomeOverlay/WelcomePersonChip.tsx b/packages/twenty-front/src/modules/onboarding/components/WelcomeOverlay/WelcomePersonChip.tsx
index 2f700aaf94a..aea8254c617 100644
--- a/packages/twenty-front/src/modules/onboarding/components/WelcomeOverlay/WelcomePersonChip.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/WelcomeOverlay/WelcomePersonChip.tsx
@@ -51,11 +51,11 @@ export const WelcomePersonChip = ({
return (
<StyledChip sizeVariant={sizeVariant}>
<Avatar
- type="rounded"
+ shape="circle"
size={avatarSize}
- placeholder={fullName}
- placeholderColorSeed={currentWorkspaceMember?.id}
- avatarUrl={getAbsoluteImageUrl(currentWorkspaceMember?.avatarUrl)}
+ name={fullName}
+ colorSeed={currentWorkspaceMember?.id}
+ src={getAbsoluteImageUrl(currentWorkspaceMember?.avatarUrl)}
/>
<StyledPersonName>{fullName}</StyledPersonName>
</StyledChip>
diff --git a/packages/twenty-front/src/modules/onboarding/components/import-contacts/OnboardingImportPreviewCompanies.tsx b/packages/twenty-front/src/modules/onboarding/components/import-contacts/OnboardingImportPreviewCompanies.tsx
index 6df7d2653a1..389472668d2 100644
--- a/packages/twenty-front/src/modules/onboarding/components/import-contacts/OnboardingImportPreviewCompanies.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/import-contacts/OnboardingImportPreviewCompanies.tsx
@@ -81,11 +81,11 @@ export const OnboardingImportPreviewCompanies = () => {
clickable={false}
leftComponent={
<Avatar
- type="squared"
+ shape="square"
size="md"
- placeholder={company.name}
- placeholderColorSeed={company.id}
- avatarUrl={getAbsoluteImageUrl(
+ name={company.name}
+ colorSeed={company.id}
+ src={getAbsoluteImageUrl(
getLogoUrlFromDomainName(company.domainName),
)}
/>
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryListItem.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryListItem.tsx
index 93fc25547ba..5b94c371aa1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryListItem.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryListItem.tsx
@@ -130,10 +130,10 @@ export const CallRecordingTranscriptEntryListItem = ({
variant={ChipVariant.Transparent}
leftComponent={
<Avatar
- placeholder={speakerName}
- placeholderColorSeed={speakerName}
+ name={speakerName}
+ colorSeed={speakerName}
size="sm"
- type="rounded"
+ shape="circle"
/>
}
/>
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx
index 31a0a688a5e..017dc49ceaa 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx
@@ -145,14 +145,14 @@ export const SettingsAdminGeneral = () => {
overflow="hidden"
>
<Avatar
- avatarUrl={getAbsoluteImageUrl(user.avatarUrl)}
- placeholder={
+ src={getAbsoluteImageUrl(user.avatarUrl)}
+ name={
`${user.firstName || ''} ${user.lastName || ''}`.trim() ||
user.email
}
- placeholderColorSeed={user.id}
+ colorSeed={user.id}
size="md"
- type="rounded"
+ shape="circle"
/>
<OverflowingTextWithTooltip
text={
@@ -169,9 +169,9 @@ export const SettingsAdminGeneral = () => {
{user.workspaceId ? (
<>
<Avatar
- avatarUrl={getAbsoluteImageUrl(user.workspaceLogo)}
- placeholder={user.workspaceName || ''}
- placeholderColorSeed={user.workspaceId}
+ src={getAbsoluteImageUrl(user.workspaceLogo)}
+ name={user.workspaceName || ''}
+ colorSeed={user.workspaceId}
size="sm"
/>
<OverflowingTextWithTooltip
@@ -243,9 +243,9 @@ export const SettingsAdminGeneral = () => {
overflow="hidden"
>
<Avatar
- avatarUrl={getAbsoluteImageUrl(workspace.logoUrl)}
- placeholder={workspace.name || ''}
- placeholderColorSeed={workspace.id}
+ src={getAbsoluteImageUrl(workspace.logoUrl)}
+ name={workspace.name || ''}
+ colorSeed={workspace.id}
size="md"
/>
<OverflowingTextWithTooltip
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
index d7c8eae6a5f..cd063665ceb 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
@@ -84,7 +84,7 @@ export const SettingsAdminWorkspaceContent = ({
})}
leftComponent={
<AvatarOrIcon
- avatarUrl={getAbsoluteImageUrl(
+ src={getAbsoluteImageUrl(
isNonEmptyString(activeWorkspace?.logo)
? activeWorkspace?.logo
: DEFAULT_WORKSPACE_LOGO,
diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderCell.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderCell.tsx
index 35043f9dccb..32295837cba 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderCell.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderCell.tsx
@@ -54,11 +54,11 @@ export const SettingsBillingLimitSpenderCell = ({
if (isWorkspaceWide) {
return (
<Avatar
- placeholder={name}
- avatarUrl={getAbsoluteImageUrl(
+ name={name}
+ src={getAbsoluteImageUrl(
currentWorkspace?.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
- type="squared"
+ shape="square"
size="sm"
/>
);
@@ -67,9 +67,9 @@ export const SettingsBillingLimitSpenderCell = ({
if (row.spenderType === 'userWorkspace') {
return (
<Avatar
- placeholder={name}
- avatarUrl={row.spenderAvatarUrl}
- type="rounded"
+ name={name}
+ src={row.spenderAvatarUrl}
+ shape="circle"
size="sm"
/>
);
@@ -78,9 +78,9 @@ export const SettingsBillingLimitSpenderCell = ({
if (row.spenderType === 'application') {
return (
<Avatar
- placeholder={name}
- avatarUrl={row.spenderAvatarUrl}
- type="squared"
+ name={name}
+ src={row.spenderAvatarUrl}
+ shape="square"
size="sm"
/>
);
diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderSelect.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderSelect.tsx
index a690158aa00..094421e65b4 100644
--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderSelect.tsx
+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitSpenderSelect.tsx
@@ -109,9 +109,9 @@ export const SettingsBillingLimitSpenderSelect = ({
if (spenderType === 'workspace') {
return (
<Avatar
- placeholder={workspaceName}
- avatarUrl={workspaceAvatarUrl}
- type="squared"
+ name={workspaceName}
+ src={workspaceAvatarUrl}
+ shape="square"
size="md"
/>
);
@@ -131,9 +131,9 @@ export const SettingsBillingLimitSpenderSelect = ({
return (
<Avatar
- placeholder={selectedOption?.label ?? ''}
- avatarUrl={selectedOption?.avatarUrl}
- type={spenderType === 'userWorkspace' ? 'rounded' : 'squared'}
+ name={selectedOption?.label ?? ''}
+ src={selectedOption?.avatarUrl}
+ shape={spenderType === 'userWorkspace' ? 'circle' : 'square'}
size="md"
/>
);
@@ -153,9 +153,9 @@ export const SettingsBillingLimitSpenderSelect = ({
selected={selected}
avatar={
<Avatar
- placeholder={option.label}
- avatarUrl={option.avatarUrl}
- type={kind === 'userWorkspace' ? 'rounded' : 'squared'}
+ name={option.label}
+ src={option.avatarUrl}
+ shape={kind === 'userWorkspace' ? 'circle' : 'square'}
size="md"
/>
}
@@ -227,9 +227,9 @@ export const SettingsBillingLimitSpenderSelect = ({
selected={spenderType === 'workspace'}
avatar={
<Avatar
- placeholder={workspaceName}
- avatarUrl={workspaceAvatarUrl}
- type="squared"
+ name={workspaceName}
+ src={workspaceAvatarUrl}
+ shape="square"
size="md"
/>
}
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx b/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
index 5f57b354225..cc612af5785 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsItemTypeTag.tsx
@@ -27,10 +27,11 @@ export const SettingsItemTypeTag = ({
accent={ChipAccent.TextPrimary}
leftComponent={
<Avatar
- type="app"
+ shape="square"
+ variant="outline"
size="sm"
- placeholder="Remote"
- placeholderColorSeed="Remote"
+ name="Remote"
+ colorSeed="Remote"
/>
}
/>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx
index 984f07756f0..a884bf35d4b 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx
@@ -42,13 +42,13 @@ export const SettingsRoleAssignmentConfirmationModalSubtitle = ({
title={selectedRoleTarget.role?.label || ''}
Icon={
<Avatar
- avatarUrl={getAbsoluteImageUrl(
+ src={getAbsoluteImageUrl(
enrichedSelectedWorkspaceMember?.avatarUrl,
)}
- placeholderColorSeed={enrichedSelectedWorkspaceMember?.id}
- placeholder={workspaceMemberName}
+ colorSeed={enrichedSelectedWorkspaceMember?.id}
+ name={workspaceMemberName}
size="md"
- type="rounded"
+ shape="circle"
/>
}
onClick={() =>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
index f4d5f801963..fc3dab3f151 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx
@@ -64,10 +64,10 @@ export const SettingsRoleAssignmentTableRow = ({
);
return (
<Avatar
- avatarUrl={getAbsoluteImageUrl(enrichedWorkspaceMember?.avatarUrl)}
- placeholderColorSeed={enrichedWorkspaceMember?.id}
- placeholder={enrichedWorkspaceMember?.name.firstName ?? ''}
- type="rounded"
+ src={getAbsoluteImageUrl(enrichedWorkspaceMember?.avatarUrl)}
+ colorSeed={enrichedWorkspaceMember?.id}
+ name={enrichedWorkspaceMember?.name.firstName ?? ''}
+ shape="circle"
size="md"
/>
);
diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx
index 71512fe3e3a..f455fd0ec1d 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx
@@ -49,11 +49,11 @@ export const SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent = ({
key={workspaceMember.id}
onClick={() => onSelect(workspaceMember)}
avatar={{
- type: 'rounded',
+ shape: 'circle',
size: 'md',
- placeholder: workspaceMemberFullName,
- placeholderColorSeed: workspaceMember.id,
- avatarUrl: workspaceMember.avatarUrl,
+ name: workspaceMemberFullName,
+ colorSeed: workspaceMember.id,
+ src: workspaceMember.avatarUrl,
}}
text={workspaceMemberFullName}
contextualText={workspaceMember.userEmail}
diff --git a/packages/twenty-front/src/modules/settings/usage/components/UsageByUserTableSection.tsx b/packages/twenty-front/src/modules/settings/usage/components/UsageByUserTableSection.tsx
index f88ff3eb6a6..1d537ed0dbf 100644
--- a/packages/twenty-front/src/modules/settings/usage/components/UsageByUserTableSection.tsx
+++ b/packages/twenty-front/src/modules/settings/usage/components/UsageByUserTableSection.tsx
@@ -117,10 +117,10 @@ export const UsageByUserTableSection = ({
>
{showAvatar && (
<Avatar
- type="rounded"
+ shape="circle"
size="md"
- placeholder={item.label ?? item.key}
- placeholderColorSeed={item.key}
+ name={item.label ?? item.key}
+ colorSeed={item.key}
/>
)}
{item.label ?? item.key}
diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordChipAvatars.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordChipAvatars.tsx
index 95ddbe2dddb..923fd778600 100644
--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordChipAvatars.tsx
+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelContextRecordChipAvatars.tsx
@@ -41,16 +41,16 @@ export const SidePanelContextRecordChipAvatars = ({
);
return (
<StyledIconWrapper
- withIconBackground={recordChipData.avatarType !== 'rounded'}
+ withIconBackground={recordChipData.avatarShape !== 'circle'}
>
{Icon ? (
<Icon color={IconColor} size={theme.icon.size.sm} />
) : (
<Avatar
- avatarUrl={getAbsoluteImageUrl(recordChipData.avatarUrl)}
- placeholderColorSeed={recordChipData.recordId}
- placeholder={recordChipData.name}
- type={recordChipData.avatarType}
+ src={getAbsoluteImageUrl(recordChipData.avatarUrl)}
+ colorSeed={recordChipData.recordId}
+ name={recordChipData.name}
+ shape={recordChipData.avatarShape}
size="sm"
/>
)}
diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordPreviewCard.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordPreviewCard.tsx
index ba690c2c3fe..1ea0a0e1774 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordPreviewCard.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordPreviewCard.tsx
@@ -216,10 +216,10 @@ export const SidePanelSearchRecordPreviewCard = ({
<StyledHeader>
<HeaderIdentifier
avatar={{
- avatarUrl: getAbsoluteImageUrl(recordIdentifier?.avatarUrl),
- placeholder: recordIdentifier?.name ?? label,
- placeholderColorSeed: recordId,
- type: recordIdentifier?.avatarType ?? 'rounded',
+ src: getAbsoluteImageUrl(recordIdentifier?.avatarUrl),
+ name: recordIdentifier?.name ?? label,
+ colorSeed: recordId,
+ shape: recordIdentifier?.avatarShape ?? 'circle',
}}
title={
<StyledTitleText>
diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx
index 69c4b0ea631..92c770393e2 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/search/components/SidePanelSearchRecordsPage.tsx
@@ -95,10 +95,10 @@ export const SidePanelSearchRecordsPage = () => {
onClick={handleClick}
LeftComponent={
<Avatar
- type={item.avatarType}
- avatarUrl={getAbsoluteImageUrl(item.imageUrl)}
- placeholderColorSeed={item.recordId}
- placeholder={item.label}
+ shape={item.avatarShape}
+ src={getAbsoluteImageUrl(item.imageUrl)}
+ colorSeed={item.recordId}
+ name={item.label}
/>
}
/>
diff --git a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx
index 73368a51bbb..5a31977315d 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/search/hooks/useSidePanelSearchRecords.tsx
@@ -15,7 +15,7 @@ export type SearchResultItem = {
recordId: string;
imageUrl?: string | null;
objectLabel: string;
- avatarType: 'squared' | 'rounded';
+ avatarShape: 'square' | 'circle';
};
export const useSidePanelSearchRecords = () => {
@@ -47,10 +47,10 @@ export const useSidePanelSearchRecords = () => {
readableObjectMetadataItems.find(
(item) => item.nameSingular === searchRecord.objectNameSingular,
)?.labelSingular ?? searchRecord.objectNameSingular,
- avatarType:
+ avatarShape:
searchRecord.objectNameSingular === CoreObjectNameSingular.Company
- ? ('squared' as const)
- : ('rounded' as const),
+ ? ('square' as const)
+ : ('circle' as const),
}));
}, [searchRecords, readableObjectMetadataItems]);
diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTableRow.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTableRow.tsx
index 88a11aa169e..48cf0209fab 100644
--- a/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTableRow.tsx
+++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/BackgroundMockTableRow.tsx
@@ -92,12 +92,7 @@ const PersonChip = ({ fullName }: { fullName: string | null }) => {
accent={ChipAccent.TextPrimary}
clickable={false}
leftComponent={
- <Avatar
- type="rounded"
- placeholder={fullName}
- placeholderColorSeed={fullName}
- size="md"
- />
+ <Avatar shape="circle" name={fullName} colorSeed={fullName} size="md" />
}
/>
);
@@ -125,10 +120,10 @@ export const BackgroundMockTableRow = ({
clickable={false}
leftComponent={
<Avatar
- type="squared"
- avatarUrl={getAbsoluteImageUrl(logoUrl)}
- placeholder={company.name}
- placeholderColorSeed={company.id}
+ shape="square"
+ src={getAbsoluteImageUrl(logoUrl)}
+ name={company.name}
+ colorSeed={company.id}
size="md"
/>
}
diff --git a/packages/twenty-front/src/modules/ui/field/display/components/ActorDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/ActorDisplay.tsx
index 6f44033fb1c..8b4c1f4d760 100644
--- a/packages/twenty-front/src/modules/ui/field/display/components/ActorDisplay.tsx
+++ b/packages/twenty-front/src/modules/ui/field/display/components/ActorDisplay.tsx
@@ -93,11 +93,11 @@ export const ActorDisplay = ({
variant={ChipVariant.Transparent}
leftComponent={
<AvatarOrIcon
- placeholderColorSeed={workspaceMemberId ?? undefined}
- avatarType={workspaceMemberId ? 'rounded' : 'squared'}
- placeholder={name}
+ colorSeed={workspaceMemberId ?? undefined}
+ shape={workspaceMemberId ? 'circle' : 'square'}
+ name={name}
Icon={LeftIcon}
- avatarUrl={getAbsoluteImageUrl(avatarUrl ?? undefined)}
+ src={getAbsoluteImageUrl(avatarUrl ?? undefined)}
/>
}
/>
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuHeader.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuHeader.stories.tsx
index 2b87e3174ae..c491d35978d 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuHeader.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/__stories__/DropdownMenuHeader.stories.tsx
@@ -42,9 +42,7 @@ export const StartAndEndIcon: Story = {
export const StartAvatar: Story = {
args: {
- StartComponent: (
- <Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
- ),
+ StartComponent: <Avatar name="placeholder" src={AVATAR_URL_MOCK} />,
children: 'Avatar',
},
};
@@ -52,9 +50,7 @@ export const StartAvatar: Story = {
export const ContextDropdownAndAvatar: Story = {
args: {
children: 'Context Dropdown',
- StartComponent: (
- <Avatar placeholder="placeholder" avatarUrl={AVATAR_URL_MOCK} />
- ),
+ StartComponent: <Avatar name="placeholder" src={AVATAR_URL_MOCK} />,
EndComponent: (
<Dropdown
dropdownId="story-dropdown-id-context-menu"
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/HeaderIdentifier.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/HeaderIdentifier.tsx
index 4239971d76a..5612f2e8715 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/HeaderIdentifier.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/HeaderIdentifier.tsx
@@ -52,7 +52,7 @@ const StyledTitle = styled.h3<{ fontSize: 'md' | 'lg' }>`
type HeaderIdentifierProps = {
avatar?: Pick<
AvatarProps,
- 'avatarUrl' | 'onClick' | 'placeholder' | 'placeholderColorSeed' | 'type'
+ 'src' | 'onClick' | 'name' | 'colorSeed' | 'shape' | 'variant'
>;
icon?: ReactNode;
iconColor?: string;
@@ -71,11 +71,12 @@ export const HeaderIdentifier = ({
}: HeaderIdentifierProps) => {
const identifierIcon = isDefined(avatar) ? (
<Avatar
- avatarUrl={avatar.avatarUrl}
+ src={avatar.src}
onClick={avatar.onClick}
- placeholder={avatar.placeholder}
- placeholderColorSeed={avatar.placeholderColorSeed}
- type={avatar.type}
+ name={avatar.name}
+ colorSeed={avatar.colorSeed}
+ shape={avatar.shape}
+ variant={avatar.variant}
size={fontSize}
/>
) : (
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/__stories__/HeaderIdentifier.stories.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/__stories__/HeaderIdentifier.stories.tsx
index 3d139a4bb18..74a0bf50e42 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/__stories__/HeaderIdentifier.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/__stories__/HeaderIdentifier.stories.tsx
@@ -33,7 +33,7 @@ type Story = StoryObj<typeof HeaderIdentifier>;
export const Record: Story = {
args: {
- avatar: { placeholder: 'Acme', type: 'rounded', onClick: fn() },
+ avatar: { name: 'Acme', shape: 'circle', onClick: fn() },
title: 'Acme',
label: 'Created 2 days ago',
},
diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
index fb1573b591d..660d5c364e8 100644
--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabAvatar.tsx
@@ -10,11 +10,7 @@ export const TabAvatar = ({ tab }: { tab: SingleTabProps }) => {
if (isDefined(tab.logo)) {
return (
- <Avatar
- avatarUrl={getAbsoluteImageUrl(tab.logo)}
- size="md"
- placeholder={tab.title}
- />
+ <Avatar src={getAbsoluteImageUrl(tab.logo)} size="md" name={tab.title} />
);
}
return (
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
index b2da84c7ff8..8283c61d8e5 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx
@@ -34,8 +34,8 @@ export const MultiWorkspaceDropdownClickableComponent = ({
disabled={disabled}
>
<Avatar
- placeholder={currentWorkspace?.displayName || ''}
- avatarUrl={getAbsoluteImageUrl(
+ name={currentWorkspace?.displayName || ''}
+ src={getAbsoluteImageUrl(
currentWorkspace?.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
/>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx
index c0e8f6335fb..cd73357a71b 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx
@@ -109,8 +109,8 @@ export const MultiWorkspaceDropdownDefaultComponents = () => {
<DropdownMenuHeaderLeftComponent
Avatar={
<Avatar
- placeholder={currentWorkspace?.displayName || ''}
- avatarUrl={getAbsoluteImageUrl(
+ name={currentWorkspace?.displayName || ''}
+ src={getAbsoluteImageUrl(
currentWorkspace?.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
/>
@@ -174,8 +174,8 @@ export const MultiWorkspaceDropdownDefaultComponents = () => {
text={availableWorkspace.displayName ?? t`(No name)`}
avatar={
<Avatar
- placeholder={availableWorkspace.displayName || ''}
- avatarUrl={getAbsoluteImageUrl(
+ name={availableWorkspace.displayName || ''}
+ src={getAbsoluteImageUrl(
availableWorkspace.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
/>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem.tsx
index 2736411ee5d..a226d1b5260 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem.tsx
@@ -49,8 +49,8 @@ export const AvailableWorkspaceItem = ({
text={availableWorkspace.displayName ?? t`(No name)`}
avatar={
<Avatar
- placeholder={availableWorkspace.displayName || ''}
- avatarUrl={getAbsoluteImageUrl(
+ name={availableWorkspace.displayName || ''}
+ src={getAbsoluteImageUrl(
availableWorkspace.logo ?? DEFAULT_WORKSPACE_LOGO,
)}
/>
diff --git a/packages/twenty-front/src/modules/workspace-member/components/WorkspaceMemberAvatarStack.tsx b/packages/twenty-front/src/modules/workspace-member/components/WorkspaceMemberAvatarStack.tsx
index 7bdac8b4474..9090c431822 100644
--- a/packages/twenty-front/src/modules/workspace-member/components/WorkspaceMemberAvatarStack.tsx
+++ b/packages/twenty-front/src/modules/workspace-member/components/WorkspaceMemberAvatarStack.tsx
@@ -99,11 +99,11 @@ export const WorkspaceMemberAvatarStack = ({
return (
<StyledAvatarContainer key={workspaceMember.id}>
<Avatar
- avatarUrl={getAbsoluteImageUrl(workspaceMember.avatarUrl)}
- placeholder={displayName}
- placeholderColorSeed={workspaceMember.id}
+ src={getAbsoluteImageUrl(workspaceMember.avatarUrl)}
+ name={displayName}
+ colorSeed={workspaceMember.id}
size="md"
- type="rounded"
+ shape="circle"
/>
</StyledAvatarContainer>
);
diff --git a/packages/twenty-front/src/pages/onboarding/InstallAppsContent.tsx b/packages/twenty-front/src/pages/onboarding/InstallAppsContent.tsx
index e934affe627..63a055fc244 100644
--- a/packages/twenty-front/src/pages/onboarding/InstallAppsContent.tsx
+++ b/packages/twenty-front/src/pages/onboarding/InstallAppsContent.tsx
@@ -160,11 +160,11 @@ export const InstallAppsContent = ({
return (
<StyledAppRow key={app.universalIdentifier}>
<Avatar
- avatarUrl={getAbsoluteImageUrl(app.logoUrl)}
- placeholder={labelText}
- placeholderColorSeed={app.universalIdentifier}
+ src={getAbsoluteImageUrl(app.logoUrl)}
+ name={labelText}
+ colorSeed={app.universalIdentifier}
size="lg"
- type="squared"
+ shape="square"
/>
<StyledAppText>
<StyledAppLabel>{labelText}</StyledAppLabel>
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx
index 6ae2f430b48..789e3547638 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx
@@ -100,11 +100,12 @@ export const SettingsAdminApplicationRegistrationDetail = () => {
title={registration.name}
icon={
<Avatar
- type="app"
+ shape="square"
+ variant="outline"
size="md"
- avatarUrl={getAbsoluteImageUrl(registration.logoUrl ?? undefined)}
- placeholder={registration.name}
- placeholderColorSeed={registration.name}
+ src={getAbsoluteImageUrl(registration.logoUrl ?? undefined)}
+ name={registration.name}
+ colorSeed={registration.name}
/>
}
links={[
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx
index b10b668a3e0..3a52aa56f01 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx
@@ -144,10 +144,10 @@ export const SettingsAdminUserDetail = () => {
title={displayName}
icon={
<Avatar
- placeholder={displayName}
- placeholderColorSeed={user?.id}
+ name={displayName}
+ colorSeed={user?.id}
size="md"
- type="rounded"
+ shape="circle"
/>
}
links={[
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
index 79dc638a1af..f02987e24fc 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
@@ -211,9 +211,9 @@ export const SettingsAdminWorkspaceDetail = () => {
title={workspaceName}
icon={
<Avatar
- avatarUrl={getAbsoluteImageUrl(workspaceLogo)}
- placeholder={workspaceName}
- placeholderColorSeed={workspace?.id}
+ src={getAbsoluteImageUrl(workspaceLogo)}
+ name={workspaceName}
+ colorSeed={workspace?.id}
size="md"
/>
}
@@ -283,14 +283,14 @@ export const SettingsAdminWorkspaceDetail = () => {
overflow="hidden"
>
<Avatar
- avatarUrl={getAbsoluteImageUrl(user.avatarUrl)}
- placeholder={
+ src={getAbsoluteImageUrl(user.avatarUrl)}
+ name={
`${user.firstName || ''} ${user.lastName || ''}`.trim() ||
user.email
}
- placeholderColorSeed={user.id}
+ colorSeed={user.id}
size="md"
- type="rounded"
+ shape="circle"
/>
<OverflowingTextWithTooltip
text={
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolIcon.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolIcon.tsx
index 5807d3118d1..5155bd5f9ae 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolIcon.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolIcon.tsx
@@ -96,10 +96,10 @@ export const SettingsToolIcon = ({
if (isDefined(application) && isDefined(marketplaceApp?.logoUrl)) {
return (
<Avatar
- avatarUrl={getAbsoluteImageUrl(marketplaceApp.logoUrl)}
- placeholder={application.name}
- placeholderColorSeed={application.name}
- type="squared"
+ src={getAbsoluteImageUrl(marketplaceApp.logoUrl)}
+ name={application.name}
+ colorSeed={application.name}
+ shape="square"
size="xs"
/>
);
@@ -108,9 +108,9 @@ export const SettingsToolIcon = ({
if (isDefined(application)) {
return (
<Avatar
- placeholder={application.name}
- placeholderColorSeed={application.name}
- type="squared"
+ name={application.name}
+ colorSeed={application.name}
+ shape="square"
size="xs"
/>
);
diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx
index a4d11f62dfe..dc891293a32 100644
--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx
@@ -99,11 +99,12 @@ export const SettingsApplicationRegistrationDetails = () => {
title={registration.name}
icon={
<Avatar
- type="app"
+ shape="square"
+ variant="outline"
size="md"
- avatarUrl={getAbsoluteImageUrl(registration.logoUrl ?? undefined)}
- placeholder={registration.name}
- placeholderColorSeed={registration.name}
+ src={getAbsoluteImageUrl(registration.logoUrl ?? undefined)}
+ name={registration.name}
+ colorSeed={registration.name}
/>
}
tag={<Tag color="gray">{t`Owner`}</Tag>}
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
index 06b9aa778f1..c0629a2c751 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationGeneralInfo.tsx
@@ -119,8 +119,8 @@ export const SettingsApplicationRegistrationGeneralInfo = ({
clickable={false}
leftComponent={
<AvatarOrIcon
- avatarType="rounded"
- avatarUrl={getAbsoluteImageUrl(ownerWorkspace?.logo ?? undefined)}
+ shape="circle"
+ src={getAbsoluteImageUrl(ownerWorkspace?.logo ?? undefined)}
/>
}
label={ownerWorkspace.displayName}
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationInstalledWorkspaces.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationInstalledWorkspaces.tsx
index 8311fcb239a..5cf85b87f18 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationInstalledWorkspaces.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationRegistrationInstalledWorkspaces.tsx
@@ -170,9 +170,9 @@ export const SettingsApplicationRegistrationInstalledWorkspaces = ({
overflow="hidden"
>
<Avatar
- avatarUrl={getAbsoluteImageUrl(workspace.logo ?? undefined)}
- placeholder={workspace.displayName ?? '—'}
- placeholderColorSeed={workspace.id}
+ src={getAbsoluteImageUrl(workspace.logo ?? undefined)}
+ name={workspace.displayName ?? '—'}
+ colorSeed={workspace.id}
size="md"
/>
<OverflowingTextWithTooltip
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsAvailableApplicationCard.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsAvailableApplicationCard.tsx
index b986fe2e083..ba780dd3057 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsAvailableApplicationCard.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsAvailableApplicationCard.tsx
@@ -61,11 +61,11 @@ export const SettingsAvailableApplicationCard = ({
<Card rounded fullWidth>
<StyledSettingsCardContent alignItems="flex-start" fullHeight>
<Avatar
- avatarUrl={getAbsoluteImageUrl(application.logoUrl || null)}
- placeholder={application.name}
- placeholderColorSeed={application.name}
+ src={getAbsoluteImageUrl(application.logoUrl || null)}
+ name={application.name}
+ colorSeed={application.name}
size="lg"
- type="squared"
+ shape="square"
/>
<div>
<StyledSettingsCardTitle>
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationConnectionsSection.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationConnectionsSection.tsx
index 9d460b7ae98..5bc313ef8f4 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationConnectionsSection.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationConnectionsSection.tsx
@@ -71,9 +71,10 @@ export const SettingsApplicationConnectionsSection = ({
adornment={
isNonEmptyString(provider.logoUrl) ? (
<Avatar
- type="app"
- avatarUrl={getAbsoluteImageUrl(provider.logoUrl)}
- placeholder={provider.displayName}
+ shape="square"
+ variant="outline"
+ src={getAbsoluteImageUrl(provider.logoUrl)}
+ name={provider.displayName}
/>
) : undefined
}
diff --git a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
index 9288f26ed9a..988b5210826 100644
--- a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
@@ -116,10 +116,10 @@ export const SettingsUsageUserDetail = () => {
<SettingsPageContainer>
<StyledUserHeader>
<Avatar
- type="rounded"
+ shape="circle"
size="xl"
- placeholder={displayName}
- placeholderColorSeed={userWorkspaceId}
+ name={displayName}
+ colorSeed={userWorkspaceId}
/>
<StyledUserInfo>
<StyledUserName>{displayName}</StyledUserName>
diff --git a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx
index 890353bb3d2..83102de7fc2 100644
--- a/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx
+++ b/packages/twenty-front/src/pages/settings/members/tabs/SettingsWorkspaceMembersTeamTab.tsx
@@ -249,12 +249,10 @@ export const SettingsWorkspaceMembersTeamTab = () => {
<TableCell>
<StyledIconWrapper>
<Avatar
- avatarUrl={getAbsoluteImageUrl(
- workspaceMember.avatarUrl,
- )}
- placeholderColorSeed={workspaceMember.id}
- placeholder={workspaceMember.name.firstName ?? ''}
- type="rounded"
+ src={getAbsoluteImageUrl(workspaceMember.avatarUrl)}
+ colorSeed={workspaceMember.id}
+ name={workspaceMember.name.firstName ?? ''}
+ shape="circle"
size="sm"
/>
</StyledIconWrapper>
diff --git a/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss b/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss
index f2c9402d6b4..2086ca1cfd2 100644
--- a/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss
+++ b/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss
@@ -1,68 +1,71 @@
// Size values mirror AVATAR_PROPERTIES_BY_SIZE (constants/AvatarPropertiesBySize.ts)
.root {
+ @include focus-ring;
+ padding: 0;
+ font-family: inherit;
align-items: center;
flex-shrink: 0;
overflow: hidden;
user-select: none;
border-radius: var(--t-border-radius-xs);
- border: var(--avatar-border, none);
+ border: var(--tw-avatar-border, none);
box-sizing: border-box;
display: flex;
justify-content: center;
- color: var(--avatar-color);
- background: var(--avatar-background);
+ color: var(--tw-avatar-color);
+ background: var(--tw-avatar-background);
- &[data-type='icon'] {
+ &[data-shape='rounded-square'] {
border-radius: var(--t-border-radius-sm);
}
- &[data-type='rounded'] {
+ &[data-shape='circle'] {
border-radius: 50%;
corner-shape: round;
}
- &[data-clickable] {
+ &[data-clickable]:not([data-disabled]) {
cursor: pointer;
}
@include hover-capable {
- &[data-clickable]:hover {
+ &[data-clickable]:not([data-disabled]):hover {
box-shadow: 0 0 0 4px var(--t-background-transparent-light);
}
}
}
-.xl {
+.root[data-size='xl'] {
font-size: 16px;
- height: 40px;
- width: 40px;
+ block-size: 40px;
+ inline-size: 40px;
}
-.lg {
+.root[data-size='lg'] {
font-size: 13px;
- height: 24px;
- width: 24px;
+ block-size: 24px;
+ inline-size: 24px;
}
-.md {
+.root[data-size='md'] {
font-size: 12px;
- height: 16px;
- width: 16px;
+ block-size: 16px;
+ inline-size: 16px;
}
-.sm {
+.root[data-size='sm'] {
font-size: 10px;
- height: 14px;
- width: 14px;
+ block-size: 14px;
+ inline-size: 14px;
}
-.xs {
+.root[data-size='xs'] {
font-size: 8px;
- height: 12px;
- width: 12px;
+ block-size: 12px;
+ inline-size: 12px;
}
-.pulsing {
+.root[data-pulsing] {
animation: avatarPulsing 0.8s ease-in-out infinite alternate;
}
@@ -76,20 +79,24 @@
}
@media (prefers-reduced-motion: reduce) {
- .pulsing {
+ .root[data-pulsing] {
animation: none;
opacity: 1;
}
}
.image {
- background-position: center;
- background-repeat: no-repeat;
- background-size: cover;
- height: 100%;
- width: 100%;
+ object-fit: cover;
+ block-size: 100%;
+ inline-size: 100%;
}
-
-.placeholderChar {
- font-weight: 500;
+.fallback {
+ font-weight: var(--t-font-weight-medium);
+}
+.icon {
+ display: flex;
+ & > svg {
+ inline-size: calc(var(--t-icon-size-xl) * 1px);
+ block-size: calc(var(--t-icon-size-xl) * 1px);
+ }
}
diff --git a/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss.d.ts b/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss.d.ts
index 709f85fca78..ba095dcb59e 100644
--- a/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss.d.ts
+++ b/packages/twenty-ui/src/data-display/Avatar/Avatar.module.scss.d.ts
@@ -1,12 +1,7 @@
declare const classNames: {
readonly root: 'root';
- readonly xl: 'xl';
- readonly lg: 'lg';
- readonly md: 'md';
- readonly sm: 'sm';
- readonly xs: 'xs';
- readonly pulsing: 'pulsing';
readonly image: 'image';
- readonly placeholderChar: 'placeholderChar';
+ readonly fallback: 'fallback';
+ readonly icon: 'icon';
};
export default classNames;
diff --git a/packages/twenty-ui/src/data-display/Avatar/Avatar.tsx b/packages/twenty-ui/src/data-display/Avatar/Avatar.tsx
index 76e1f8eb4f5..45387ad5a03 100644
--- a/packages/twenty-ui/src/data-display/Avatar/Avatar.tsx
+++ b/packages/twenty-ui/src/data-display/Avatar/Avatar.tsx
@@ -1,163 +1,129 @@
-import { isNonEmptyString, isNull } from '@sniptt/guards';
-import { clsx } from 'clsx';
-import { useState } from 'react';
+import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
+import { Button as ButtonPrimitive } from '@base-ui/react/button';
+import { type CSSProperties } from 'react';
-import { handleClickableElementKeyDown } from '@ui/accessibility/utils/handleClickableElementKeyDown';
-import { AvatarImageLoadErrorEffect } from '@ui/data-display/Avatar/internal/AvatarImageLoadErrorEffect';
-import { type AvatarSize } from '@ui/data-display/Avatar/types/AvatarSize';
-import { type AvatarType } from '@ui/data-display/Avatar/types/AvatarType';
-import { type IconComponent } from '@ui/icon/types/IconComponent';
import { useTheme } from '@ui/theme-constants';
import { stringToThemeColorP3String } from '@ui/utilities';
-import { type Nullable } from '@ui/utilities/types/Nullable';
import { isDefined } from '@ui/utilities/utils/isDefined';
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
import styles from './Avatar.module.scss';
-
-export type AvatarProps = {
- avatarUrl?: string | null;
- className?: string;
- size?: AvatarSize;
- placeholder: string | undefined;
- placeholderColorSeed?: string;
- Icon?: IconComponent;
- iconColor?: string;
- type?: Nullable<AvatarType>;
- color?: string;
- backgroundColor?: string;
- borderColor?: string;
- pulsing?: boolean;
- onClick?: () => void;
-};
+import { type AvatarProps } from './types/AvatarProps';
export const Avatar = ({
- avatarUrl,
- className,
+ src,
+ name,
+ colorSeed = name,
size = 'md',
- placeholder,
- placeholderColorSeed = placeholder,
- Icon,
- iconColor,
- onClick,
- type = 'squared',
+ shape = 'square',
+ variant = 'soft',
+ icon,
color,
backgroundColor,
borderColor,
pulsing = false,
+ disabled = false,
+ nativeButton = true,
+ onClick,
+ className,
+ style,
+ render,
+ 'aria-label': ariaLabel,
+ ...props
}: AvatarProps) => {
const theme = useTheme();
-
- const [erroredAvatarImageURI, setErroredAvatarImageURI] = useState<
- string | null
- >(null);
-
- const avatarImageURI = isNonEmptyString(avatarUrl) ? avatarUrl : null;
-
- const avatarImageFailedToLoad =
- isNonEmptyString(avatarImageURI) &&
- erroredAvatarImageURI === avatarImageURI;
-
- const placeholderFirstChar = placeholder?.trim()?.charAt(0);
- const isPlaceholderFirstCharEmpty =
- !placeholderFirstChar || placeholderFirstChar === '';
- const placeholderChar = placeholderFirstChar?.toUpperCase() || '-';
-
- const showPlaceholder = isNull(avatarImageURI) || avatarImageFailedToLoad;
-
- const fixedColor = isPlaceholderFirstCharEmpty
- ? theme.font.color.tertiary
- : (color ??
+ const initial = name?.trim().charAt(0).toUpperCase();
+ const fallbackColor = initial
+ ? (color ??
stringToThemeColorP3String({
- string: placeholderColorSeed ?? '',
+ string: colorSeed ?? '',
variant: 12,
theme,
- }));
- const fixedBackgroundColor = isPlaceholderFirstCharEmpty
- ? theme.background.transparent.light
- : (backgroundColor ??
+ }))
+ : theme.font.color.tertiary;
+ const fallbackBackground = initial
+ ? (backgroundColor ??
stringToThemeColorP3String({
- string: placeholderColorSeed ?? '',
- variant: type === 'app' ? 5 : 4,
+ string: colorSeed ?? '',
+ variant: variant === 'outline' ? 5 : 4,
theme,
- }));
-
- const fixedBorderColor =
- type === 'app'
- ? (borderColor ??
- (isPlaceholderFirstCharEmpty
- ? undefined
- : stringToThemeColorP3String({
- string: placeholderColorSeed ?? '',
- variant: 6,
- theme,
- })))
- : undefined;
-
- const showBackgroundColor = showPlaceholder;
-
- const showBorderColor = showPlaceholder;
-
- const appliedBorderColor = showBorderColor ? fixedBorderColor : undefined;
-
- const avatarStyle = {
- '--avatar-color': fixedColor,
- '--avatar-background': Icon
- ? 'inherit'
- : showBackgroundColor
- ? fixedBackgroundColor
- : 'none',
- ...(type === 'app' && appliedBorderColor
- ? { '--avatar-border': `1px solid ${appliedBorderColor}` }
- : {}),
- } as React.CSSProperties;
-
- const avatarClassName = clsx(
- styles.root,
- styles[size],
- pulsing && styles.pulsing,
- className,
- );
-
- const isClickable = isDefined(onClick);
-
- const clickableAriaLabel = isNonEmptyString(placeholder)
- ? placeholder
- : 'Avatar';
+ }))
+ : theme.background.transparent.light;
+ const fallbackBorder =
+ borderColor ??
+ (initial
+ ? stringToThemeColorP3String({
+ string: colorSeed ?? '',
+ variant: 6,
+ theme,
+ })
+ : undefined);
+ const isInteractive = isDefined(onClick);
+ const hasIcon = isDefined(icon) && typeof icon !== 'boolean' && icon !== '';
return (
- // oxlint-disable-next-line jsx-a11y/no-static-element-interactions
- <div
- className={avatarClassName}
- data-type={type ?? undefined}
- data-clickable={isClickable || undefined}
- role={isClickable ? 'button' : undefined}
- tabIndex={isClickable ? 0 : undefined}
- aria-label={isClickable ? clickableAriaLabel : undefined}
+ <AvatarPrimitive.Root
+ {...props}
onClick={onClick}
- onKeyDown={isClickable ? handleClickableElementKeyDown : undefined}
- style={avatarStyle}
+ aria-label={
+ ariaLabel ?? (isInteractive ? name?.trim() || 'Avatar' : undefined)
+ }
+ data-size={size}
+ data-shape={shape}
+ data-pulsing={pulsing || undefined}
+ data-disabled={disabled || undefined}
+ data-clickable={isInteractive || undefined}
+ className={mergeClassNames(styles.root, className)}
+ style={(state) =>
+ ({
+ '--tw-avatar-color': fallbackColor,
+ '--tw-avatar-background': hasIcon
+ ? 'inherit'
+ : state.imageLoadingStatus === 'loaded'
+ ? 'none'
+ : fallbackBackground,
+ '--tw-avatar-border':
+ variant === 'outline' &&
+ state.imageLoadingStatus !== 'loaded' &&
+ fallbackBorder
+ ? `1px solid ${fallbackBorder}`
+ : 'none',
+ ...(typeof style === 'function' ? style(state) : style),
+ }) as CSSProperties
+ }
+ render={
+ isInteractive
+ ? (rootProps, state) => (
+ <ButtonPrimitive
+ {...rootProps}
+ disabled={disabled}
+ nativeButton={nativeButton}
+ render={
+ typeof render === 'function'
+ ? (buttonProps) => render(buttonProps, state)
+ : render
+ }
+ />
+ )
+ : render
+ }
>
- {isNonEmptyString(avatarImageURI) && (
- <AvatarImageLoadErrorEffect
- avatarImageURI={avatarImageURI}
- onImageLoadError={setErroredAvatarImageURI}
- />
- )}
- {Icon ? (
- <Icon
- color={iconColor ? iconColor : 'currentColor'}
- size={theme.icon.size.xl}
- />
- ) : showPlaceholder ? (
- <span className={styles.placeholderChar}>{placeholderChar}</span>
+ {hasIcon ? (
+ <span className={styles.icon} aria-hidden>
+ {icon}
+ </span>
) : (
- <div
- className={styles.image}
- style={{
- backgroundImage: `url("${CSS.escape(avatarImageURI)}")`,
- }}
- />
+ <>
+ <AvatarPrimitive.Image
+ src={src ?? undefined}
+ alt=""
+ className={styles.image}
+ />
+ <AvatarPrimitive.Fallback className={styles.fallback} aria-hidden>
+ {initial || '-'}
+ </AvatarPrimitive.Fallback>
+ </>
)}
- </div>
+ </AvatarPrimitive.Root>
);
};
diff --git a/packages/twenty-ui/src/data-display/Avatar/__stories__/Avatar.stories.tsx b/packages/twenty-ui/src/data-display/Avatar/__stories__/Avatar.stories.tsx
index 5aeab7fea1d..86797670bb4 100644
--- a/packages/twenty-ui/src/data-display/Avatar/__stories__/Avatar.stories.tsx
+++ b/packages/twenty-ui/src/data-display/Avatar/__stories__/Avatar.stories.tsx
@@ -1,36 +1,69 @@
+import { useState } from 'react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { expect, fn, userEvent, within } from 'storybook/test';
+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
-import { AVATAR_URL_MOCK, ComponentDecorator } from '@ui/testing';
+import {
+ AVATAR_URL_MOCK,
+ ComponentDecorator,
+ CatalogDecorator,
+ type CatalogStory,
+ A11Y_DEFER_COLOR_CONTRAST,
+} from '@ui/testing';
import { Avatar } from '@ui/data-display/Avatar/Avatar';
+import { type AvatarShape } from '@ui/data-display/Avatar/types/AvatarShape';
+import { IconUser } from '@ui/icon';
const meta: Meta<typeof Avatar> = {
title: 'UI/Data Display/Avatar',
component: Avatar,
- decorators: [ComponentDecorator],
args: {
- avatarUrl: AVATAR_URL_MOCK,
+ src: AVATAR_URL_MOCK,
size: 'md',
- placeholder: 'E',
- type: 'rounded',
+ name: 'E',
+ shape: 'circle',
},
};
export default meta;
type Story = StoryObj<typeof Avatar>;
-export const Rounded: Story = {};
+export const Rounded: Story = { decorators: [ComponentDecorator] };
export const Squared: Story = {
- args: { type: 'squared' },
+ decorators: [ComponentDecorator],
+ args: { shape: 'square' },
+};
+
+export const IconTile: Story = {
+ decorators: [ComponentDecorator],
+ args: {
+ src: undefined,
+ shape: 'rounded-square',
+ icon: <IconUser />,
+ role: 'img',
+ 'aria-label': 'Workspace icon',
+ },
+ play: async ({ canvasElement }) => {
+ const iconTile = within(canvasElement).getByRole('img', {
+ name: 'Workspace icon',
+ });
+ const computedStyle = getComputedStyle(iconTile);
+
+ await expect(iconTile).toBeVisible();
+ await expect(computedStyle.borderRadius).toBe(
+ computedStyle.getPropertyValue('--t-border-radius-sm').trim(),
+ );
+ },
};
export const NoAvatarPictureRounded: Story = {
- args: { avatarUrl: '' },
+ decorators: [ComponentDecorator],
+ args: { src: '' },
};
export const NoAvatarPictureSquared: Story = {
+ decorators: [ComponentDecorator],
args: {
...NoAvatarPictureRounded.args,
...Squared.args,
@@ -38,18 +71,21 @@ export const NoAvatarPictureSquared: Story = {
};
export const App: Story = {
+ decorators: [ComponentDecorator],
args: {
- type: 'app',
- avatarUrl: '',
- placeholder: 'Acme',
- placeholderColorSeed: 'acme-app',
+ shape: 'square',
+ variant: 'outline',
+ src: '',
+ name: 'Acme',
+ colorSeed: 'acme-app',
},
};
export const ImageFailingToLoadFallsBackToPlaceholder: Story = {
+ decorators: [ComponentDecorator],
args: {
- avatarUrl: 'data:image/png;base64,not-a-valid-image',
- placeholder: 'Eldritch',
+ src: 'data:image/png;base64,not-a-valid-image',
+ name: 'Eldritch',
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
@@ -61,6 +97,7 @@ export const ImageFailingToLoadFallsBackToPlaceholder: Story = {
};
export const NotClickable: Story = {
+ decorators: [ComponentDecorator],
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
@@ -71,12 +108,13 @@ export const NotClickable: Story = {
const clickFromEnterKey = fn();
export const ClickableActivatesOnEnter: Story = {
- args: { placeholder: 'Eldritch', onClick: clickFromEnterKey },
+ decorators: [ComponentDecorator],
+ args: { name: 'Eldritch', onClick: clickFromEnterKey },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const avatar = await canvas.findByRole('button', { name: 'Eldritch' });
- await expect(avatar).toHaveAttribute('tabindex', '0');
+ await expect(avatar.tagName).toBe('BUTTON');
avatar.focus();
await userEvent.keyboard('{Enter}');
@@ -88,7 +126,8 @@ export const ClickableActivatesOnEnter: Story = {
const clickFromSpaceKey = fn();
export const ClickableActivatesOnSpace: Story = {
- args: { placeholder: 'Eldritch', onClick: clickFromSpaceKey },
+ decorators: [ComponentDecorator],
+ args: { name: 'Eldritch', onClick: clickFromSpaceKey },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
@@ -102,7 +141,8 @@ export const ClickableActivatesOnSpace: Story = {
};
export const ClickableWithoutPlaceholderIsStillLabelled: Story = {
- args: { placeholder: '', onClick: fn() },
+ decorators: [ComponentDecorator],
+ args: { name: '', onClick: fn() },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
@@ -111,3 +151,104 @@ export const ClickableWithoutPlaceholderIsStillLabelled: Story = {
).toBeVisible();
},
};
+
+export const Catalog: CatalogStory<Story, typeof Avatar> = {
+ args: { src: undefined, name: 'Jane' },
+ decorators: [CatalogDecorator],
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ catalog: {
+ dimensions: [
+ {
+ name: 'size',
+ values: ['xs', 'sm', 'md', 'lg', 'xl'],
+ props: (size: 'xs' | 'sm' | 'md' | 'lg' | 'xl') => ({ size }),
+ },
+ {
+ name: 'shape',
+ values: ['square', 'rounded-square', 'circle'],
+ props: (shape: AvatarShape) => ({ shape }),
+ },
+ {
+ name: 'variant',
+ values: ['soft', 'outline'],
+ props: (variant: 'soft' | 'outline') => ({ variant }),
+ },
+ ],
+ options: { elementContainer: { style: { width: 48 } } },
+ },
+ },
+};
+
+export const CatalogDark: typeof Catalog = {
+ ...Catalog,
+ tags: ['!autodocs'],
+ globals: { colorScheme: 'dark' },
+};
+
+const VALID_IMAGE =
+ 'data:image/svg+xml,' +
+ encodeURIComponent(
+ '<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><rect width="40" height="40" fill="blue"/></svg>',
+ );
+const INVALID_IMAGE = 'data:image/png;base64,invalid';
+
+const ImageChangesExample = () => {
+ const [src, setSrc] = useState<string | undefined>(VALID_IMAGE);
+ return (
+ <>
+ <a href="#jane">
+ <Avatar src={src} name="Jane" size="xl" />
+ Jane
+ </a>
+ <button type="button" onClick={() => setSrc(INVALID_IMAGE)}>
+ Break image
+ </button>
+ <button type="button" onClick={() => setSrc(VALID_IMAGE)}>
+ Restore image
+ </button>
+ <button type="button" onClick={() => setSrc(undefined)}>
+ Remove image
+ </button>
+ </>
+ );
+};
+
+export const ImageChanges: Story = {
+ decorators: [ComponentDecorator],
+ render: () => <ImageChangesExample />,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ await expect(await canvas.findByRole('presentation')).toBeVisible();
+ const recordLink = canvas.getByRole('link', { name: 'Jane' });
+ await expect(recordLink).toHaveAccessibleName('Jane');
+ await userEvent.click(canvas.getByRole('button', { name: 'Break image' }));
+ await expect(await canvas.findByText('J')).toBeVisible();
+ await expect(recordLink).toHaveAccessibleName('Jane');
+ await waitFor(() =>
+ expect(canvas.queryByRole('presentation')).not.toBeInTheDocument(),
+ );
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Restore image' }),
+ );
+ await expect(await canvas.findByRole('presentation')).toBeVisible();
+ await expect(recordLink).toHaveAccessibleName('Jane');
+ await userEvent.click(canvas.getByRole('button', { name: 'Remove image' }));
+ await expect(await canvas.findByText('J')).toBeVisible();
+ await expect(recordLink).toHaveAccessibleName('Jane');
+ },
+};
+
+export const Disabled: Story = {
+ decorators: [ComponentDecorator],
+ args: { name: 'Jane', src: undefined, disabled: true, onClick: fn() },
+ play: async ({ canvasElement, args }) => {
+ const avatar = within(canvasElement).getByRole('button', { name: 'Jane' });
+ await expect(avatar).toBeDisabled();
+ await userEvent.hover(avatar);
+ await expect(getComputedStyle(avatar).cursor).not.toBe('pointer');
+ await expect(getComputedStyle(avatar).boxShadow).toBe('none');
+ await userEvent.click(avatar);
+ await expect(args.onClick).not.toHaveBeenCalled();
+ },
+};
diff --git a/packages/twenty-ui/src/data-display/Avatar/__tests__/Avatar.test.tsx b/packages/twenty-ui/src/data-display/Avatar/__tests__/Avatar.test.tsx
new file mode 100644
index 00000000000..1b83ada4121
--- /dev/null
+++ b/packages/twenty-ui/src/data-display/Avatar/__tests__/Avatar.test.tsx
@@ -0,0 +1,11 @@
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { Avatar } from '../Avatar';
+import styles from '../Avatar.module.scss';
+
+runComponentConformance({
+ name: 'Avatar',
+ element: <Avatar name="Jane" />,
+ ownClassName: styles.root,
+ refInstanceOf: HTMLSpanElement,
+});
diff --git a/packages/twenty-ui/src/data-display/Avatar/internal/AvatarImageLoadErrorEffect.tsx b/packages/twenty-ui/src/data-display/Avatar/internal/AvatarImageLoadErrorEffect.tsx
deleted file mode 100644
index 0d963e73102..00000000000
--- a/packages/twenty-ui/src/data-display/Avatar/internal/AvatarImageLoadErrorEffect.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { useEffect } from 'react';
-
-export type AvatarImageLoadErrorEffectProps = {
- avatarImageURI: string;
- onImageLoadError: (erroredImageURI: string) => void;
-};
-
-export const AvatarImageLoadErrorEffect = ({
- avatarImageURI,
- onImageLoadError,
-}: AvatarImageLoadErrorEffectProps) => {
- useEffect(() => {
- const probeImage = new Image();
- probeImage.onerror = () => {
- onImageLoadError(avatarImageURI);
- };
- probeImage.src = avatarImageURI;
-
- return () => {
- probeImage.onerror = null;
- probeImage.src = '';
- };
- }, [avatarImageURI, onImageLoadError]);
-
- return <></>;
-};
diff --git a/packages/twenty-ui/src/data-display/Avatar/types/AvatarProps.ts b/packages/twenty-ui/src/data-display/Avatar/types/AvatarProps.ts
new file mode 100644
index 00000000000..1e81a7de53f
--- /dev/null
+++ b/packages/twenty-ui/src/data-display/Avatar/types/AvatarProps.ts
@@ -0,0 +1,21 @@
+import { type Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
+import { type ReactNode } from 'react';
+
+import { type AvatarSize } from './AvatarSize';
+import { type AvatarShape } from './AvatarShape';
+
+export type AvatarProps = Omit<AvatarPrimitive.Root.Props, 'children'> & {
+ src?: string | null;
+ name?: string;
+ colorSeed?: string;
+ size?: AvatarSize;
+ shape?: AvatarShape;
+ variant?: 'soft' | 'outline';
+ icon?: ReactNode;
+ color?: string;
+ backgroundColor?: string;
+ borderColor?: string;
+ pulsing?: boolean;
+ disabled?: boolean;
+ nativeButton?: boolean;
+};
diff --git a/packages/twenty-ui/src/data-display/Avatar/types/AvatarShape.ts b/packages/twenty-ui/src/data-display/Avatar/types/AvatarShape.ts
new file mode 100644
index 00000000000..355bc09691c
--- /dev/null
+++ b/packages/twenty-ui/src/data-display/Avatar/types/AvatarShape.ts
@@ -0,0 +1 @@
+export type AvatarShape = 'square' | 'rounded-square' | 'circle';
diff --git a/packages/twenty-ui/src/data-display/Avatar/types/AvatarType.ts b/packages/twenty-ui/src/data-display/Avatar/types/AvatarType.ts
deleted file mode 100644
index 90bf7e685f8..00000000000
--- a/packages/twenty-ui/src/data-display/Avatar/types/AvatarType.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type AvatarType = 'squared' | 'rounded' | 'icon' | 'app';
diff --git a/packages/twenty-ui/src/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx b/packages/twenty-ui/src/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx
index a57dd7d3de3..72b713460b3 100644
--- a/packages/twenty-ui/src/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx
+++ b/packages/twenty-ui/src/data-display/AvatarGroup/__stories__/AvatarGroup.stories.tsx
@@ -1,8 +1,9 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { Avatar, type AvatarProps } from '@ui/data-display/Avatar/Avatar';
+import { Avatar } from '@ui/data-display/Avatar/Avatar';
+import { type AvatarProps } from '@ui/data-display/Avatar/types/AvatarProps';
import { type AvatarSize } from '@ui/data-display/Avatar/types/AvatarSize';
-import { type AvatarType } from '@ui/data-display/Avatar/types/AvatarType';
+import { type AvatarShape } from '@ui/data-display/Avatar/types/AvatarShape';
import {
A11Y_DEFER_COLOR_CONTRAST,
AVATAR_URL_MOCK,
@@ -16,11 +17,11 @@ import {
} from '@ui/data-display/AvatarGroup/AvatarGroup';
const makeAvatar = (userName: string, props: Partial<AvatarProps> = {}) => (
- <Avatar placeholder={userName} placeholderColorSeed={userName} {...props} />
+ <Avatar name={userName} colorSeed={userName} {...props} />
);
const getAvatars = (commonProps: Partial<AvatarProps> = {}) => [
- makeAvatar('Matthew', { avatarUrl: AVATAR_URL_MOCK, ...commonProps }),
+ makeAvatar('Matthew', { src: AVATAR_URL_MOCK, ...commonProps }),
makeAvatar('Sophie', commonProps),
makeAvatar('Jane', commonProps),
makeAvatar('Lily', commonProps),
@@ -56,8 +57,8 @@ export const Catalog: Story = {
},
{
name: 'types',
- values: ['rounded', 'squared'] as AvatarType[],
- props: (type: AvatarType) => ({ type }),
+ values: ['circle', 'square'] as AvatarShape[],
+ props: (shape: AvatarShape) => ({ shape }),
},
{
name: 'sizes',
diff --git a/packages/twenty-ui/src/data-display/AvatarOrIcon/AvatarOrIcon.tsx b/packages/twenty-ui/src/data-display/AvatarOrIcon/AvatarOrIcon.tsx
index 617722e5633..d9192d86361 100644
--- a/packages/twenty-ui/src/data-display/AvatarOrIcon/AvatarOrIcon.tsx
+++ b/packages/twenty-ui/src/data-display/AvatarOrIcon/AvatarOrIcon.tsx
@@ -2,32 +2,18 @@ import { isNonEmptyString } from '@sniptt/guards';
import { handleClickableElementKeyDown } from '@ui/accessibility/utils/handleClickableElementKeyDown';
import { Avatar } from '@ui/data-display/Avatar/Avatar';
-import { type AvatarType } from '@ui/data-display/Avatar/types/AvatarType';
-import { type IconComponent } from '@ui/icon/types/IconComponent';
import { useTheme } from '@ui/theme-constants';
-import { type Nullable } from '@ui/utilities';
import { isDefined } from '@ui/utilities/utils/isDefined';
import styles from './AvatarOrIcon.module.scss';
-
-export type AvatarOrIconProps = {
- placeholder?: string;
- avatarUrl?: string;
- avatarType?: Nullable<AvatarType>;
- Icon?: IconComponent;
- IconColor?: string;
- IconBackgroundColor?: string;
- isIconInverted?: boolean;
- placeholderColorSeed?: string;
- onClick?: () => void;
-};
+import { type AvatarOrIconProps } from './types/AvatarOrIconProps';
export const AvatarOrIcon = ({
Icon,
- placeholderColorSeed,
- avatarType,
- avatarUrl,
- placeholder,
+ colorSeed,
+ shape,
+ src,
+ name,
isIconInverted = false,
IconColor,
IconBackgroundColor,
@@ -38,19 +24,17 @@ export const AvatarOrIcon = ({
if (!isDefined(Icon)) {
return (
<Avatar
- avatarUrl={avatarUrl}
- placeholderColorSeed={placeholderColorSeed}
- placeholder={placeholder}
+ src={src}
+ colorSeed={colorSeed}
+ name={name}
size="sm"
- type={avatarType}
+ shape={shape ?? undefined}
onClick={onClick}
/>
);
}
- const accessibleLabel = isNonEmptyString(placeholder)
- ? placeholder
- : 'Avatar';
+ const accessibleLabel = isNonEmptyString(name) ? name : 'Avatar';
const iconContent =
isIconInverted || isDefined(IconBackgroundColor) ? (
diff --git a/packages/twenty-ui/src/data-display/AvatarOrIcon/__stories__/AvatarOrIcon.stories.tsx b/packages/twenty-ui/src/data-display/AvatarOrIcon/__stories__/AvatarOrIcon.stories.tsx
index 9a231b26c98..4f43ded0ed0 100644
--- a/packages/twenty-ui/src/data-display/AvatarOrIcon/__stories__/AvatarOrIcon.stories.tsx
+++ b/packages/twenty-ui/src/data-display/AvatarOrIcon/__stories__/AvatarOrIcon.stories.tsx
@@ -14,16 +14,16 @@ type Story = StoryObj<typeof AvatarOrIcon>;
export const Default: Story = {
args: {
- placeholder: 'JD',
- placeholderColorSeed: 'John Doe',
+ name: 'JD',
+ colorSeed: 'John Doe',
},
};
export const WithAvatar: Story = {
args: {
- avatarUrl: AVATAR_URL_MOCK,
- placeholder: 'JD',
- placeholderColorSeed: 'John Doe',
+ src: AVATAR_URL_MOCK,
+ name: 'JD',
+ colorSeed: 'John Doe',
},
};
@@ -49,8 +49,8 @@ export const WithInvertedIcon: Story = {
export const Clickable: Story = {
args: {
- placeholder: 'JD',
- placeholderColorSeed: 'John Doe',
+ name: 'JD',
+ colorSeed: 'John Doe',
onClick: () => alert('AvatarOrIcon clicked'),
},
};
@@ -59,7 +59,7 @@ export const ClickableIcon: Story = {
args: {
Icon: IconBuildingSkyscraper,
isIconInverted: true,
- placeholder: 'Company',
+ name: 'Company',
onClick: () => alert('Icon AvatarOrIcon clicked'),
},
};
diff --git a/packages/twenty-ui/src/data-display/AvatarOrIcon/types/AvatarOrIconProps.ts b/packages/twenty-ui/src/data-display/AvatarOrIcon/types/AvatarOrIconProps.ts
new file mode 100644
index 00000000000..e4209653583
--- /dev/null
+++ b/packages/twenty-ui/src/data-display/AvatarOrIcon/types/AvatarOrIconProps.ts
@@ -0,0 +1,16 @@
+import { type AvatarProps } from '@ui/data-display/Avatar/types/AvatarProps';
+import { type AvatarShape } from '@ui/data-display/Avatar/types/AvatarShape';
+import { type IconComponent } from '@ui/icon/types/IconComponent';
+import { type Nullable } from '@ui/utilities';
+
+export type AvatarOrIconProps = Pick<
+ AvatarProps,
+ 'src' | 'name' | 'colorSeed'
+> & {
+ shape?: Nullable<AvatarShape>;
+ Icon?: IconComponent;
+ IconColor?: string;
+ IconBackgroundColor?: string;
+ isIconInverted?: boolean;
+ onClick?: () => void;
+};
diff --git a/packages/twenty-ui/src/data-display/Chip/__stories__/Chip.stories.tsx b/packages/twenty-ui/src/data-display/Chip/__stories__/Chip.stories.tsx
index f3ac456b91b..cdef920cc32 100644
--- a/packages/twenty-ui/src/data-display/Chip/__stories__/Chip.stories.tsx
+++ b/packages/twenty-ui/src/data-display/Chip/__stories__/Chip.stories.tsx
@@ -43,12 +43,7 @@ export const WithLeftAvatar: Story = {
clickable: true,
variant: ChipVariant.Regular,
leftComponent: (
- <Avatar
- placeholder="JD"
- placeholderColorSeed="John Doe"
- size="sm"
- type="rounded"
- />
+ <Avatar name="JD" colorSeed="John Doe" size="sm" shape="circle" />
),
},
decorators: [ComponentDecorator],
@@ -70,9 +65,7 @@ export const EmptyLabel: Story = {
label: '',
clickable: true,
variant: ChipVariant.Regular,
- leftComponent: (
- <Avatar placeholder="?" placeholderColorSeed="empty" size="sm" />
- ),
+ leftComponent: <Avatar name="?" colorSeed="empty" size="sm" />,
},
decorators: [ComponentDecorator],
};
@@ -134,12 +127,7 @@ export const WithAvatarCatalog: CatalogStory<Story, typeof Chip> = {
clickable: true,
label: 'John Doe',
leftComponent: (
- <Avatar
- placeholder="JD"
- placeholderColorSeed="John Doe"
- size="sm"
- type="rounded"
- />
+ <Avatar name="JD" colorSeed="John Doe" size="sm" shape="circle" />
),
},
argTypes: {
@@ -193,12 +181,7 @@ export const WithRightComponentDivider: Story = {
variant: ChipVariant.Static,
clickable: false,
leftComponent: (
- <Avatar
- placeholder="D"
- placeholderColorSeed="document"
- size="sm"
- type="squared"
- />
+ <Avatar name="D" colorSeed="document" size="sm" shape="square" />
),
rightComponent: <IconX size={14} />,
rightComponentDivider: true,
diff --git a/packages/twenty-ui/src/data-display/LinkChip/__stories__/LinkChip.stories.tsx b/packages/twenty-ui/src/data-display/LinkChip/__stories__/LinkChip.stories.tsx
index e277147afca..d9431cdeaac 100644
--- a/packages/twenty-ui/src/data-display/LinkChip/__stories__/LinkChip.stories.tsx
+++ b/packages/twenty-ui/src/data-display/LinkChip/__stories__/LinkChip.stories.tsx
@@ -44,12 +44,7 @@ export const WithAvatar: Story = {
to: '/users/john-doe',
variant: ChipVariant.Regular,
leftComponent: (
- <Avatar
- placeholder="JD"
- placeholderColorSeed="John Doe"
- size="sm"
- type="rounded"
- />
+ <Avatar name="JD" colorSeed="John Doe" size="sm" shape="circle" />
),
},
decorators: [ComponentDecorator],
@@ -119,12 +114,7 @@ export const WithAvatarCatalog: CatalogStory<Story, typeof LinkChip> = {
label: 'John Doe',
to: '/users/john-doe',
leftComponent: (
- <Avatar
- placeholder="JD"
- placeholderColorSeed="John Doe"
- size="sm"
- type="rounded"
- />
+ <Avatar name="JD" colorSeed="John Doe" size="sm" shape="circle" />
),
},
argTypes: {
@@ -175,12 +165,7 @@ export const WithRightComponentDivider: Story = {
to: '/files/document.pdf',
variant: ChipVariant.Static,
leftComponent: (
- <Avatar
- placeholder="D"
- placeholderColorSeed="document"
- size="sm"
- type="squared"
- />
+ <Avatar name="D" colorSeed="document" size="sm" shape="square" />
),
rightComponent: <IconX size={14} />,
rightComponentDivider: true,
diff --git a/packages/twenty-ui/src/data-display/index.ts b/packages/twenty-ui/src/data-display/index.ts
index 3bd3eddc289..b2b12a10439 100644
--- a/packages/twenty-ui/src/data-display/index.ts
+++ b/packages/twenty-ui/src/data-display/index.ts
@@ -9,14 +9,14 @@
export type { AnimatedCheckmarkProps } from './AnimatedCheckmark/AnimatedCheckmark';
export { AnimatedCheckmark } from './AnimatedCheckmark/AnimatedCheckmark';
-export type { AvatarProps } from './Avatar/Avatar';
export { Avatar } from './Avatar/Avatar';
export { AVATAR_PROPERTIES_BY_SIZE } from './Avatar/constants/AvatarPropertiesBySize';
+export type { AvatarProps } from './Avatar/types/AvatarProps';
+export type { AvatarShape } from './Avatar/types/AvatarShape';
export type { AvatarSize } from './Avatar/types/AvatarSize';
-export type { AvatarType } from './Avatar/types/AvatarType';
export type { AvatarGroupProps } from './AvatarGroup/AvatarGroup';
export { AvatarGroup } from './AvatarGroup/AvatarGroup';
-export type { AvatarOrIconProps } from './AvatarOrIcon/AvatarOrIcon';
+export type { AvatarOrIconProps } from './AvatarOrIcon/types/AvatarOrIconProps';
export { AvatarOrIcon } from './AvatarOrIcon/AvatarOrIcon';
export type { CheckmarkProps } from './Checkmark/Checkmark';
export { Checkmark } from './Checkmark/Checkmark';
diff --git a/packages/twenty-ui/src/input/TabButton/parts/TabContent.tsx b/packages/twenty-ui/src/input/TabButton/parts/TabContent.tsx
index 5bf925eb0e3..96e80480703 100644
--- a/packages/twenty-ui/src/input/TabButton/parts/TabContent.tsx
+++ b/packages/twenty-ui/src/input/TabButton/parts/TabContent.tsx
@@ -42,7 +42,7 @@ export const TabContent = ({
{LeftIcon && (
<LeftIcon color={iconColor} size={theme.icon.size.md} aria-hidden />
)}
- {logo && <Avatar avatarUrl={logo} size="md" placeholder={title} />}
+ {logo && <Avatar src={logo} size="md" name={title} aria-hidden />}
{title}
{RightIcon && (
<RightIcon color={iconColor} size={theme.icon.size.md} aria-hidden />
diff --git a/packages/twenty-ui/src/navigation/MenuItemAvatar/MenuItemAvatar.tsx b/packages/twenty-ui/src/navigation/MenuItemAvatar/MenuItemAvatar.tsx
index 47f01ad2707..e1b87c35c6b 100644
--- a/packages/twenty-ui/src/navigation/MenuItemAvatar/MenuItemAvatar.tsx
+++ b/packages/twenty-ui/src/navigation/MenuItemAvatar/MenuItemAvatar.tsx
@@ -15,7 +15,7 @@ export type MenuItemAvatarProps = {
isTooltipOpen?: boolean;
avatar?: Pick<
AvatarProps,
- 'avatarUrl' | 'placeholderColorSeed' | 'placeholder' | 'size' | 'type'
+ 'src' | 'colorSeed' | 'name' | 'size' | 'shape'
> | null;
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
@@ -51,11 +51,11 @@ export const MenuItemAvatar = ({
LeftComponent={
isDefined(avatar) ? (
<Avatar
- placeholder={avatar.placeholder}
- avatarUrl={avatar.avatarUrl}
- placeholderColorSeed={avatar.placeholderColorSeed}
+ name={avatar.name}
+ src={avatar.src}
+ colorSeed={avatar.colorSeed}
size={avatar.size}
- type={avatar.type}
+ shape={avatar.shape}
/>
) : undefined
}
diff --git a/packages/twenty-ui/src/navigation/MenuItemMultiSelectAvatar/__stories__/MenuItemMultiSelectAvatar.stories.tsx b/packages/twenty-ui/src/navigation/MenuItemMultiSelectAvatar/__stories__/MenuItemMultiSelectAvatar.stories.tsx
index e23c8c49dd4..411507daae1 100644
--- a/packages/twenty-ui/src/navigation/MenuItemMultiSelectAvatar/__stories__/MenuItemMultiSelectAvatar.stories.tsx
+++ b/packages/twenty-ui/src/navigation/MenuItemMultiSelectAvatar/__stories__/MenuItemMultiSelectAvatar.stories.tsx
@@ -27,7 +27,7 @@ export const Default: Story = {
args: {
text: 'First option',
contextualText: 'Contextual text',
- avatar: <Avatar avatarUrl={AVATAR_URL_MOCK} placeholder="L" />,
+ avatar: <Avatar src={AVATAR_URL_MOCK} name="L" />,
},
decorators: [ComponentDecorator],
};
@@ -65,9 +65,9 @@ export const Catalog: CatalogStory<Story, typeof MenuItemMultiSelectAvatar> = {
values: [true, false],
props: (withAvatar: boolean) => ({
avatar: withAvatar ? (
- <Avatar avatarUrl={AVATAR_URL_MOCK} placeholder="L" />
+ <Avatar src={AVATAR_URL_MOCK} name="L" />
) : (
- <Avatar avatarUrl="" placeholder="L" />
+ <Avatar src="" name="L" />
),
}),
labels: (withAvatar: boolean) =>
diff --git a/packages/twenty-ui/src/navigation/MenuItemSelectAvatar/__stories__/MenuItemSelectAvatar.stories.tsx b/packages/twenty-ui/src/navigation/MenuItemSelectAvatar/__stories__/MenuItemSelectAvatar.stories.tsx
index 22c33af7cdd..a16ab500c82 100644
--- a/packages/twenty-ui/src/navigation/MenuItemSelectAvatar/__stories__/MenuItemSelectAvatar.stories.tsx
+++ b/packages/twenty-ui/src/navigation/MenuItemSelectAvatar/__stories__/MenuItemSelectAvatar.stories.tsx
@@ -25,7 +25,7 @@ export const Default: Story = {
args: {
text: 'First option',
contextualText: 'Contextual text',
- avatar: <Avatar avatarUrl={AVATAR_URL_MOCK} placeholder="L" />,
+ avatar: <Avatar src={AVATAR_URL_MOCK} name="L" />,
},
argTypes: {
className: { control: false },
@@ -55,9 +55,9 @@ export const Catalog: CatalogStory<Story, typeof MenuItemSelectAvatar> = {
values: [true, false],
props: (withAvatar: boolean) => ({
avatar: withAvatar ? (
- <Avatar avatarUrl={AVATAR_URL_MOCK} placeholder="L" />
+ <Avatar src={AVATAR_URL_MOCK} name="L" />
) : (
- <Avatar avatarUrl="" placeholder="L" />
+ <Avatar src="" name="L" />
),
}),
labels: (withAvatar: boolean) =>