Setting CommentID

This commit is contained in:
Belén Curcio
2018-10-01 14:12:05 -03:00
parent 35787c15af
commit abb6f3aea6
2 changed files with 25 additions and 27 deletions
@@ -18,7 +18,7 @@ interface Me {
}
interface CommentsHistoryProps {
onGoToConversation: () => void;
onGoToConversation: (id: string) => void;
me: Me;
}
@@ -33,7 +33,7 @@ const CommentsHistory: StatelessComponent<CommentsHistoryProps> = props => {
<HistoryComment
key={comment.id}
comment={comment}
onGoToConversation={props.onGoToConversation}
onGoToConversation={() => props.onGoToConversation(comment.id)}
/>
))}
</HorizontalGutter>
@@ -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<CommentsHistoryContainerProps>({
me: graphql`
fragment CommentsHistoryContainer_me on User {
comments {
edges {
node {
id
body
createdAt
replyCount
const enhanced = withSetCommentIDMutation(
withFragmentContainer<CommentsHistoryContainerProps>({
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;