Fix broken image urls in Settings > Profile and Invite To Workspace Email (#8942)

Fixes #8601

We had 3 implementations of getImageAbsoluteURI: in twenty-front, in
twenty-ui and in twenty-emails. I was able to remove the one in
twenty-front but I could not remove it from twenty-emails as this is a
standalone for now. The vision is to introduce shared utils in a
twenty-shared package
This commit is contained in:
Charles Bochet
2024-12-07 14:57:32 +01:00
committed by GitHub
parent ab8ad46685
commit 99f53a5030
17 changed files with 72 additions and 84 deletions

View File

@ -1,8 +1,14 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import React, { useMemo } from 'react';
import { Button, IconPhotoUp, IconTrash, IconUpload, IconX } from 'twenty-ui';
import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI';
import React from 'react';
import {
Button,
IconPhotoUp,
IconTrash,
IconUpload,
IconX,
getImageAbsoluteURI,
} from 'twenty-ui';
import { isDefined } from '~/utils/isDefined';
const StyledContainer = styled.div`
@ -109,7 +115,7 @@ export const ImageInput = ({
hiddenFileInput.current?.click();
};
const pictureURI = useMemo(() => getImageAbsoluteURI(picture), [picture]);
const pictureURI = isDefined(picture) ? getImageAbsoluteURI(picture) : null;
return (
<StyledContainer className={className}>

View File

@ -1,5 +1,6 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { Workspaces } from '@/auth/states/workspaces';
import { useBuildWorkspaceUrl } from '@/domain-manager/hooks/useBuildWorkspaceUrl';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
@ -17,9 +18,8 @@ import {
IconChevronDown,
MenuItemSelectAvatar,
UndecoratedLink,
getImageAbsoluteURI,
} from 'twenty-ui';
import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI';
import { useBuildWorkspaceUrl } from '@/domain-manager/hooks/useBuildWorkspaceUrl';
const StyledLogo = styled.div<{ logo: string }>`
background: url(${({ logo }) => logo});

View File

@ -1,7 +1,7 @@
import { Helmet } from 'react-helmet-async';
import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState';
import { Helmet } from 'react-helmet-async';
import { useRecoilValue } from 'recoil';
import { getImageAbsoluteURI } from '~/utils/image/getImageAbsoluteURI';
import { getImageAbsoluteURI } from 'twenty-ui';
export const PageFavicon = () => {
const workspacePublicData = useRecoilValue(workspacePublicDataState);