import React from 'react';

import './style';
import Auth from '../Auth';
import BoardSelector from '../BoardSelector';
import { asanaUrl } from '../../utils'

const Header = ({auth, projectName, projectId}) => {

  let headerButton = <Auth />;
  if (auth.isAsanaAuthed) {
    let url = asanaUrl();

    if (projectId !== null) {
      url = url + `0/${projectId}`;
    }

    headerButton = <a className="header__cta cta" href={url} target="_blank">Open asana</a>;
  }

  return (
    <header className="header">
      <div className="pure-u-8-24">
        <div className="header__breadcrumbs">
          <BoardSelector />
          <span className="header__current-project">{projectName}</span>
        </div>
      </div>
      <div className="pure-u-8-24 header__logo__wrapper">
        <img className="header__logo" src="logo.jpg" />
      </div>
      <div className="pure-u-8-24">
        <div className="pull-right">
          {headerButton}
        </div>
      </div>
    </header>
  )
}


export default Header;

import React from 'react';

import './style';
import Auth from '../Auth';
import BoardSelector from '../BoardSelector';
import { asanaUrl } from '../../utils'

const Header = ({auth, projectName, projectId}) => {

  let headerButton = <Auth />;
  if (auth.isAsanaAuthed) {
    let url = asanaUrl();

    if (projectId !== null) {
      url = url + `0/${projectId}`;
    }

    headerButton = <a className="header__cta cta" href={url} target="_blank">Open asana</a>;
  }

  return (
    <header className="header">
      <div className="pure-u-8-24">
        <div className="header__breadcrumbs">
          { auth.isAsanaAuthed && <BoardSelector /> }
          <span className="header__current-project">{projectName}</span>
        </div>
      </div>
      <div className="pure-u-8-24 header__logo__wrapper">
        <img className="header__logo" src="logo.jpg" />
      </div>
      <div className="pure-u-8-24">
        <div className="pull-right">
          {headerButton}
        </div>
      </div>
    </header>
  )
}


export default Header;

Hide projects button when not authed
Hide projects button when not authed
