<commit_before>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { replaceComponent } from 'meteor/vulcan:core';

import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';
import Checkbox from '@material-ui/core/Checkbox';

import { withTheme, withStyles } from '@material-ui/core/styles';
import classNames from 'classnames';
import withUser from '../common/withUser';
import { withRouter } from 'react-router'

const styles = theme => ({
  formSubmit: {
    display: "flex",
    justifyContent: "flex-end",
    flexWrap: "wrap",
  },
  formButton: {
    paddingBottom: 4,
    fontFamily: theme.typography.commentStyle.fontFamily,
    fontSize: 16,
    marginLeft: 5,
    fontWeight: 500,
    flexGrow:1,
    "&:hover": {
      background: "rgba(0,0,0, 0.05)",
    }
  },

  secondaryButton: {
    color: "rgba(0,0,0,0.4)",
  },

  submitButton: {
    color: theme.palette.secondary.main,
    maxWidth:100,
  },
  submitToFrontpageWrapper: {
    flexGrow: 3,
    [theme.breakpoints.down('sm')]: {
      width: "100%",
      order:1
    }
  },
  submitToFrontpage: {
    display: "flex",
    alignItems: "center",
    maxWidth: 300,
    [theme.breakpoints.down('sm')]: {
      width: "100%",
      maxWidth: "none",
      justifyContent: "flex-end",
      paddingRight: theme.spacing.unit*3,
    }
  },
  checkboxLabel: {
    fontWeight:500,
    fontFamily: theme.typography.commentStyle.fontFamily,
    fontSize: 16,
    color: "rgba(0,0,0,0.4)",
  },
  tooltip: {
    '& ul': {
      paddingTop: 0,
      paddingBottom: 0,
      marginTop: theme.spacing.unit/2,
      paddingLeft: theme.spacing.unit*3,
    },
    '& p': {
      marginTop: theme.spacing.unit/2,
      marginBottom: theme.spacing.unit/2
    }
  },
  guidelines: {
    fontStyle: "italic"
  },
  cancelButton: {
    flexGrow:1,
    [theme.breakpoints.up('md')]: {
      display: "none"
    }
  },
  draft: {
    maxWidth:150,
  }
});

class PostSubmit extends PureComponent {

  constructor(props) {
    super(props);
    this.state = {
      submitToFrontpage: true,
    };
  }

  render() {
    const { submitLabel = "Submit", cancelLabel = "Cancel", cancelCallback, document, collectionName, classes } = this.props

    const { updateCurrentValues } = this.context
    const eventForm = this.props.router.location.query && this.props.router.location.query.eventForm;
    const submitToFrontpage = this.state.submitToFrontpage && !eventForm

    return (
      <div className={classes.formSubmit}>
        <div className={classes.submitToFrontpageWrapper}>
            <Tooltip title={<div className={classes.tooltip}>
                <p>LW moderators will consider this post for frontpage</p>
                <p className={classes.guidelines}>Things to aim for:</p>
                <ul>
                  <li className={classes.guidelines}>
                    Usefulness, novelty and fun
                  </li>
                  <li className={classes.guidelines}>
                    Timeless content (minimize reference to current events)
                  </li>
                  <li className={classes.guidelines}>
                    Explain rather than persuade
                  </li>
                </ul>
              </div>
              }>
              <div className={classes.submitToFrontpage}>
                {!eventForm && <div>
                  <Checkbox checked={submitToFrontpage} onClick={() => this.setState({submitToFrontpage: !submitToFrontpage})}/>
                  <span className={classes.checkboxLabel}>Moderators may promote</span></div>}
              </div>
            </Tooltip>
        </div>
<commit_msg>Cleanup PR issues<commit_after>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { replaceComponent } from 'meteor/vulcan:core';

import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';
import Checkbox from '@material-ui/core/Checkbox';

import { withTheme, withStyles } from '@material-ui/core/styles';
import classNames from 'classnames';
import withUser from '../common/withUser';
import { withRouter } from 'react-router'

const styles = theme => ({
  formSubmit: {
    display: "flex",
    justifyContent: "flex-end",
    flexWrap: "wrap",
  },
  formButton: {
    paddingBottom: 4,
    fontFamily: theme.typography.commentStyle.fontFamily,
    fontSize: 16,
    marginLeft: 5,
    fontWeight: 500,
    flexGrow:1,
    "&:hover": {
      background: "rgba(0,0,0, 0.05)",
    }
  },

  secondaryButton: {
    color: "rgba(0,0,0,0.4)",
  },

  submitButton: {
    color: theme.palette.secondary.main,
    maxWidth:100,
  },
  submitToFrontpageWrapper: {
    flexGrow: 3,
    [theme.breakpoints.down('sm')]: {
      width: "100%",
      order:1
    }
  },
  submitToFrontpage: {
    display: "flex",
    alignItems: "center",
    maxWidth: 300,
    [theme.breakpoints.down('sm')]: {
      width: "100%",
      maxWidth: "none",
      justifyContent: "flex-end",
      paddingRight: theme.spacing.unit*3,
    }
  },
  checkboxLabel: {
    fontWeight:500,
    fontFamily: theme.typography.commentStyle.fontFamily,
    fontSize: 16,
    color: "rgba(0,0,0,0.4)",
  },
  tooltip: {
    '& ul': {
      paddingTop: 0,
      paddingBottom: 0,
      marginTop: theme.spacing.unit/2,
      paddingLeft: theme.spacing.unit*3,
    },
    '& p': {
      marginTop: theme.spacing.unit/2,
      marginBottom: theme.spacing.unit/2
    }
  },
  guidelines: {
    fontStyle: "italic"
  },
  cancelButton: {
    flexGrow:1,
    [theme.breakpoints.up('md')]: {
      display: "none"
    }
  },
  draft: {
    maxWidth:150,
  }
});

class PostSubmit extends PureComponent {
  state = { submitToFrontpage: true }

  render() {
    const { submitLabel = "Submit", cancelLabel = "Cancel", cancelCallback, document, collectionName, classes, router } = this.props

    const { updateCurrentValues } = this.context
    
    // FIXME: Have this use something other than a query parameter so that (among possible other things) it doesn't behave weird when you open a question dialog while viewing an editEvent page
    const eventForm = router.location && router.location.query && router.location.query.eventForm;
    const submitToFrontpage = this.state.submitToFrontpage && !eventForm

    return (
      <div className={classes.formSubmit}>
        <div className={classes.submitToFrontpageWrapper}>
          <Tooltip title={<div className={classes.tooltip}>
              <p>LW moderators will consider this post for frontpage</p>
              <p className={classes.guidelines}>Things to aim for:</p>
              <ul>
                <li className={classes.guidelines}>
                  Usefulness, novelty and fun
                </li>
                <li className={classes.guidelines}>
                  Timeless content (minimize reference to current events)
                </li>
                <li className={classes.guidelines}>
                  Explain rather than persuade
                </li>
              </ul>
            </div>
            }>
            <div className={classes.submitToFrontpage}>
              {!eventForm && <div>
                <Checkbox checked={submitToFrontpage} onClick={() => this.setState({submitToFrontpage: !submitToFrontpage})}/>
                <span className={classes.checkboxLabel}>Moderators may promote</span></div>}
            </div>
          </Tooltip>
        </div>

{'fraction_non_alphanumeric': 0.13342245989304813, 'fraction_numerical': 0.014438502673796792, 'mean_word_length': 2.4570240295748613, 'pattern_counts': {'":': 2, '<': 55, '<?xml version=': 0, '>': 59, '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': '6031635', 'n_tokens_mistral': 2340, 'n_tokens_neox': 2234, 'n_words': 485}