diff --git a/src/pages/common/components/ChatComponent/context.ts b/src/pages/common/components/ChatComponent/context.ts index 17a48a2122..e98cb480b6 100644 --- a/src/pages/common/components/ChatComponent/context.ts +++ b/src/pages/common/components/ChatComponent/context.ts @@ -14,6 +14,7 @@ export interface ChatItem { circleVisibility: string[]; lastSeenItem?: CommonFeedObjectUserUnique["lastSeen"]; seenOnce?: boolean; + isLiveVoting?: boolean; } export interface ChatContextValue { diff --git a/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx b/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx index 59373437d2..dbf3ed4406 100644 --- a/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx +++ b/src/pages/common/components/ProposalFeedCard/ProposalFeedCard.tsx @@ -17,6 +17,7 @@ import { CommonFeed, Governance, PredefinedTypes, + ProposalState, ResolutionType, } from "@/shared/models"; import { TextEditorValue } from "@/shared/ui-kit"; @@ -228,6 +229,7 @@ const ProposalFeedCard: React.FC = (props) => { circleVisibility: item.circleVisibility, lastSeenItem: feedItemUserMetadata?.lastSeen, seenOnce: feedItemUserMetadata?.seenOnce, + isLiveVoting: proposal.state === ProposalState.VOTING, }); } }, [ diff --git a/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx b/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx index 92030e9ece..530cf7fd1b 100644 --- a/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx +++ b/src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx @@ -482,6 +482,9 @@ const FeedLayout: ForwardRefRenderFunction = ( userCircleIds={userCircleIds} isShowFeedItemDetailsModal={isShowFeedItemDetailsModal} sizeKey={sizeKey} + isMainModalOpen={Boolean(chatItem)} + seenOnce={chatItem?.seenOnce} + isLiveVoting={chatItem?.isLiveVoting} /> )} diff --git a/src/pages/commonFeed/components/FeedLayout/components/FeedItemPreviewModal/FeedItemPreviewModal.tsx b/src/pages/commonFeed/components/FeedLayout/components/FeedItemPreviewModal/FeedItemPreviewModal.tsx index bf3ce2fb7e..ed1a14850f 100644 --- a/src/pages/commonFeed/components/FeedLayout/components/FeedItemPreviewModal/FeedItemPreviewModal.tsx +++ b/src/pages/commonFeed/components/FeedLayout/components/FeedItemPreviewModal/FeedItemPreviewModal.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from "react"; +import React, { FC, useEffect, useState } from "react"; import { FeedItem } from "@/pages/common"; import { useChatContext } from "@/pages/common/components/ChatComponent"; import { Modal } from "@/shared/components"; @@ -21,6 +21,9 @@ interface FeedItemPreviewModalProps { governanceCircles?: Circles; isShowFeedItemDetailsModal?: boolean; sizeKey?: string; + isMainModalOpen: boolean; + seenOnce?: boolean; + isLiveVoting?: boolean; } const FeedItemPreviewModal: FC = (props) => { @@ -34,6 +37,9 @@ const FeedItemPreviewModal: FC = (props) => { governanceCircles, isShowFeedItemDetailsModal, sizeKey, + isMainModalOpen, + seenOnce, + isLiveVoting, } = props; const isTabletView = useIsTabletView(); const { setIsShowFeedItemDetailsModal } = useChatContext(); @@ -48,6 +54,12 @@ const FeedItemPreviewModal: FC = (props) => { setTitle(data.title); }; + useEffect(() => { + if (isMainModalOpen && (!seenOnce || isLiveVoting)) { + setIsShowFeedItemDetailsModal?.(true); + } + }, [isMainModalOpen]); + return (