<commit_before>// Libraries
import React, {PureComponent} from 'react'
import {withRouter, WithRouterProps, Link} from 'react-router'
import {connect} from 'react-redux'
import _ from 'lodash'

// Components
import {NavMenu, Icon} from '@influxdata/clockface'
import CloudNav from 'src/pageLayout/components/CloudNav'
import AccountNavSubItem from 'src/pageLayout/components/AccountNavSubItem'

// Utils
import {getNavItemActivation} from 'src/pageLayout/utils'

// Types
import {AppState} from 'src/types'
import {IconFont} from '@influxdata/clockface'
import {Organization} from '@influxdata/influx'

// Decorators
import {ErrorHandling} from 'src/shared/decorators/errors'

interface StateProps {
  isHidden: boolean
  me: AppState['me']
  orgs: Organization[]
  orgName: string
}

interface State {
  isShowingOrganizations: boolean
}

type Props = StateProps & WithRouterProps

@ErrorHandling
class SideNav extends PureComponent<Props, State> {
  constructor(props) {
    super(props)

    this.state = {
      isShowingOrganizations: false,
    }
  }

  public render() {
    const {
      isHidden,
      me,
      params: {orgID},
      orgs,
      orgName,
    } = this.props

    if (isHidden) {
      return null
    }

    const orgPrefix = `/orgs/${orgID}`
    const dashboardsLink = `${orgPrefix}/dashboards`
    const dataExplorerLink = `${orgPrefix}/data-explorer`
    const tasksLink = `${orgPrefix}/tasks`
    const settingsLink = `${orgPrefix}/settings`
    const feedbackLink =
      'https://docs.google.com/forms/d/e/1FAIpQLSdGJpnIZGotN1VFJPkgZEhrt4t4f6QY1lMgMSRUnMeN3FjCKA/viewform?usp=sf_link'

    return (
      <NavMenu>
        <div onMouseLeave={this.closeOrganizationsView} className="find-me">
          <NavMenu.Item
            titleLink={className => (
              <Link className={className} to={orgPrefix}>
                {`${me.name} (${orgName})`}
              </Link>
            )}
            iconLink={className => (
              <Link to={orgPrefix} className={className}>
                <Icon glyph={IconFont.CuboNav} />
              </Link>
            )}
            active={getNavItemActivation(['me', 'account'], location.pathname)}
          >
            <AccountNavSubItem
              orgs={orgs}
              isShowingOrganizations={this.state.isShowingOrganizations}
              showOrganizationsView={this.showOrganizationsView}
              closeOrganizationsView={this.closeOrganizationsView}
            />
          </NavMenu.Item>
        </div>
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={dataExplorerLink}>
              Data Explorer
            </Link>
          )}
          iconLink={className => (
            <Link to={dataExplorerLink} className={className}>
              <Icon glyph={IconFont.GraphLine} />
            </Link>
          )}
          active={getNavItemActivation(['data-explorer'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={dashboardsLink}>
              Dashboards
            </Link>
          )}
          iconLink={className => (
            <Link to={dashboardsLink} className={className}>
              <Icon glyph={IconFont.Dashboards} />
            </Link>
          )}
          active={getNavItemActivation(['dashboards'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={tasksLink}>
              Tasks
            </Link>
          )}
          iconLink={className => (
            <Link to={tasksLink} className={className}>
              <Icon glyph={IconFont.Calendar} />
            </Link>
          )}
          active={getNavItemActivation(['tasks'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={settingsLink}>
              Settings
            </Link>
          )}
          iconLink={className => (
            <Link to={settingsLink} className={className}>
              <Icon glyph={IconFont.Wrench} />
            </Link>
          )}
          active={getNavItemActivation(['settings'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <a className={className} href={feedbackLink} target="_blank">
              Feedback
            </a>
          )}
          iconLink={className => (
            <a href={feedbackLink} className={className} target="_blank">
              <Icon glyph={IconFont.NavChat} />
            </a>
          )}
          active={getNavItemActivation(['feedback'], location.pathname)}
        />
        <CloudNav />
      </NavMenu>
    )
  }

  private showOrganizationsView = (): void => {
    this.setState({isShowingOrganizations: true})
  }

  private closeOrganizationsView = (): void => {
    this.setState({isShowingOrganizations: false})
  }
}

const mstp = (state: AppState): StateProps => {<commit_msg>Put feedback nav item below the cloud nav item<commit_after>// Libraries
import React, {PureComponent} from 'react'
import {withRouter, WithRouterProps, Link} from 'react-router'
import {connect} from 'react-redux'
import _ from 'lodash'

// Components
import {NavMenu, Icon} from '@influxdata/clockface'
import CloudNav from 'src/pageLayout/components/CloudNav'
import AccountNavSubItem from 'src/pageLayout/components/AccountNavSubItem'

// Utils
import {getNavItemActivation} from 'src/pageLayout/utils'

// Types
import {AppState} from 'src/types'
import {IconFont} from '@influxdata/clockface'
import {Organization} from '@influxdata/influx'

// Decorators
import {ErrorHandling} from 'src/shared/decorators/errors'

interface StateProps {
  isHidden: boolean
  me: AppState['me']
  orgs: Organization[]
  orgName: string
}

interface State {
  isShowingOrganizations: boolean
}

type Props = StateProps & WithRouterProps

@ErrorHandling
class SideNav extends PureComponent<Props, State> {
  constructor(props) {
    super(props)

    this.state = {
      isShowingOrganizations: false,
    }
  }

  public render() {
    const {
      isHidden,
      me,
      params: {orgID},
      orgs,
      orgName,
    } = this.props

    if (isHidden) {
      return null
    }

    const orgPrefix = `/orgs/${orgID}`
    const dashboardsLink = `${orgPrefix}/dashboards`
    const dataExplorerLink = `${orgPrefix}/data-explorer`
    const tasksLink = `${orgPrefix}/tasks`
    const settingsLink = `${orgPrefix}/settings`
    const feedbackLink =
      'https://docs.google.com/forms/d/e/1FAIpQLSdGJpnIZGotN1VFJPkgZEhrt4t4f6QY1lMgMSRUnMeN3FjCKA/viewform?usp=sf_link'

    return (
      <NavMenu>
        <div onMouseLeave={this.closeOrganizationsView} className="find-me">
          <NavMenu.Item
            titleLink={className => (
              <Link className={className} to={orgPrefix}>
                {`${me.name} (${orgName})`}
              </Link>
            )}
            iconLink={className => (
              <Link to={orgPrefix} className={className}>
                <Icon glyph={IconFont.CuboNav} />
              </Link>
            )}
            active={getNavItemActivation(['me', 'account'], location.pathname)}
          >
            <AccountNavSubItem
              orgs={orgs}
              isShowingOrganizations={this.state.isShowingOrganizations}
              showOrganizationsView={this.showOrganizationsView}
              closeOrganizationsView={this.closeOrganizationsView}
            />
          </NavMenu.Item>
        </div>
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={dataExplorerLink}>
              Data Explorer
            </Link>
          )}
          iconLink={className => (
            <Link to={dataExplorerLink} className={className}>
              <Icon glyph={IconFont.GraphLine} />
            </Link>
          )}
          active={getNavItemActivation(['data-explorer'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={dashboardsLink}>
              Dashboards
            </Link>
          )}
          iconLink={className => (
            <Link to={dashboardsLink} className={className}>
              <Icon glyph={IconFont.Dashboards} />
            </Link>
          )}
          active={getNavItemActivation(['dashboards'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={tasksLink}>
              Tasks
            </Link>
          )}
          iconLink={className => (
            <Link to={tasksLink} className={className}>
              <Icon glyph={IconFont.Calendar} />
            </Link>
          )}
          active={getNavItemActivation(['tasks'], location.pathname)}
        />
        <NavMenu.Item
          titleLink={className => (
            <Link className={className} to={settingsLink}>
              Settings
            </Link>
          )}
          iconLink={className => (
            <Link to={settingsLink} className={className}>
              <Icon glyph={IconFont.Wrench} />
            </Link>
          )}
          active={getNavItemActivation(['settings'], location.pathname)}
        />
        <CloudNav />
        <NavMenu.Item
          titleLink={className => (
            <a className={className} href={feedbackLink} target="_blank">
              Feedback
            </a>
          )}
          iconLink={className => (
            <a href={feedbackLink} className={className} target="_blank">
              <Icon glyph={IconFont.NavChat} />
            </a>
          )}
          active={getNavItemActivation(['feedback'], location.pathname)}
        />
      </NavMenu>
    )
  }

  private showOrganizationsView = (): void => {
    this.setState({isShowingOrganizations: true})
  }

  private closeOrganizationsView = (): void => {
    this.setState({isShowingOrganizations: false})
  }
}

const mstp = (state: AppState): StateProps => {
{'fraction_non_alphanumeric': 0.12619918900207694, 'fraction_numerical': 0.0013846306003362674, 'mean_word_length': 2.137449581135588, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 121, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3613168', 'n_tokens_mistral': 2859, 'n_tokens_neox': 2790, 'n_words': 504}