mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 10:37:10 +08:00
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import { graphql } from "react-relay";
|
|
import {
|
|
withFragmentContainer,
|
|
withLocalStateContainer,
|
|
} from "talk-framework/lib/relay";
|
|
import { AppQueryLocal as Local } from "talk-stream/__generated__/AppQueryLocal.graphql";
|
|
import { PermalinkViewContainerQuery as Data } from "talk-stream/__generated__/PermalinkViewContainerQuery.graphql";
|
|
import {
|
|
SetCommentIDMutation,
|
|
withSetCommentIDMutation,
|
|
} from "talk-stream/mutations";
|
|
import PermalinkView from "../components/PermalinkView";
|
|
|
|
interface PermalinkViewContainerProps {
|
|
data: Data;
|
|
local: Local;
|
|
setCommentID: SetCommentIDMutation;
|
|
}
|
|
|
|
class PermalinkViewContainer extends React.Component<
|
|
PermalinkViewContainerProps
|
|
> {
|
|
private showAllComments = () => {
|
|
this.props.setCommentID({ id: null });
|
|
};
|
|
public render() {
|
|
const { data, local } = this.props;
|
|
return (
|
|
<PermalinkView
|
|
{...data}
|
|
assetURL={local.assetURL}
|
|
onShowAllComments={this.showAllComments}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
const enhanced = withSetCommentIDMutation(
|
|
withFragmentContainer<{ data: Data }>({
|
|
data: graphql`
|
|
fragment PermalinkViewContainerQuery on Query
|
|
@argumentDefinitions(commentID: { type: "ID!" }) {
|
|
comment(id: $commentID) {
|
|
...CommentContainer
|
|
}
|
|
}
|
|
`,
|
|
})(
|
|
withLocalStateContainer<Local>(
|
|
graphql`
|
|
fragment PermalinkViewContainerLocal on Local {
|
|
assetURL
|
|
}
|
|
`
|
|
)(PermalinkViewContainer)
|
|
)
|
|
);
|
|
|
|
export default enhanced;
|