<commit_before>import React, { Component, PropTypes } from 'react';
import Relay from 'react-relay';
import { Link } from 'react-router';
import FontAwesome from 'react-fontawesome';
import CreateProject from './project/CreateProject';
import TeamRoute from '../relay/TeamRoute';
import teamFragment from '../relay/teamFragment';
import SwitchTeams from './team/SwitchTeams';

class TeamSidebarComponent extends Component {
  constructor(props) {
    super(props);

    this.state = {
      isSwitchTeamsActive: false
    };
  }

  handleSwitchTeams() {
    this.setState({isSwitchTeamsActive: true});
  }

  handleSwitchTeamsClose() {
    this.setState({isSwitchTeamsActive: false});
  }

  isCurrentProject(projectId) {
    var inProject = window.location.pathname.match(/\/project\/([0-9]+)/),
        currentProjectId = null;

    if (inProject) {
      currentProjectId = parseInt(inProject[1]);
    }
    else if (Checkdesk.context.project) {
      currentProjectId = Checkdesk.context.project.dbid;
    }

    return projectId === currentProjectId;
  }

  render() {
    var currentTeam = this.props.team;

    return (
      <nav className='team-sidebar'>
        <section className='team-sidebar__projects'>
          <h2 className='team-sidebar__projects-heading'>Verification Projects</h2>
          {(() => {
            if (currentTeam) {
              return (
                <ul className='team-sidebar__projects-list'>
                  {currentTeam.projects.edges.map(p => (
                    <li className={'team-sidebar__project' + (this.isCurrentProject(p.node.dbid) ? ' team-sidebar__project--current' : '')}>
                      <Link to={'/project/' + p.node.dbid} className='team-sidebar__project-link'>{p.node.title}</Link>
                    </li>
                  ))}
                  <li className='team-sidebar__new-project'>
                    <CreateProject className='team-sidebar__new-project-input' team={currentTeam} />
                  </li>
                </ul>
              );
            }
          })()}
        </section>

        {/*
        <section className='team-sidebar__sources'>
          <h2 className='team-sidebar__sources-heading'>
          {(() => {
            if (currentTeam) {
              return (
                <Link to={'/sources'} id="link-sources" className='team-sidebar__sources-link' activeClassName='team-sidebar__sources-link--active' title="Sources">Sources</Link>
              );
            }
          })()}
          </h2>
          <ul className='team-sidebar__sources-list'>
            {(() => {
              if (currentTeam) {
                return (
                  <li className='team-sidebar__new-source'>
                    <FontAwesome className='team-sidebar__new-source-icon' name='user' />
                    <Link to={'/sources/new'} id="link-sources-new" className='team-sidebar__new-source-link' activeClassName='team-sidebar__new-source-link--active' title="Create a source">New source...</Link>
                  </li>
                );
              }
            })()}
          </ul>
        </section>
        */}

        <footer className='team-sidebar__footer'>
          <button onClick={this.handleSwitchTeams.bind(this)} className='team-sidebar__switch-teams-button'>
            <FontAwesome className='team-sidebar__switch-teams-icon' name='random' />
            <span>Switch Teams</span><commit_msg>Clarify variable & delete comments in TeamSidebar<commit_after>import React, { Component, PropTypes } from 'react';
import Relay from 'react-relay';
import { Link } from 'react-router';
import FontAwesome from 'react-fontawesome';
import CreateProject from './project/CreateProject';
import TeamRoute from '../relay/TeamRoute';
import teamFragment from '../relay/teamFragment';
import SwitchTeams from './team/SwitchTeams';

class TeamSidebarComponent extends Component {
  constructor(props) {
    super(props);

    this.state = {
      isSwitchTeamsActive: false
    };
  }

  handleSwitchTeams() {
    this.setState({isSwitchTeamsActive: true});
  }

  handleSwitchTeamsClose() {
    this.setState({isSwitchTeamsActive: false});
  }

  isCurrentProject(projectId) {
    var inProject = window.location.pathname.match(/\/project\/([0-9]+)/),
        currentProjectId = null;

    if (inProject) {
      currentProjectId = parseInt(inProject[1]);
    }
    else if (Checkdesk.context.project) {
      currentProjectId = Checkdesk.context.project.dbid;
    }

    return projectId === currentProjectId;
  }

  render() {
    var team = this.props.team;

    return (
      <nav className='team-sidebar'>
        <section className='team-sidebar__projects'>
          <h2 className='team-sidebar__projects-heading'>Verification Projects</h2>
          {(() => {
            if (team) {
              return (
                <ul className='team-sidebar__projects-list'>
                  {team.projects.edges.map(p => (
                    <li className={'team-sidebar__project' + (this.isCurrentProject(p.node.dbid) ? ' team-sidebar__project--current' : '')}>
                      <Link to={'/project/' + p.node.dbid} className='team-sidebar__project-link'>{p.node.title}</Link>
                    </li>
                  ))}
                  <li className='team-sidebar__new-project'>
                    <CreateProject className='team-sidebar__new-project-input' team={team} />
                  </li>
                </ul>
              );
            }
          })()}
        </section>

        <footer className='team-sidebar__footer'>
          <button onClick={this.handleSwitchTeams.bind(this)} className='team-sidebar__switch-teams-button'>
            <FontAwesome className='team-sidebar__switch-teams-icon' name='random' />
            <span>Switch Teams</span>
{'fraction_non_alphanumeric': 0.13862579645255727, 'fraction_numerical': 0.002066471499913897, 'mean_word_length': 2.253781512605042, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 60, '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': '1863248', 'n_tokens_mistral': 1625, 'n_tokens_neox': 1588, 'n_words': 264}