Improve performance of demo workspace - Rename getImageAbsoluteURIOrBase64 function (#6282)
### Description 1. This PR is a continuation of a previous PR: https://github.com/twentyhq/twenty/pull/6201#pullrequestreview-2175601222 2. One test case was removed here: `packages/twenty-front/src/utils/image/__tests__/getImageAbsoluteURI.test.ts` because since we are not handling base64 images anymore, the result is the same of the last test case. Would you rather we update the test instead? ### Refs - #3514 - https://github.com/twentyhq/twenty/pull/6201 ### Demo https://www.loom.com/share/4f32b535c77a4d418e319b095d09452c?sid=df34adf8-b013-44ef-b794-d54846f52d2d Fixes #3514 --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
00fea17920
commit
fed12ddfcd
@ -16,7 +16,6 @@ import { Card } from '@/ui/layout/card/components/Card';
|
||||
import { CardContent } from '@/ui/layout/card/components/CardContent';
|
||||
import { TimelineCalendarEvent } from '~/generated-metadata/graphql';
|
||||
import { CalendarChannelVisibility } from '~/generated/graphql';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
type CalendarEventRowProps = {
|
||||
@ -163,7 +162,7 @@ export const CalendarEventRow = ({
|
||||
key={[participant.workspaceMemberId, participant.displayName]
|
||||
.filter(isDefined)
|
||||
.join('-')}
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(participant.avatarUrl)}
|
||||
avatarUrl={participant.avatarUrl}
|
||||
placeholder={
|
||||
participant.firstName && participant.lastName
|
||||
? `${participant.firstName} ${participant.lastName}`
|
||||
|
||||
@ -6,7 +6,6 @@ import {
|
||||
beautifyExactDateTime,
|
||||
beautifyPastDateRelativeToNow,
|
||||
} from '~/utils/date-utils';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
align-items: center;
|
||||
@ -60,7 +59,7 @@ export const CommentHeader = ({ comment, actionBar }: CommentHeaderProps) => {
|
||||
<StyledContainer>
|
||||
<StyledLeftContainer>
|
||||
<Avatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(avatarUrl)}
|
||||
avatarUrl={avatarUrl}
|
||||
size="md"
|
||||
placeholderColorSeed={author?.id}
|
||||
placeholder={authorName}
|
||||
|
||||
@ -4,7 +4,6 @@ import { Avatar } from 'twenty-ui';
|
||||
import { getDisplayNameFromParticipant } from '@/activities/emails/utils/getDisplayNameFromParticipant';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { RecordChip } from '@/object-record/components/RecordChip';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
|
||||
const StyledAvatar = styled(Avatar)`
|
||||
margin-right: ${({ theme }) => theme.spacing(1)};
|
||||
@ -74,7 +73,7 @@ export const ParticipantChip = ({
|
||||
) : (
|
||||
<StyledChip>
|
||||
<StyledAvatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(avatarUrl)}
|
||||
avatarUrl={avatarUrl}
|
||||
type="rounded"
|
||||
placeholder={displayName}
|
||||
size="sm"
|
||||
|
||||
@ -10,7 +10,6 @@ import { CardContent } from '@/ui/layout/card/components/CardContent';
|
||||
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
||||
import { MessageChannelVisibility, TimelineThread } from '~/generated/graphql';
|
||||
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
|
||||
const StyledCardContent = styled(CardContent)<{
|
||||
visibility: MessageChannelVisibility;
|
||||
@ -154,24 +153,20 @@ export const EmailThreadPreview = ({
|
||||
<StyledHeading unread={!thread.read}>
|
||||
<StyledParticipantsContainer>
|
||||
<Avatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(
|
||||
thread?.firstParticipant?.avatarUrl,
|
||||
)}
|
||||
avatarUrl={thread?.firstParticipant?.avatarUrl}
|
||||
placeholder={thread.firstParticipant.displayName}
|
||||
type="rounded"
|
||||
/>
|
||||
{thread?.lastTwoParticipants?.[0] && (
|
||||
<StyledAvatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(
|
||||
thread.lastTwoParticipants[0].avatarUrl,
|
||||
)}
|
||||
avatarUrl={thread.lastTwoParticipants[0].avatarUrl}
|
||||
placeholder={thread.lastTwoParticipants[0].displayName}
|
||||
type="rounded"
|
||||
/>
|
||||
)}
|
||||
{finalDisplayedName && (
|
||||
<StyledAvatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(finalAvatarUrl)}
|
||||
avatarUrl={finalAvatarUrl}
|
||||
placeholder={finalDisplayedName}
|
||||
type="rounded"
|
||||
color={isCountIcon ? GRAY_SCALE.gray50 : undefined}
|
||||
|
||||
@ -11,7 +11,6 @@ import {
|
||||
beautifyExactDateTime,
|
||||
beautifyPastDateRelativeToNow,
|
||||
} from '~/utils/date-utils';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
|
||||
const StyledAvatarContainer = styled.div`
|
||||
align-items: center;
|
||||
@ -154,9 +153,7 @@ export const TimelineActivity = ({
|
||||
<StyledTimelineItemContainer>
|
||||
<StyledAvatarContainer>
|
||||
<Avatar
|
||||
avatarUrl={getImageAbsoluteURIOrBase64(
|
||||
activityForTimeline.author?.avatarUrl,
|
||||
)}
|
||||
avatarUrl={activityForTimeline.author?.avatarUrl}
|
||||
placeholder={activityForTimeline.author?.name.firstName ?? ''}
|
||||
size="sm"
|
||||
type="rounded"
|
||||
|
||||
Reference in New Issue
Block a user