Comment History

This commit is contained in:
Belén Curcio
2018-09-14 11:35:01 -03:00
parent 935c2ff629
commit 60d61d40b6
6 changed files with 72 additions and 5 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ import {
import { SetActiveTabMutation } from "talk-stream/mutations";
import CommentsPaneContainer from "../tabs/comments/containers/CommentsPaneContainer";
import ProfileContainer from "../tabs/profile/containers/ProfileContainer";
import ProfileQuery from "../tabs/profile/queries/ProfileQuery";
import * as styles from "./App.css";
export interface AppProps {
@@ -35,7 +35,7 @@ const App: StatelessComponent<AppProps> = props => {
<CommentsPaneContainer />
</TabPane>
<TabPane tabId="PROFILE">
<ProfileContainer />
<ProfileQuery />
</TabPane>
</TabContent>
</HorizontalGutter>
@@ -0,0 +1,14 @@
import * as React from "react";
import { StatelessComponent } from "react";
import { CommentHistoryContainer_me as MeData } from "talk-stream/__generated__/CommentHistoryContainer_me.graphql";
import { HorizontalGutter } from "talk-ui/components";
export interface CommentHistoryProps {
me: MeData;
}
const CommentHistory: StatelessComponent<CommentHistoryProps> = props => {
return <HorizontalGutter size="double">Comments</HorizontalGutter>;
};
export default CommentHistory;
@@ -3,9 +3,13 @@ import { StatelessComponent } from "react";
import { PropTypesOf } from "talk-framework/types";
import UserBoxContainer from "talk-stream/containers/UserBoxContainer";
import { HorizontalGutter } from "talk-ui/components";
import CommentHistoryContainer from "../containers/CommentHistoryContainer";
export interface ProfileProps {
me: PropTypesOf<typeof UserBoxContainer>["me"] | null;
me:
| PropTypesOf<typeof UserBoxContainer>["me"] &
PropTypesOf<typeof CommentHistoryContainer>["me"]
| null;
}
const Profile: StatelessComponent<ProfileProps> = props => {
@@ -13,6 +17,7 @@ const Profile: StatelessComponent<ProfileProps> = props => {
<HorizontalGutter size="double">
<HorizontalGutter size="half">
<UserBoxContainer me={props.me} />
{props.me && <CommentHistoryContainer me={props.me} />}
</HorizontalGutter>
</HorizontalGutter>
);
@@ -0,0 +1,35 @@
import React from "react";
import { graphql } from "react-relay";
import { withFragmentContainer } from "talk-framework/lib/relay";
import { CommentHistoryContainer_me as CommentsData } from "talk-stream/__generated__/CommentHistoryContainer_me.graphql";
import CommentHistory from "../components/CommentHistory";
interface CommentHistoryContainerProps {
me: CommentsData;
}
export class CommentHistoryContainer extends React.Component<
CommentHistoryContainerProps
> {
public render() {
return <CommentHistory me={this.props.me} />;
}
}
const enhanced = withFragmentContainer<CommentHistoryContainerProps>({
me: graphql`
fragment CommentHistoryContainer_me on User {
comments {
edges {
node {
id
body
}
}
}
}
`,
})(CommentHistoryContainer);
export default enhanced;
@@ -12,13 +12,17 @@ interface ProfileContainerProps {
export class StreamContainer extends React.Component<ProfileContainerProps> {
public render() {
return <Profile me={this.props.me} />;
if (this.props.me) {
return <Profile me={this.props.me} />;
}
return null;
}
}
const enhanced = withFragmentContainer<ProfileContainerProps>({
me: graphql`
fragment ProfileContainer_me on User {
...UserBoxContainer_me
...CommentHistoryContainer_me
}
`,
})(StreamContainer);