Add Twenty Shared & Fix profile image rendering (#8841)
PR Summary: 1. Added `Twenty Shared` Package to centralize utilitiies as mentioned in #8942 2. Optimization of `getImageAbsoluteURI.ts` to handle edge cases  --------- Co-authored-by: Antoine Moreaux <moreaux.antoine@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
committed by
GitHub
parent
4e329d08b0
commit
08a9db2df6
@ -10,7 +10,7 @@ import { MainText } from 'src/components/MainText';
|
||||
import { Title } from 'src/components/Title';
|
||||
import { WhatIsTwenty } from 'src/components/WhatIsTwenty';
|
||||
import { capitalize } from 'src/utils/capitalize';
|
||||
import { getImageAbsoluteURI } from 'src/utils/getImageAbsoluteURI';
|
||||
import { getImageAbsoluteURI } from 'twenty-shared';
|
||||
|
||||
type SendInviteLinkEmailProps = {
|
||||
link: string;
|
||||
@ -30,7 +30,7 @@ export const SendInviteLinkEmail = ({
|
||||
serverUrl,
|
||||
}: SendInviteLinkEmailProps) => {
|
||||
const workspaceLogo = workspace.logo
|
||||
? getImageAbsoluteURI(workspace.logo, serverUrl)
|
||||
? getImageAbsoluteURI({ imageUrl: workspace.logo, baseUrl: serverUrl })
|
||||
: null;
|
||||
|
||||
return (
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
export const getImageAbsoluteURI = (imageUrl: string, serverUrl: string) => {
|
||||
if (imageUrl.startsWith('https:') || imageUrl.startsWith('http:')) {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
return serverUrl.endsWith('/')
|
||||
? `${serverUrl.substring(0, serverUrl.length - 1)}/files/${imageUrl}`
|
||||
: `${serverUrl}/files/${imageUrl}`;
|
||||
};
|
||||
Reference in New Issue
Block a user