<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Switch, Route, Redirect, withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';

import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
import Snackbar from 'material-ui/Snackbar';

import ActionBar from '../components/ActionBar';
import FilterBar from '../components/FilterBar';
import Welcome from '../components/Welcome';
import NavigationDrawer from '../components/NavigationDrawer';

import Listings from './Listings';
import Listing from './Listing';
import Seeks from './Seeks';
import Seek from './Seek';
import SavedSearches from './SavedSearches';
import ComposeOverlay from '../components/ComposeOverlay';

import { loadCurrentUser } from '../actions/users';
import {
  setComposeState,
  hideSnackbar,
} from '../actions/ui';

const mapStateToProps = state => ({
  loading: state.currentUserLoading,
  user: state.currentUser,
  snackbar: state.snackbar,
  showFAB: !state.composeState.show,
  displayMode: state.displayMode,
});

@withRouter
@connect(mapStateToProps)
export default class App extends Component {
  static propTypes = {
    displayMode: PropTypes.string.isRequired,
    showFAB: PropTypes.bool.isRequired,
    snackbar: PropTypes.shape({
      open: PropTypes.bool.isRequired,
      message: PropTypes.string.isRequired,
    }).isRequired,
    dispatch: PropTypes.func.isRequired,
    loading: PropTypes.bool.isRequired,
    user: PropTypes.shape({
      loggedIn: PropTypes.bool.isRequired,
    }).isRequired,
  }

  static styles = {
    fab: {
      position: 'fixed',
      bottom: '35px',
      right: '35px',
    },
  }

  componentWillMount() {
    this.props.dispatch(loadCurrentUser());
  }

  handleSnackbarRequestClose = () => {
    this.props.dispatch(hideSnackbar());
  }

  render() {
    const styles = App.styles;

    return (
      <div className="App">
        <ActionBar user={this.props.user} loading={this.props.loading} />
        <NavigationDrawer>
          <FilterBar />

          <div style={{ marginBottom: '5.5rem' }} />

          { (!this.props.loading && !this.props.user.loggedIn) &&
            <Welcome />
          }

          <Switch>
            <Route exact path="/">
              <Redirect push to="/listings" />
            </Route>
            <Route path="/listings/:type?" component={Listings} />
            <Route path="/listing/:id" component={Listing} />
            <Route path="/seeks/:type?" component={Seeks} />
            <Route path="/seek/:id" component={Seek} />
            <Route path="/savedsearches" component={SavedSearches} />
          </Switch>
        </NavigationDrawer>

        { this.props.showFAB ?
          <FloatingActionButton
            style={styles.fab}
            onTouchTap={
              () => this.props.dispatch(setComposeState(true, false, this.props.displayMode))<commit_msg>Fix conditional padding under FilterBar<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Switch, Route, Redirect, withRouter } from 'react-router-dom';
import PropTypes from 'prop-types';

import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
import Snackbar from 'material-ui/Snackbar';

import ActionBar from '../components/ActionBar';
import FilterBar from '../components/FilterBar';
import Welcome from '../components/Welcome';
import NavigationDrawer from '../components/NavigationDrawer';

import Listings from './Listings';
import Listing from './Listing';
import Seeks from './Seeks';
import Seek from './Seek';
import SavedSearches from './SavedSearches';
import ComposeOverlay from '../components/ComposeOverlay';

import { loadCurrentUser } from '../actions/users';
import {
  setComposeState,
  hideSnackbar,
} from '../actions/ui';

const mapStateToProps = state => ({
  loading: state.currentUserLoading,
  user: state.currentUser,
  snackbar: state.snackbar,
  showFAB: !state.composeState.show,
  displayMode: state.displayMode,
});

@withRouter
@connect(mapStateToProps)
export default class App extends Component {
  static propTypes = {
    displayMode: PropTypes.string.isRequired,
    showFAB: PropTypes.bool.isRequired,
    snackbar: PropTypes.shape({
      open: PropTypes.bool.isRequired,
      message: PropTypes.string.isRequired,
    }).isRequired,
    dispatch: PropTypes.func.isRequired,
    loading: PropTypes.bool.isRequired,
    user: PropTypes.shape({
      loggedIn: PropTypes.bool.isRequired,
    }).isRequired,
    location: PropTypes.shape({
      pathname: PropTypes.string.isRequired,
    }).isRequired,
  }

  static styles = {
    fab: {
      position: 'fixed',
      bottom: '35px',
      right: '35px',
    },
    filterBarListings: {
      marginBottom: '5.5rem',
    },
    filterBarSeeks: {
      marginBottom: '3.5rem',
    },
    filterBarNotVisible: {
      marginBottom: '2rem',
    },
  }

  componentWillMount() {
    this.props.dispatch(loadCurrentUser());
  }

  handleSnackbarRequestClose = () => {
    this.props.dispatch(hideSnackbar());
  }

  render() {
    const styles = App.styles;
    // eslint-disable-next-line no-nested-ternary
    const filterPadding = this.props.location.pathname.startsWith('/listings')
      ? styles.filterBarListings : (this.props.location.pathname.startsWith('/seeks')
      ? styles.filterBarSeeks : styles.filterBarNotVisible);

    return (
      <div className="App">
        <ActionBar user={this.props.user} loading={this.props.loading} />
        <NavigationDrawer>
          <FilterBar />

          <div style={filterPadding} />

          { (!this.props.loading && !this.props.user.loggedIn) &&
            <Welcome />
          }

          <Switch>
            <Route exact path="/">
              <Redirect push to="/listings" />
            </Route>
            <Route path="/listings/:type?" component={Listings} />
            <Route path="/listing/:id" component={Listing} />
            <Route path="/seeks/:type?" component={Seeks} />
            <Route path="/seek/:id" component={Seek} />
            <Route path="/savedsearches" component={SavedSearches} />
          </Switch>
        </NavigationDrawer>

        { this.props.showFAB ?
          <FloatingActionButton
            style={styles.fab}
            onTouchTap={
              () => this.props.dispatch(setComposeState(true, false, this.props.displayMode))
{'fraction_non_alphanumeric': 0.13762587732682333, 'fraction_numerical': 0.0022886786695148, 'mean_word_length': 2.9775485436893203, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 43, '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': '2201077', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1924, 'n_words': 400}