diff --git a/src/components/message/Message.tsx b/src/components/message/Message.tsx index 2b5570a31..b1bad0d9e 100644 --- a/src/components/message/Message.tsx +++ b/src/components/message/Message.tsx @@ -76,7 +76,9 @@ const Message: FC = ({ const avatar = !isMyMessage && isAvatarVisible && ( diff --git a/src/components/user-profile-info/UserProfileInfo.tsx b/src/components/user-profile-info/UserProfileInfo.tsx index 1b05b2d9f..d4777b3f7 100644 --- a/src/components/user-profile-info/UserProfileInfo.tsx +++ b/src/components/user-profile-info/UserProfileInfo.tsx @@ -67,7 +67,7 @@ const UserProfileInfo: FC = ({ const avatar = ( ) diff --git a/src/containers/about-chat-sidebar/AboutChatSidebar.tsx b/src/containers/about-chat-sidebar/AboutChatSidebar.tsx index 929a8c26e..decf4b0d2 100644 --- a/src/containers/about-chat-sidebar/AboutChatSidebar.tsx +++ b/src/containers/about-chat-sidebar/AboutChatSidebar.tsx @@ -91,7 +91,8 @@ const AboutChatSidebar: FC = ({ diff --git a/src/containers/chat/chat-item/ChatItem.tsx b/src/containers/chat/chat-item/ChatItem.tsx index bf26b6104..5a2976511 100644 --- a/src/containers/chat/chat-item/ChatItem.tsx +++ b/src/containers/chat/chat-item/ChatItem.tsx @@ -15,7 +15,7 @@ import { OverlapEnum, PositionEnum } from '~/types' -import { getFormattedDate } from '~/utils/helper-functions' +import { createUrlPath, getFormattedDate } from '~/utils/helper-functions' interface ItemOfChatProps { isActiveChat: boolean @@ -84,7 +84,10 @@ const ChatItem: FC = ({ overlap={OverlapEnum.Circular} > diff --git a/src/containers/edit-profile/profile-tab/profile-tab-form/ProfileTabForm.tsx b/src/containers/edit-profile/profile-tab/profile-tab-form/ProfileTabForm.tsx index 402950e54..d4b809fac 100644 --- a/src/containers/edit-profile/profile-tab/profile-tab-form/ProfileTabForm.tsx +++ b/src/containers/edit-profile/profile-tab/profile-tab-form/ProfileTabForm.tsx @@ -32,6 +32,7 @@ import { snackbarVariants } from '~/constants' import { imageResize } from '~/utils/image-resize' import { styles } from '~/containers/edit-profile/profile-tab/profile-tab-form/ProfileTabForm.styles' import { openAlert } from '~/redux/features/snackbarSlice' +import { createUrlPath } from '~/utils/helper-functions' export interface ProfileTabFormProps { data: EditProfileForm @@ -106,7 +107,7 @@ const ProfileTabForm: FC = ({ const { photo } = data const photoToDisplay = typeof photo === 'string' - ? photo && `${import.meta.env.VITE_APP_IMG_USER_URL}${photo}` + ? photo && createUrlPath(import.meta.env.VITE_APP_IMG_USER_URL, photo) : photo?.src return ( diff --git a/src/containers/my-cooperations/my-cooperations-details/MyCooperationsDetails.tsx b/src/containers/my-cooperations/my-cooperations-details/MyCooperationsDetails.tsx index 9c17c2857..0e2b2dc86 100644 --- a/src/containers/my-cooperations/my-cooperations-details/MyCooperationsDetails.tsx +++ b/src/containers/my-cooperations/my-cooperations-details/MyCooperationsDetails.tsx @@ -104,7 +104,10 @@ const MyCooperationsDetails = () => { diff --git a/src/containers/navigation-icons/AccountIcon.tsx b/src/containers/navigation-icons/AccountIcon.tsx index 178265c39..dba1aad21 100644 --- a/src/containers/navigation-icons/AccountIcon.tsx +++ b/src/containers/navigation-icons/AccountIcon.tsx @@ -13,6 +13,7 @@ import { defaultResponses } from '~/constants' import { styles } from '~/containers/navigation-icons/NavigationIcons.styles' import { UserResponse, UserRole } from '~/types' +import { createUrlPath } from '~/utils/helper-functions' interface AccountIconProps { openMenu: (event: MouseEvent) => void @@ -45,7 +46,10 @@ const AccountIcon: FC = ({ openMenu }) => { {!loading && firstName && lastName && `${firstName[0]}${lastName[0]}`} diff --git a/src/containers/user-profile/profile-info/ProfileContainerDesktop.tsx b/src/containers/user-profile/profile-info/ProfileContainerDesktop.tsx index f87d73882..79577978a 100644 --- a/src/containers/user-profile/profile-info/ProfileContainerDesktop.tsx +++ b/src/containers/user-profile/profile-info/ProfileContainerDesktop.tsx @@ -11,6 +11,7 @@ import ProfileDoneItemsList from '~/components/icon-with-text-list/ProfileDoneIt import { styles } from '~/containers/user-profile/profile-info/ProfileInfo.styles' import { UserResponse } from '~/types' +import { createUrlPath } from '~/utils/helper-functions' interface ProfileContainerDesktopProps { actionIcon: ReactNode @@ -31,13 +32,16 @@ const ProfileContainerDesktop = ({ doneItems, chipItems }: ProfileContainerDesktopProps) => { - const avatarSrc = userData.photo - ? `${import.meta.env.VITE_APP_IMG_USER_URL}${userData.photo}` - : '' return ( - + {actionIcon} diff --git a/src/containers/user-profile/profile-info/ProfileContainerMobile.tsx b/src/containers/user-profile/profile-info/ProfileContainerMobile.tsx index 2868b5e8b..82e21b279 100644 --- a/src/containers/user-profile/profile-info/ProfileContainerMobile.tsx +++ b/src/containers/user-profile/profile-info/ProfileContainerMobile.tsx @@ -11,6 +11,7 @@ import ProfileDoneItemsList from '~/components/icon-with-text-list/ProfileDoneIt import { styles } from '~/containers/user-profile/profile-info/ProfileInfo.styles' import { UserResponse } from '~/types' +import { createUrlPath } from '~/utils/helper-functions' interface ProfileContainerMobileProps { actionIcon: ReactNode @@ -31,14 +32,20 @@ const ProfileContainerMobile = ({ userData, chipItems }: ProfileContainerMobileProps) => { - const avatarSrc = userData.photo - ? `${import.meta.env.VITE_APP_IMG_USER_URL}${userData.photo}` - : '' return ( - + { let trimmedUrl = URL - while (trimmedUrl.endsWith('/')) { + while (trimmedUrl?.endsWith('/')) { trimmedUrl = trimmedUrl.slice(0, -1) }