Show profile tab if user is signed in

This commit is contained in:
Belén Curcio
2018-09-24 10:54:45 -03:00
parent 0cea633b0b
commit 2502dfedd2
2 changed files with 11 additions and 3 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ import * as styles from "./App.css";
export interface AppProps {
activeTab: "COMMENTS" | "PROFILE" | "%future added value";
setActiveTab: SetActiveTabMutation;
signedIn: boolean;
}
const App: StatelessComponent<AppProps> = props => {
@@ -28,7 +29,7 @@ const App: StatelessComponent<AppProps> = props => {
onTabClick={tab => props.setActiveTab({ tab })}
>
<Tab tabId="COMMENTS">Comments</Tab>
<Tab tabId="PROFILE">My Profile</Tab>
{props.signedIn && <Tab tabId="PROFILE">My Profile</Tab>}
</TabBar>
<TabContent activeTab={props.activeTab}>
<TabPane tabId="COMMENTS">
@@ -16,16 +16,23 @@ interface InnerProps {
}
const AppContainer: StatelessComponent<InnerProps> = ({
local: { activeTab },
local: { activeTab, authToken },
setActiveTab,
}) => {
return <App activeTab={activeTab} setActiveTab={setActiveTab} />;
return (
<App
activeTab={activeTab}
setActiveTab={setActiveTab}
signedIn={!!authToken}
/>
);
};
const enhanced = withLocalStateContainer(
graphql`
fragment AppContainerLocal on Local {
activeTab
authToken
}
`
)(withSetActiveTabMutation(AppContainer));