feat(navigation): hide/show account depending on data

This commit is contained in:
Sérgio Ramos 2018-03-26 20:34:42 +01:00
parent b51f135703
commit 281f9ef60e
2 changed files with 40 additions and 40 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-joy-navigation", "name": "my-joy-navigation",
"version": "2.3.3", "version": "2.4.0",
"private": true, "private": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"main": "lib/index.js", "main": "lib/index.js",

View File

@ -33,20 +33,19 @@ const GetHeader = gql`
} }
`; `;
// Needs to be revised const GetAccount = gql`
// const GetAccount = gql` {
// { datacenter {
// datacenter { name
// name }
// } account {
// account { login
// login }
// } }
// } `;
// `;
const Navigation = ({ const Navigation = ({
login, account = {},
datacenter = true, datacenter = true,
toggleSectionOpen, toggleSectionOpen,
isOpen, isOpen,
@ -86,17 +85,18 @@ const Navigation = ({
</HeaderItem> </HeaderItem>
) : null} ) : null}
{datacenter ? <HeaderDividerItem /> : null} {datacenter ? <HeaderDividerItem /> : null}
{account.login ? (
<HeaderItem> <HeaderItem>
<HeaderItemContent> <HeaderItemContent>
<HeaderItemSubContent>Account:</HeaderItemSubContent> <HeaderItemSubContent>Account:</HeaderItemSubContent>
<HeaderSpace /> <HeaderSpace />
Raul Millais {`${account.login}`}
</HeaderItemContent> </HeaderItemContent>
<HeaderItemIcon> <HeaderItemIcon>
<Avatar /> <Avatar />
</HeaderItemIcon> </HeaderItemIcon>
</HeaderItem> </HeaderItem>
) ) : null}
</HeaderRow> </HeaderRow>
{keys(Overlays).map(panelName => {keys(Overlays).map(panelName =>
React.createElement(Overlays[panelName], { React.createElement(Overlays[panelName], {
@ -107,23 +107,23 @@ const Navigation = ({
); );
export default compose( export default compose(
// graphql(GetAccount, { graphql(GetAccount, {
// options: () => ({ options: () => ({
// ssr: false ssr: false
// }), }),
// props: ({ data }) => { props: ({ data }) => {
// const { const {
// account = {}, account = {},
// datacenter = {}, datacenter = {},
// loading = false, loading = false,
// error = null error = null
// } = data; } = data;
// const { login } = account;
// const { name } = datacenter;
// return { login, datacenter: name, loading, error }; const { name } = datacenter;
// }
// }), return { account, datacenter: name, loading, error };
}
}),
graphql(GetHeader, { graphql(GetHeader, {
options: () => ({ options: () => ({
ssr: false ssr: false