This commit is contained in:
Belén Curcio
2018-09-25 13:37:22 -03:00
parent 303c7489e4
commit 3edaa6bf2d
4 changed files with 13 additions and 21 deletions
+2 -3
View File
@@ -16,9 +16,8 @@ import ProfileQuery from "../tabs/profile/queries/ProfileQuery";
import * as styles from "./App.css";
export interface AppProps {
activeTab: "COMMENTS" | "PROFILE" | "%future added value";
activeTab: "COMMENTS" | "PROFILE" | "%future added value" | string;
onActiveTab: SetActiveTabMutation;
signedIn: boolean;
}
const App: StatelessComponent<AppProps> = props => {
@@ -29,7 +28,7 @@ const App: StatelessComponent<AppProps> = props => {
onTabClick={tab => props.onActiveTab({ tab })}
>
<Tab tabId="COMMENTS">Comments</Tab>
{props.signedIn && <Tab tabId="PROFILE">My Profile</Tab>}
<Tab tabId="PROFILE">My Profile</Tab>
</TabBar>
<TabContent activeTab={props.activeTab}>
<TabPane tabId="COMMENTS">
@@ -12,27 +12,20 @@ import App from "../components/App";
interface InnerProps {
local: Local;
onsetActiveTab: SetActiveTabMutation;
setActiveTab: SetActiveTabMutation;
}
const AppContainer: StatelessComponent<InnerProps> = ({
local: { activeTab, authToken },
local: { activeTab },
setActiveTab,
}) => {
return (
<App
activeTab={activeTab}
onActiveTab={setActiveTab}
signedIn={!!authToken}
/>
);
return <App activeTab={activeTab} onActiveTab={setActiveTab} />;
};
const enhanced = withLocalStateContainer(
graphql`
fragment AppContainerLocal on Local {
activeTab
authToken
}
`
)(withSetActiveTabMutation(AppContainer));
@@ -3,7 +3,7 @@ import { commitLocalUpdate, Environment } from "relay-runtime";
import { createMutationContainer, LOCAL_ID } from "talk-framework/lib/relay";
export interface SetActiveTabInput {
tab: "COMMENTS" | "PROFILE" | "%future added value";
tab: "COMMENTS" | "PROFILE" | "%future added value" | string;
}
export type SetActiveTabMutation = (input: SetActiveTabInput) => Promise<void>;
@@ -5,13 +5,13 @@ import { HorizontalGutter, Typography } from "talk-ui/components";
import HistoryComment from "./HistoryComment";
interface Me {
comments: {
edges: Array<{
node: {
id: string;
body: string | null;
createdAt: any;
replyCount: number | null;
readonly comments: {
readonly edges: ReadonlyArray<{
readonly node: {
readonly id: string;
readonly body: string | null;
readonly createdAt: any;
readonly replyCount: number | null;
};
}>;
};