diff --git a/src/core/client/stream/tabs/profile/components/CommentsHistory.tsx b/src/core/client/stream/tabs/profile/components/CommentsHistory.tsx index 9d750fe1b..dc833f077 100644 --- a/src/core/client/stream/tabs/profile/components/CommentsHistory.tsx +++ b/src/core/client/stream/tabs/profile/components/CommentsHistory.tsx @@ -18,7 +18,7 @@ interface Me { } interface CommentsHistoryProps { - onGoToConversation: () => void; + onGoToConversation: (id: string) => void; me: Me; } @@ -33,7 +33,7 @@ const CommentsHistory: StatelessComponent = props => { props.onGoToConversation(comment.id)} /> ))} diff --git a/src/core/client/stream/tabs/profile/containers/CommentsHistoryContainer.tsx b/src/core/client/stream/tabs/profile/containers/CommentsHistoryContainer.tsx index 96e829a25..18aa0926f 100644 --- a/src/core/client/stream/tabs/profile/containers/CommentsHistoryContainer.tsx +++ b/src/core/client/stream/tabs/profile/containers/CommentsHistoryContainer.tsx @@ -8,18 +8,21 @@ import { CommentsHistoryContainer_me as CommentsData } from "talk-stream/__gener import { CommentsHistoryContainerLocal as Local } from "talk-stream/__generated__/CommentsHistoryContainerLocal.graphql"; import CommentsHistory from "../components/CommentsHistory"; +import { + SetCommentIDMutation, + withSetCommentIDMutation, +} from "talk-stream/mutations"; + interface CommentsHistoryContainerProps { - local: Local; + setCommentID: SetCommentIDMutation; me: CommentsData; } export class CommentsHistoryContainer extends React.Component< CommentsHistoryContainerProps > { - private onGoToConversation = () => { - if (this.props.local.assetURL) { - window.open(this.props.local.assetURL, "_blank"); - } + private onGoToConversation = (id: string) => { + this.props.setCommentID({ id }); }; public render() { return ( @@ -30,29 +33,24 @@ export class CommentsHistoryContainer extends React.Component< ); } } -const enhanced = withFragmentContainer({ - me: graphql` - fragment CommentsHistoryContainer_me on User { - comments { - edges { - node { - id - body - createdAt - replyCount + +const enhanced = withSetCommentIDMutation( + withFragmentContainer({ + me: graphql` + fragment CommentsHistoryContainer_me on User { + comments { + edges { + node { + id + body + createdAt + replyCount + } } } } - } - `, -})( - withLocalStateContainer( - graphql` - fragment CommentsHistoryContainerLocal on Local { - assetURL - } - ` - )(CommentsHistoryContainer) + `, + })(CommentsHistoryContainer) ); export default enhanced;