The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix-default-picture-url (#11779)
Guillim4833ee291469
diff --git a/packages/twenty-front/src/modules/settings/profile/components/ProfilePictureUploader.tsx b/packages/twenty-front/src/modules/settings/profile/components/ProfilePictureUploader.tsxindex 5da44b8e3ee..60cb35e263c 100644--- a/packages/twenty-front/src/modules/settings/profile/components/ProfilePictureUploader.tsx+++ b/packages/twenty-front/src/modules/settings/profile/components/ProfilePictureUploader.tsx@@ -5,9 +5,9 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembeimport { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';import { ImageInput } from '@/ui/input/components/ImageInput';+import { isDefined } from 'twenty-shared/utils';import { useUploadProfilePictureMutation } from '~/generated/graphql';import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';-import { isDefined } from 'twenty-shared/utils';export const ProfilePictureUploader = () => {const [uploadPicture, { loading: isUploading }] =diff --git a/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx b/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsxindex 7e298e6dda5..c8486c2ea65 100644--- a/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/ImageInput.tsx@@ -3,11 +3,11 @@ import styled from '@emotion/styled';import { Trans, useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';-import React from 'react';-import { REACT_APP_SERVER_BASE_URL } from '~/config';+import React, { useState } from 'react';import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';-import { Button } from 'twenty-ui/input';import { IconPhotoUp, IconTrash, IconUpload, IconX } from 'twenty-ui/display';+import { Button } from 'twenty-ui/input';+import { REACT_APP_SERVER_BASE_URL } from '~/config';const StyledContainer = styled.div`display: flex;@@ -113,6 +113,7 @@ export const ImageInput = ({const onUploadButtonClick = () => {hiddenFileInput.current?.click();};+ const [isPictureURLError, setIsPictureURLError] = useState(false);const pictureURI = isNonEmptyString(picture)? getImageAbsoluteURI({@@ -128,10 +129,13 @@ export const ImageInput = ({disabled={disabled}onClick={onUploadButtonClick}>- {pictureURI ? (+ {pictureURI && !isPictureURLError ? (<img- src={pictureURI || '/images/default-profile-picture.png'}+ src={pictureURI}alt="profile"+ onError={() => {+ setIsPictureURLError(true);+ }}/>) : (<IconPhotoUp size={theme.icon.size.lg} />