Skip to content

Commit

Permalink
Merge branch 'dev' into feature/CW-2299-sorce-map-config
Browse files Browse the repository at this point in the history
  • Loading branch information
budnik9 committed Nov 8, 2023
2 parents 7914ee8 + f65cf5c commit 8a66bb6
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: column;
flex: 1;
width: inherit;
height: calc(100% - #{$container-desktop-header-height});
height: calc(100% - var(--chat-header-height, 0rem));
background-color: $white;
box-sizing: border-box;
--chat-input-wrapper-height: 3.125rem;
Expand All @@ -18,15 +18,18 @@
overscroll-behavior: contain;
display: flex;
flex-direction: column-reverse;
padding: 0.5rem 2rem 0;
padding-bottom: calc(var(--chat-input-wrapper-height) + 7rem);
padding: 0.5rem 2rem 0 2rem;
margin-bottom: var(--chat-input-wrapper-height);

@include big-phone {
margin-bottom: 0;
}
}

.emptyChat {
display: flex;
justify-content: center;
padding: 0.5rem 2rem 0;
padding-bottom: calc(var(--chat-input-wrapper-height) + 7rem);
align-self: center;
}

.bottomChatContainer {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ export default function ChatComponent({
const chatWrapperId = useMemo(() => `chat-wrapper-${uuidv4()}`, []);
const chatInputWrapperRef = useRef<HTMLDivElement>(null);
const chatContainerRef = useRef<HTMLDivElement>(null);
const [isScrolling, setScrolling] = useState(false);
const [isScrolling, setIsScrolling] = useState(false);
const chatContentContextValue: ChatContentData = useMemo(
() => ({
isScrolling,
chatContentRect: chatContainerRef.current?.getBoundingClientRect(),
}),
[isScrolling],
[isScrolling, chatContainerRef.current],
);

const [message, setMessage] = useState<TextEditorValue>(
Expand Down Expand Up @@ -603,11 +603,11 @@ export default function ChatComponent({

useEffect(() => {
const deactivateScrollingFlag = debounce(() => {
setScrolling(false);
setIsScrolling(false);
}, 300);

function handleScroll() {
setScrolling(true);
setIsScrolling(true);
deactivateScrollingFlag();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
.noMessagesText {
align-self: flex-start;
max-width: 17.5rem;
margin: 3.375rem 0 0;
padding: 0.5rem 1rem;
font-size: $xsmall;
line-height: 143%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ const DiscussionFeedCard = forwardRef<FeedItemRef, DiscussionFeedCardProps>(
isPreviewMode={isPreviewMode}
isPinned={isPinned}
commonName={commonName}
commonId={commonId}
image={commonImage}
imageAlt={`${commonName}'s image`}
isProject={isProject}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/common/components/FeedCard/FeedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type FeedCardProps = PropsWithChildren<{
lastMessage?: TextEditorValue;
isPreviewMode?: boolean;
commonName?: string;
commonId?: string;
image?: string;
imageAlt?: string;
isProject?: boolean;
Expand Down Expand Up @@ -70,6 +71,7 @@ export const FeedCard = forwardRef<FeedCardRef, FeedCardProps>((props, ref) => {
lastMessage,
isPreviewMode = true,
commonName,
commonId,
image,
imageAlt,
isProject,
Expand Down Expand Up @@ -194,6 +196,7 @@ export const FeedCard = forwardRef<FeedCardRef, FeedCardProps>((props, ref) => {
lastMessage: !isLoading ? lastMessage : undefined,
menuItems,
commonName,
commonId,
image,
imageAlt,
isProject,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/common/components/FeedItem/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface FeedItemBaseContentProps {
seen?: boolean;
ownerId?: string;
commonName?: string;
commonId?: string;
renderImage?: (className?: string) => ReactNode;
renderLeftContent?: () => ReactNode;
image?: string;
Expand All @@ -42,6 +43,7 @@ export interface FeedItemBaseContentProps {
hasImages?: boolean;
isLoading?: boolean;
shouldHideBottomContent?: boolean;
dmUserId?: string;
hasUnseenMention?: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ const ProposalFeedCard = forwardRef<FeedItemRef, ProposalFeedCardProps>(
seen={feedItemUserMetadata?.seen ?? !isFeedItemUserMetadataFetched}
menuItems={menuItems}
ownerId={item.userId}
commonId={commonId}
hasUnseenMention={
feedItemUserMetadata?.hasUnseenMention ??
!isFeedItemUserMetadataFetched
Expand Down
1 change: 0 additions & 1 deletion src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
import { InfiniteScroll, TextEditorValue } from "@/shared/ui-kit";
import {
addQueryParam,
checkIsProject,
deleteQueryParam,
getParamsFromOneOfRoutes,
getUserName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
@import "../../../../../../constants";

.rightPaneContainerWithHeader {
--chat-header-height: #{$container-desktop-header-height};
}

.titleWrapper {
height: $container-desktop-header-height;
height: var(--chat-header-height);
padding: 0 1.25rem;
display: flex;
align-items: center;
background-color: $c-light-gray-2;
border-bottom: 0.0625rem solid $c-light-gray;
box-sizing: border-box;
}

.title {
margin: 0;
display: -webkit-box;
Expand All @@ -22,6 +27,7 @@
overflow-wrap: break-word;
text-overflow: ellipsis;
}

.titleRTL {
text-align: right;
direction: rtl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ const DesktopChat: FC<ChatProps> = (props) => {
}, [dmUserId]);

return (
<DesktopRightPane className={className}>
<DesktopRightPane
className={classNames(className, {
[styles.rightPaneContainerWithHeader]: withTitle,
})}
>
{withTitle && (
<div className={styles.titleWrapper}>
{dmUser?.photoURL && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import "../../../../../../constants";

.modal {
height: 90vh;

.modalHeaderWrapper {
padding: 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const ChatChannelItem: FC<ChatChannelFeedLayoutItemProps> = (props) => {
ownerId={userId}
renderImage={renderImage}
isImageRounded
dmUserId={dmUserId}
/>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React, { FC, MouseEventHandler, useRef, useState } from "react";
import { useHistory } from "react-router-dom";
import classNames from "classnames";
import { useLongPress } from "use-long-press";
import { FeedCardTags, FeedItemBaseContentProps } from "@/pages/common";
import {
FeedCardTags,
FeedItemBaseContentProps,
useFeedItemContext,
} from "@/pages/common";
import { useRoutesContext } from "@/shared/contexts";
import { PredefinedTypes } from "@/shared/models";
import {
ContextMenu,
Expand Down Expand Up @@ -36,11 +42,16 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
isImageRounded,
isProject,
discussionPredefinedType,
dmUserId,
commonId,
hasUnseenMention,
} = props;
const history = useHistory();
const { getCommonPagePath } = useRoutesContext();
const contextMenuRef = useRef<ContextMenuRef>(null);
const [isLongPressing, setIsLongPressing] = useState(false);
const [isLongPressed, setIsLongPressed] = useState(false);
const { onUserSelect } = useFeedItemContext();
const isContextMenuEnabled = Boolean(menuItems && menuItems.length > 0);
const finalTitle =
discussionPredefinedType === PredefinedTypes.General && commonName
Expand Down Expand Up @@ -98,6 +109,14 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
}
};

const handleAvatarClick = () => {
if (onUserSelect && dmUserId) {
onUserSelect(dmUserId);
} else if (commonId) {
history.push(getCommonPagePath(commonId));
}
};

return (
<div
className={classNames(styles.container, {
Expand All @@ -109,14 +128,16 @@ export const FeedItemBaseContent: FC<FeedItemBaseContentProps> = (props) => {
onContextMenu={handleContextMenu}
{...getLongPressProps()}
>
{renderImage?.(imageClassName) || (
<CommonAvatar
name={commonName}
src={image}
className={imageClassName}
alt={imageAlt}
/>
)}
<div onClick={handleAvatarClick}>
{renderImage?.(imageClassName) || (
<CommonAvatar
name={commonName}
src={image}
className={imageClassName}
alt={imageAlt}
/>
)}
</div>
<div className={styles.content}>
<div className={styles.topContent}>
<p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
width: 1.5rem;
height: 1.5rem;
color: inherit;
}
}
2 changes: 1 addition & 1 deletion src/pages/inbox/components/InboxFilterButton/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as InboxFilterButton } from "./InboxFilterButton";
export { default as InboxFilterButton } from "./InboxFilterButton";
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
text-align: start;
font-size: $small;
color: $secondary-blue;
max-width: 33.563rem;
margin-right: 2.8rem;

&:hover {
.menuArrowButton {
Expand Down Expand Up @@ -90,6 +92,8 @@

.messageTextCurrentUser {
background-color: $c-pink-active-feed-cards;
margin-left: 2.8rem;
margin-right: unset;
}

.systemMessageContainer {
Expand All @@ -103,6 +107,7 @@
font-size: $xxsmall-2;
color: $c-gray-60;
direction: ltr;
margin: 0 4.25rem;
}

.messageName {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/Chat/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default function ChatMessage({
},
);

const handleContextMenu: MouseEventHandler<HTMLLIElement> = (event) => {
const handleContextMenu: MouseEventHandler<HTMLDivElement> = (event) => {
if (!isTabletView) {
event.preventDefault();
setIsMenuOpen(true);
Expand Down Expand Up @@ -341,7 +341,6 @@ export default function ChatMessage({
<li
id={discussionMessage.id}
className={classNames(styles.container, className)}
onContextMenu={handleContextMenu}
>
<div
className={classNames(styles.message, {
Expand Down Expand Up @@ -370,6 +369,7 @@ export default function ChatMessage({
) : (
<>
<div
onContextMenu={handleContextMenu}
className={classNames(styles.messageText, {
[styles.messageTextCurrentUser]: !isNotCurrentUserMessage,
[styles.messageTextRtl]: isRtlText(discussionMessage.text),
Expand Down
2 changes: 1 addition & 1 deletion src/shared/hooks/useCases/useInboxItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const useInboxItems = (
const refetch = () => {
dispatch(inboxActions.resetInboxItems());
fetch();
}
};

useEffect(() => {
if (!inboxItems.firstDocTimestamp || !userId) {
Expand Down

0 comments on commit 8a66bb6

Please sign in to comment.