diff --git a/packages/web/components/Conversations/ConversationFullRow.tsx b/packages/web/components/Conversations/ConversationFullRow.tsx index 06c38aa..33c55d4 100644 --- a/packages/web/components/Conversations/ConversationFullRow.tsx +++ b/packages/web/components/Conversations/ConversationFullRow.tsx @@ -21,6 +21,8 @@ import { ConversationMemberState } from "../../../common/models/conversation"; import { conversationService } from "@nirvana/common/services"; import { useAuth } from "../../contexts/authContext"; import toast from "react-hot-toast"; +import { useRouter } from "next/router"; +import { Routes } from "@nirvana/common/helpers/routes"; export default function ConversationFullRow(props: { conversation: Conversation; @@ -51,8 +53,18 @@ export default function ConversationFullRow(props: { } }; + const router = useRouter(); + + const handleViewConversationDetails = (e) => { + router.push({ + pathname: Routes.home, + query: { convoId: props.conversation.id }, + }); + }; + return ( diff --git a/packages/web/components/Conversations/PriorityConvoRow.tsx b/packages/web/components/Conversations/PriorityConvoRow.tsx index edd2eb8..4df1fa0 100644 --- a/packages/web/components/Conversations/PriorityConvoRow.tsx +++ b/packages/web/components/Conversations/PriorityConvoRow.tsx @@ -15,6 +15,8 @@ import { } from "react-icons/fa"; import { useCallback } from "react"; import { FaAngleRight } from "react-icons/fa"; +import { useRouter } from "next/router"; +import { Routes } from "@nirvana/common/helpers/routes"; export default function PriorityConvoRow(props: { conversation: Conversation; @@ -39,6 +41,17 @@ export default function PriorityConvoRow(props: { setSelectedConvo(props.conversation.id); }, [props.conversation]); + const router = useRouter(); + + const handleViewConversationDetails = (e) => { + e.stopPropagation(); + + router.push({ + pathname: Routes.home, + query: { convoId: props.conversation.id }, + }); + }; + return ( - + diff --git a/packages/web/components/MainTabsOrPages/Conversations.tsx b/packages/web/components/MainTabsOrPages/Conversations.tsx index 9e7d6e3..9d22b06 100644 --- a/packages/web/components/MainTabsOrPages/Conversations.tsx +++ b/packages/web/components/MainTabsOrPages/Conversations.tsx @@ -45,13 +45,6 @@ export default function Conversations() { RelativeTimeConvosSections.oldJunk ); - const handleViewConversationDetails = (convoId) => { - router.push({ - pathname: Routes.home, - query: { convoId }, - }); - }; - return ( <> {/* live */} @@ -81,10 +74,7 @@ export default function Conversations() { Today - handleViewConversationDetails("woah")} - className="flex flex-col w-full items-stretch" - > + {todayConvos.map((tRoom) => ( ))} @@ -100,10 +90,7 @@ export default function Conversations() { Last 7 Days - handleViewConversationDetails("woah")} - className="flex flex-col w-full items-stretch" - > + {last7DaysConvos.map((tRoom) => ( ))} @@ -119,10 +106,7 @@ export default function Conversations() { Earlier This Month - handleViewConversationDetails("woah")} - className="flex flex-col w-full items-stretch" - > + {earlierMonthConvos.map((tRoom) => ( ))} @@ -138,10 +122,7 @@ export default function Conversations() { Older Junk - handleViewConversationDetails("woah")} - className="flex flex-col w-full items-stretch" - > + {oldJunkConvos.map((tRoom) => ( ))}