mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
41 lines
962 B
TypeScript
41 lines
962 B
TypeScript
import React from "react";
|
|
|
|
import { graphql, withLocalStateContainer } from "talk-framework/lib/relay";
|
|
import { AppContainerLocal as Local } from "talk-stream/__generated__/AppContainerLocal.graphql";
|
|
import {
|
|
SetActiveTabInput,
|
|
SetActiveTabMutation,
|
|
withSetActiveTabMutation,
|
|
} from "talk-stream/mutations";
|
|
|
|
import App from "../components/App";
|
|
|
|
interface InnerProps {
|
|
local: Local;
|
|
setActiveTab: SetActiveTabMutation;
|
|
}
|
|
|
|
class AppContainer extends React.Component<InnerProps> {
|
|
private handleSetActiveTab = (tab: SetActiveTabInput["tab"]) => {
|
|
this.props.setActiveTab({ tab });
|
|
};
|
|
|
|
public render() {
|
|
const {
|
|
local: { activeTab },
|
|
} = this.props;
|
|
|
|
return <App activeTab={activeTab} onTabClick={this.handleSetActiveTab} />;
|
|
}
|
|
}
|
|
|
|
const enhanced = withLocalStateContainer(
|
|
graphql`
|
|
fragment AppContainerLocal on Local {
|
|
activeTab
|
|
}
|
|
`
|
|
)(withSetActiveTabMutation(AppContainer));
|
|
|
|
export default enhanced;
|