<commit_before>var React = require('react');
var Router = require('react-router');
var RouteHandler = Router.RouteHandler;
var AppLeftNav = require('./app-left-nav.jsx');
var FullWidthSection = require('./full-width-section.jsx');
var mui = require('material-ui');
var LightRawTheme = require('material-ui/lib/styles/raw-themes/light-raw-theme');
var UserSetting = require('./svg-icons/user-setting.jsx');
var Home = require('./home.jsx');

var { AppBar,
      AppCanvas,
      FontIcon,
      IconButton,
      EnhancedButton,
      Menu,
      Mixins,
      RaisedButton,
      Styles,
      Tab,
      Tabs,
      Paper} = require('material-ui');

var RouteHandler = Router.RouteHandler;
var { Colors, Spacing, Typography } = Styles;
var ThemeManager = Styles.ThemeManager;

var DesktopGutter = mui.Styles.Spacing.desktopGutter;

class Master extends React.Component {

  constructor() {
    super();
    this._onRightIconButtonTouchTap = this._onRightIconButtonTouchTap.bind(this);
  }

  getChildContext() {
    return {
      muiTheme: ThemeManager.getMuiTheme(LightRawTheme)
    }
  }

  getInitialState() {
    return {
      tabIndex : '1',
    };
  }

  getStyles() {
    return {
      root: {
      }
    };
  }

  componentDidMount() {
    var timeout = setTimeout(
      function(){ 
        this.setState({tabIndex: this._getSelectedIndex()});
        this.context.router.transitionTo('new-asks');
      }.bind(this), 2000);

    document.addEventListener("fbLogin",
      function statusChangeCallback(e) {
        console.log('master fbLogin statusChangeCallback');
        console.log(e.detail.res);
        var response = e.detail.res;
        window.loginStatusCallback(response);
        clearTimeout(timeout);
        this.setState({tabIndex: this._getSelectedIndex()});
        this.context.router.transitionTo('new-asks');
      }.bind(this)
    );
  }

  componentWillMount(){
    this.setState({tabIndex: this._getSelectedIndex()});
    var setTabsState = function() {
      this.setState({mobileView: (document.body.clientWidth <= 647)});
      this.context.router.transitionTo('new-asks');
    }.bind(this);
    setTabsState();
    window.onresize = setTabsState;
  }

  componentWillReceiveProps() {
    this.setState({tabIndex: this._getSelectedIndex()});
  }

  _getSelectedIndex() {
    return this.context.router.isActive('new-asks') ? '1' :
      this.context.router.isActive('hot-asks') ? '2' : '0';
  }

  _handleTabChange(value, e, tab) {
    this.context.router.transitionTo(tab.props.route);
    this.setState({tabIndex: this._getSelectedIndex()});
  }

  _onRightIconButtonTouchTap() {
    if (document.fblogin === "connected") {
      this.refs.leftNav.toggle();
    }
    else {
      var valueScope = 'public_profile, email';
      FB.login(window.loginStatusCallback, { scope: valueScope });
    }
  }

  _getAppbar() {
    var styles = {
      root: {
        backgroundColor: Colors.deepPurple500,
        position: 'fixed',
        height: 64,
        top: 0,
        right: 0,
        zIndex: 4,
        width: '100%',
      },
      container: this.state.mobileView ?
      {
        position: 'absolute',
        top : Spacing.desktopKeylineIncrement,
        width: '100%',
      }
      : {
        position: 'absolute',
        right: (Spacing.desktopGutter/2) + 48,
        bottom: 0,
      },
      span: {
        color: Colors.white,
        fontWeight: Typography.fontWeightLight,
        left: 22,
        top: 22,
        position: 'absolute',
        fontSize: 26,
      },
      tabs: this.state.mobileView ?
      {
        backgroundColor: Colors.deepPurple500,
        width: '100%',
        bottom:0,
      }
      : {
        backgroundColor: Colors.deepPurple500,
        width: 200,
        bottom:0,
      },
      tabItemContainerStyle: {
        backgroundColor: Colors.deepPurple500,
      },
      inkBarStyle : {
        backgroundColor : Colors.grey200,
        height: 5,
        marginTop: -5
      },
      tab: this.state.mobileView ?
      {
        backgroundColor: Colors.deepPurple500,
        height: 48,
        fontWeight: 'bold',
      }
      : {
        backgroundColor: Colors.deepPurple500,
        height: 64,
        fontWeight: 'bold',
      },<commit_msg>[client] master:modified tab size for clear view<commit_after>var React = require('react');
var Router = require('react-router');
var RouteHandler = Router.RouteHandler;
var AppLeftNav = require('./app-left-nav.jsx');
var FullWidthSection = require('./full-width-section.jsx');
var mui = require('material-ui');
var LightRawTheme = require('material-ui/lib/styles/raw-themes/light-raw-theme');
var UserSetting = require('./svg-icons/user-setting.jsx');
var Home = require('./home.jsx');

var { AppBar,
      AppCanvas,
      FontIcon,
      IconButton,
      EnhancedButton,
      Menu,
      Mixins,
      RaisedButton,
      Styles,
      Tab,
      Tabs,
      Paper} = require('material-ui');

var RouteHandler = Router.RouteHandler;
var { Colors, Spacing, Typography } = Styles;
var ThemeManager = Styles.ThemeManager;

var DesktopGutter = mui.Styles.Spacing.desktopGutter;

class Master extends React.Component {

  constructor() {
    super();
    this._onRightIconButtonTouchTap = this._onRightIconButtonTouchTap.bind(this);
  }

  getChildContext() {
    return {
      muiTheme: ThemeManager.getMuiTheme(LightRawTheme)
    }
  }

  getInitialState() {
    return {
      tabIndex : '1',
    };
  }

  getStyles() {
    return {
      root: {
      }
    };
  }

  componentDidMount() {
    var timeout = setTimeout(
      function(){ 
        this.setState({tabIndex: this._getSelectedIndex()});
        this.context.router.transitionTo('new-asks');
      }.bind(this), 2000);

    document.addEventListener("fbLogin",
      function statusChangeCallback(e) {
        console.log('master fbLogin statusChangeCallback');
        console.log(e.detail.res);
        var response = e.detail.res;
        window.loginStatusCallback(response);
        clearTimeout(timeout);
        this.setState({tabIndex: this._getSelectedIndex()});
        this.context.router.transitionTo('new-asks');
      }.bind(this)
    );
  }

  componentWillMount(){
    this.setState({tabIndex: this._getSelectedIndex()});
    var setTabsState = function() {
      this.setState({mobileView: (document.body.clientWidth <= 647)});
      this.context.router.transitionTo('new-asks');
    }.bind(this);
    setTabsState();
    window.onresize = setTabsState;
  }

  componentWillReceiveProps() {
    this.setState({tabIndex: this._getSelectedIndex()});
  }

  _getSelectedIndex() {
    return this.context.router.isActive('new-asks') ? '1' :
      this.context.router.isActive('hot-asks') ? '2' : '0';
  }

  _handleTabChange(value, e, tab) {
    this.context.router.transitionTo(tab.props.route);
    this.setState({tabIndex: this._getSelectedIndex()});
  }

  _onRightIconButtonTouchTap() {
    if (document.fblogin === "connected") {
      this.refs.leftNav.toggle();
    }
    else {
      var valueScope = 'public_profile, email';
      FB.login(window.loginStatusCallback, { scope: valueScope });
    }
  }

  _getAppbar() {
    var styles = {
      root: {
        backgroundColor: Colors.deepPurple500,
        position: 'fixed',
        height: 64,
        top: 0,
        right: 0,
        zIndex: 4,
        width: '100%',
      },
      container: this.state.mobileView ?
      {
        position: 'absolute',
        top : Spacing.desktopKeylineIncrement,
        width: '100%',
      }
      : {
        position: 'absolute',
        right: (Spacing.desktopGutter/2) + 48,
        bottom: 0,
      },
      span: {
        color: Colors.white,
        fontWeight: Typography.fontWeightLight,
        left: 22,
        top: 22,
        position: 'absolute',
        fontSize: 26,
      },
      tabs: this.state.mobileView ?
      {
        backgroundColor: Colors.deepPurple500,
        width: '100%',
        bottom:0,
      }
      : {
        backgroundColor: Colors.deepPurple500,
        width: 300,
        bottom:0,
      },
      tabItemContainerStyle: {
        backgroundColor: Colors.deepPurple500,
      },
      inkBarStyle : {
        backgroundColor : Colors.grey200,
        height: 8,
        marginTop: -8
      },
      tab: this.state.mobileView ?
      {
        backgroundColor: Colors.deepPurple500,
        height: 52,
        fontWeight: 'bold',
      }
      : {
        backgroundColor: Colors.deepPurple500,
        height: 64,
        fontWeight: 'bold',
      },
{'fraction_non_alphanumeric': 0.13412205692866347, 'fraction_numerical': 0.01569638046152044, 'mean_word_length': 2.435814889336016, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4134860', 'n_tokens_mistral': 2793, 'n_tokens_neox': 2633, 'n_words': 456}