<commit_before>// @flow
/* eslint-disable react/prefer-stateless-function */

import React from "react";
import { Link, withRouter } from "react-router-dom";
import { Layout, Menu, Icon } from "antd";
import { connect } from "react-redux";
import Request from "libs/request";
import LoginView from "admin/views/auth/login_view";

import type { OxalisState } from "oxalis/store";
import type { APIUserType } from "admin/api_flow_types";
import type { ReactRouterHistoryType } from "react_router";

const { SubMenu } = Menu;
const { Header } = Layout;

type StateProps = {
  activeUser: ?APIUserType,
};

type Props = {
  isAuthenticated: boolean,
  history: ReactRouterHistoryType,
} & StateProps;

class Navbar extends React.PureComponent<Props> {
  render() {
    const navbarStyle = {
      padding: 0,
      position: "fixed",
      width: "100%",
      zIndex: 1000,
      height: 48,
      display: "flex",
      alignItems: "center",
      color: "rgba(255, 255, 255, 0.67)",
      background: "#404040",
    };

    const isAuthenticated = this.props.isAuthenticated && this.props.activeUser != null;

    return (
      <Header style={navbarStyle}>
        <Menu
          mode="horizontal"
          defaultSelectedkeys={[this.props.history.location.pathname]}
          style={{ lineHeight: "48px", flex: isAuthenticated ? "1" : undefined }}
          theme="dark"
        >
          <Menu.Item key="0">
            <Link to="/" style={{ fontWeight: 400 }}>
              <span className="logo" />
              webKnossos
            </Link>
          </Menu.Item>
          {isAuthenticated
            ? [
                <Menu.Item key="/dashboard">
                  <Link to="/dashboard">
                    <Icon type="home" />
                    Dashboard
                  </Link>
                </Menu.Item>,
                <SubMenu<commit_msg>fixed flow #1194<commit_after>// @flow
/* eslint-disable react/prefer-stateless-function */

import React from "react";
import { Link, withRouter } from "react-router-dom";
import { Layout, Menu, Icon } from "antd";
import { connect } from "react-redux";
import Request from "libs/request";
import LoginView from "admin/views/auth/login_view";

import type { OxalisState } from "oxalis/store";
import type { APIUserType } from "admin/api_flow_types";
import type { ReactRouterHistoryType } from "react_router";

const { SubMenu } = Menu;
const { Header } = Layout;

type StateProps = {
  activeUser: ?APIUserType,
};

type Props = {
  isAuthenticated: boolean,
  history: ReactRouterHistoryType,
} & StateProps;

class Navbar extends React.PureComponent<Props> {
  render() {
    const navbarStyle = {
      padding: 0,
      position: "fixed",
      width: "100%",
      zIndex: 1000,
      height: 48,
      display: "flex",
      alignItems: "center",
      color: "rgba(255, 255, 255, 0.67)",
      background: "#404040",
    };

    const isAuthenticated = this.props.isAuthenticated && this.props.activeUser != null;

    return (
      <Header style={navbarStyle}>
        <Menu
          mode="horizontal"
          defaultSelectedkeys={[this.props.history.location.pathname]}
          style={{ lineHeight: "48px", flex: isAuthenticated ? "1" : undefined }}
          theme="dark"
        >
          <Menu.Item key="0">
            <Link to="/" style={{ fontWeight: 400 }}>
              <span className="logo" />
              webKnossos
            </Link>
          </Menu.Item>
          {isAuthenticated && this.props.activeUser != null
            ? [
                <Menu.Item key="/dashboard">
                  <Link to="/dashboard">
                    <Icon type="home" />
                    Dashboard
                  </Link>
                </Menu.Item>,
                <SubMenu
{'fraction_non_alphanumeric': 0.1327503974562798, 'fraction_numerical': 0.0196078431372549, 'mean_word_length': 2.2127659574468086, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 29, 'https://': 0, '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': '103694', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1097, 'n_words': 269}