Skip to content

Commit

Permalink
Merge branch 'dev' into feature/CW-1924-profile-pane
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Aug 11, 2023
2 parents 40d52a7 + e254fa4 commit 041d92b
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { webviewLogin } from "@/pages/Auth/store/actions";
import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath_v04 } from "@/shared/utils";
import { getInboxPagePath } from "@/shared/utils";
import { parseJson } from "@/shared/utils/json";

const WebViewLoginHandler: FC = () => {
Expand All @@ -26,7 +26,7 @@ const WebViewLoginHandler: FC = () => {
window.ReactNativeWebView.postMessage(
WebviewActions.loginSuccess,
);
history.push(getInboxPagePath_v04());
history.push(getInboxPagePath());
} else {
window.ReactNativeWebView.postMessage(
WebviewActions.loginError,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/store/saga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ const updateUserData = async (user: User) => {
const photoURL =
user.photo &&
(isRandomUserAvatarURL(user.photo)
? getRandomUserAvatarURL(profileData.displayName?.replaceAll(" ", "+"))
? getRandomUserAvatarURL(profileData.displayName?.replace(/\s/gi, "+"))
: user.photo);

if (photoURL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ const useCommonUpdate = (commonId?: string): Return => {
setIsCommonUpdateLoading(true);

try {
const image =
typeof updatedData.image.file === "string"
const image = updatedData.image
? typeof updatedData.image.file === "string"
? updatedData.image.file
: (await FileService.uploadFile(updatedData.image)).value;
: (await FileService.uploadFile(updatedData.image)).value
: "";
const gallery =
updatedData.gallery &&
(await FileService.uploadFiles(updatedData.gallery));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ const DiscussionFeedCard: FC<DiscussionFeedCardProps> = (props) => {
isProject,
hasFiles: item.data.hasFiles,
hasImages: item.data.hasImages,
ownerId: item.userId,
})}
isPreviewMode={isPreviewMode}
isPinned={isPinned}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ const ProposalFeedCard: React.FC<ProposalFeedCardProps> = (props) => {
isProject,
hasFiles: item.data.hasFiles,
hasImages: item.data.hasImages,
ownerId: item.userId,
})}
canBeExpanded={discussion?.predefinedType !== PredefinedTypes.General}
isPreviewMode={isPreviewMode}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ const ProjectCreationForm: FC<ProjectCreationFormProps> = (props) => {

const [image] = values.projectImages;

if (!image) {
return;
}

updateProject({
...values,
image,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/commonFeed/utils/getLastMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const getLastMessageIconWithText = ({
export const getLastMessage = (
options: GetLastMessageOptions,
): TextEditorValue => {
const { lastMessage, hasImages, hasFiles } = options;
const { lastMessage, hasImages, hasFiles, ownerId, currentUserId } = options;

if (!lastMessage) {
return parseStringToTextEditorValue(getCustomizedMessageString(options));
Expand All @@ -75,7 +75,7 @@ export const getLastMessage = (
const userName =
lastMessage.ownerType === DiscussionMessageOwnerType.System
? ""
: `${lastMessage.userName}: `;
: `${ownerId === currentUserId ? "You" : lastMessage.userName}: `;

return prependTextInTextEditorValue(
`${userName}${getLastMessageIconWithText({
Expand Down
11 changes: 9 additions & 2 deletions src/pages/inbox/utils/getLastMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ import {
export const getLastMessage = (
options: GetLastMessageOptions,
): TextEditorValue => {
const { lastMessage, hasImages, hasFiles, commonName } = options;
const {
lastMessage,
hasImages,
hasFiles,
commonName,
ownerId,
currentUserId,
} = options;

if (!lastMessage) {
return parseStringToTextEditorValue(commonName);
Expand All @@ -25,7 +32,7 @@ export const getLastMessage = (
const userName =
lastMessage.ownerType === DiscussionMessageOwnerType.System
? ""
: `${lastMessage.userName}: `;
: `${ownerId === currentUserId ? "You" : lastMessage.userName}: `;

return prependTextInTextEditorValue(
`${userName}${getLastMessageIconWithText({
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui-kit/ImageGallery/ImageGallery.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

.image {
flex-shrink: 0;
max-width: 14rem;
max-height: 13.125rem;
border-radius: 0.25rem;
object-fit: cover;
Expand All @@ -38,6 +37,7 @@
.singleImage {
max-width: 100%;
max-height: 31.25rem;
border-radius: 0.25rem;
margin: auto;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
max-height: 24rem;
object-fit: cover;
box-sizing: border-box;
border-radius: 0.25rem;
}

.leftItem {
Expand All @@ -21,6 +22,6 @@
width: 100%;
height: 100%;
&:hover {
background-color: rgba(0,0,0,0.2);
background-color: rgba(0, 0, 0, 0.2);
}
}
4 changes: 2 additions & 2 deletions src/shared/utils/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export const getUserInitials = (user: User | undefined) => {

export const getRandomUserAvatarURL = (name?: string | null): string => {
const isOneWord = words(name ?? "").length === 1;
return `https://eu.ui-avatars.com/api/?background=7786ff&color=fff&name=${name?.replaceAll(
" ",
return `https://eu.ui-avatars.com/api/?background=7786ff&color=fff&name=${name?.replace(
/\s/gi,
"+",
)}&rounded=true&${isOneWord ? "uppercase=false" : ""}`;
};
Expand Down

0 comments on commit 041d92b

Please sign in to comment.