diff --git a/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx b/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx index 37ac83fd05..acdc57a258 100644 --- a/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx +++ b/src/pages/common/components/DiscussionFeedCard/DiscussionFeedCard.tsx @@ -323,6 +323,7 @@ const DiscussionFeedCard = forwardRef( isPreviewMode={isPreviewMode} isPinned={isPinned} commonName={commonName} + commonId={commonId} image={commonImage} imageAlt={`${commonName}'s image`} isProject={isProject} diff --git a/src/pages/common/components/FeedCard/FeedCard.tsx b/src/pages/common/components/FeedCard/FeedCard.tsx index 8e593dc061..f351559388 100644 --- a/src/pages/common/components/FeedCard/FeedCard.tsx +++ b/src/pages/common/components/FeedCard/FeedCard.tsx @@ -31,6 +31,7 @@ type FeedCardProps = PropsWithChildren<{ lastMessage?: TextEditorValue; isPreviewMode?: boolean; commonName?: string; + commonId?: string; image?: string; imageAlt?: string; isProject?: boolean; @@ -70,6 +71,7 @@ export const FeedCard = forwardRef((props, ref) => { lastMessage, isPreviewMode = true, commonName, + commonId, image, imageAlt, isProject, @@ -194,6 +196,7 @@ export const FeedCard = forwardRef((props, ref) => { lastMessage: !isLoading ? lastMessage : undefined, menuItems, commonName, + commonId, image, imageAlt, isProject, diff --git a/src/pages/common/components/FeedItem/context.ts b/src/pages/common/components/FeedItem/context.ts index 38f3f3c557..3f408ee137 100644 --- a/src/pages/common/components/FeedItem/context.ts +++ b/src/pages/common/components/FeedItem/context.ts @@ -29,6 +29,7 @@ export interface FeedItemBaseContentProps { seen?: boolean; ownerId?: string; commonName?: string; + commonId?: string; renderImage?: (className?: string) => ReactNode; renderLeftContent?: () => ReactNode; image?: string; @@ -42,6 +43,7 @@ export interface FeedItemBaseContentProps { hasImages?: boolean; isLoading?: boolean; shouldHideBottomContent?: boolean; + dmUserId?: string; hasUnseenMention?: boolean; } diff --git a/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx b/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx index ddbc1c2414..e585b92953 100644 --- a/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx +++ b/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx @@ -460,6 +460,7 @@ const ProposalFeedCard = forwardRef( seen={feedItemUserMetadata?.seen ?? !isFeedItemUserMetadataFetched} menuItems={menuItems} ownerId={item.userId} + commonId={commonId} hasUnseenMention={ feedItemUserMetadata?.hasUnseenMention ?? !isFeedItemUserMetadataFetched diff --git a/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx b/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx index 1ad096f4b4..93441ebc08 100644 --- a/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx +++ b/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx @@ -63,7 +63,6 @@ import { import { InfiniteScroll, TextEditorValue } from "@/shared/ui-kit"; import { addQueryParam, - checkIsProject, deleteQueryParam, getParamsFromOneOfRoutes, getUserName, diff --git a/src/pages/inbox/components/ChatChannelItem/ChatChannelItem.tsx b/src/pages/inbox/components/ChatChannelItem/ChatChannelItem.tsx index 86b964072f..9d9880c345 100644 --- a/src/pages/inbox/components/ChatChannelItem/ChatChannelItem.tsx +++ b/src/pages/inbox/components/ChatChannelItem/ChatChannelItem.tsx @@ -129,6 +129,7 @@ export const ChatChannelItem: FC = (props) => { ownerId={userId} renderImage={renderImage} isImageRounded + dmUserId={dmUserId} /> ); }; diff --git a/src/pages/inbox/components/FeedItemBaseContent/FeedItemBaseContent.tsx b/src/pages/inbox/components/FeedItemBaseContent/FeedItemBaseContent.tsx index ef5da01dba..40ca9f1701 100644 --- a/src/pages/inbox/components/FeedItemBaseContent/FeedItemBaseContent.tsx +++ b/src/pages/inbox/components/FeedItemBaseContent/FeedItemBaseContent.tsx @@ -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, @@ -36,11 +42,16 @@ export const FeedItemBaseContent: FC = (props) => { isImageRounded, isProject, discussionPredefinedType, + dmUserId, + commonId, hasUnseenMention, } = props; + const history = useHistory(); + const { getCommonPagePath } = useRoutesContext(); const contextMenuRef = useRef(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 @@ -98,6 +109,14 @@ export const FeedItemBaseContent: FC = (props) => { } }; + const handleAvatarClick = () => { + if (onUserSelect && dmUserId) { + onUserSelect(dmUserId); + } else if (commonId) { + history.push(getCommonPagePath(commonId)); + } + }; + return (
= (props) => { onContextMenu={handleContextMenu} {...getLongPressProps()} > - {renderImage?.(imageClassName) || ( - - )} +
+ {renderImage?.(imageClassName) || ( + + )} +

{ dispatch(inboxActions.resetInboxItems()); fetch(); - } + }; useEffect(() => { if (!inboxItems.firstDocTimestamp || !userId) {