Decouple twenty-ui Avatar from app server-URL config (#21968)
Makes `twenty-ui`'s `Avatar` render the `avatarUrl` it receives instead of building it from `window._env_`/`window.location` at module load, so the library no longer depends on the app environment. URL resolution moves to `twenty-front` via a `getAbsoluteImageUrl` helper applied at the call sites. Part of making twenty-ui a standalone library.
This commit is contained in:
@@ -8,9 +8,7 @@ import { type AvatarType } from '@ui/data-display/Avatar/types/AvatarType';
|
||||
import { type IconComponent } from '@ui/icon/types/IconComponent';
|
||||
import { ThemeContext } from '@ui/theme-constants';
|
||||
import { stringToThemeColorP3String } from '@ui/utilities';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '@ui/utilities/config';
|
||||
import { type Nullable } from '@ui/utilities/types/Nullable';
|
||||
import { getImageAbsoluteURI } from '@ui/utilities/utils/getImageAbsoluteURI';
|
||||
|
||||
import styles from './Avatar.module.scss';
|
||||
|
||||
@@ -49,12 +47,7 @@ export const Avatar = ({
|
||||
string | null
|
||||
>(null);
|
||||
|
||||
const avatarImageURI = isNonEmptyString(avatarUrl)
|
||||
? getImageAbsoluteURI({
|
||||
imageUrl: avatarUrl,
|
||||
baseUrl: REACT_APP_SERVER_BASE_URL,
|
||||
})
|
||||
: null;
|
||||
const avatarImageURI = isNonEmptyString(avatarUrl) ? avatarUrl : null;
|
||||
|
||||
const placeholderFirstChar = placeholder?.trim()?.charAt(0);
|
||||
const isPlaceholderFirstCharEmpty =
|
||||
|
||||
Reference in New Issue
Block a user