<commit_before>import React from 'react/addons';
import {merge} from '../../../merge';
import {KButton} from '../../KButton';
import Gripper from '../../DynamicIcons/Gripper';
import {DragSource, DropTarget} from 'react-dnd';
import ConfigActions from '../../../actions/ConfigActions';
import NewQuestion from './NewQuestion';

const questionTarget = {
  hover(props, monitor) {
    const draggedId = monitor.getItem().id;
    let xOffset = monitor.getDifferenceFromInitialOffset().x;

    if (xOffset > 50) {
      props.makeSubQuestion(draggedId);
    }
    else if (xOffset < -50) {
      props.makeMainQuestion(draggedId);
    }

    if (draggedId !== props.id) {
      props.questionMoved(draggedId, props.id);
    }
  }
};

function collectTarget(connect) {
  return {
    connectDropTarget: connect.dropTarget()
  };
}

const questionSource = {
  beginDrag(props, monitor, component) { // eslint-disable-line no-unused-vars
    return {
      id: props.id
    };
  },
  isDragging() {
    return false;
  },
  endDrag(props, monitor, component) { // eslint-disable-line no-unused-vars
    props.endDrag(props.id);
  }
};

function collectSource(connect, monitor) {
  return {
    connectDragSource: connect.dragSource(),
    isDragging: monitor.isDragging()
  };
}

class Question extends React.Component {
  constructor() {
    super();

    this.deleteQuestion = this.deleteQuestion.bind(this);
    this.save = this.save.bind(this);
    this.edit = this.edit.bind(this);
    this.cancel = this.cancel.bind(this);
  }
<commit_msg>Stop main questions from being dropped on subquestions<commit_after>import React from 'react/addons';
import {merge} from '../../../merge';
import {KButton} from '../../KButton';
import Gripper from '../../DynamicIcons/Gripper';
import {DragSource, DropTarget} from 'react-dnd';
import ConfigActions from '../../../actions/ConfigActions';
import NewQuestion from './NewQuestion';

const questionTarget = {
  hover(props, monitor) {
    let itemBeingDragged = monitor.getItem();
    if (props.parent && !itemBeingDragged.parent) {
      return;
    }
    const draggedId = itemBeingDragged.id;
    let xOffset = monitor.getDifferenceFromInitialOffset().x;

    if (xOffset > 50) {
      props.makeSubQuestion(draggedId);
    }
    else if (xOffset < -50) {
      props.makeMainQuestion(draggedId);
    }

    if (draggedId !== props.id) {
      props.questionMoved(draggedId, props.id);
    }
  }
};

function collectTarget(connect) {
  return {
    connectDropTarget: connect.dropTarget()
  };
}

const questionSource = {
  beginDrag(props, monitor, component) { // eslint-disable-line no-unused-vars
    return props;
  },
  isDragging() {
    return false;
  },
  endDrag(props, monitor, component) { // eslint-disable-line no-unused-vars
    props.endDrag(props.id);
  }
};

function collectSource(connect, monitor) {
  return {
    connectDragSource: connect.dragSource(),
    isDragging: monitor.isDragging()
  };
}

class Question extends React.Component {
  constructor() {
    super();

    this.deleteQuestion = this.deleteQuestion.bind(this);
    this.save = this.save.bind(this);
    this.edit = this.edit.bind(this);
    this.cancel = this.cancel.bind(this);
  }

{'fraction_non_alphanumeric': 0.14628073451602863, 'fraction_numerical': 0.0024898848428260194, 'mean_word_length': 3.3140939597315437, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4553048', 'n_tokens_mistral': 1011, 'n_tokens_neox': 1006, 'n_words': 211}