<commit_before>import { React, cn, observable, observer, action } from '../../helpers/react';
import { toJS } from 'mobx';
import { partial } from 'lodash';
import { DragSource } from 'react-dnd';
import { TaskPlanStore, TaskPlanActions } from '../../flux/task-plan';

import GrabbyDots from '../../components/grabby-dots';

const NewTaskDrag = {
  beginDrag(props) {
    const { link, onDrag } = props;
    if (typeof onDrag === 'function') {
      onDrag();
    }

    return (

      link

    );
  },

  endDrag(props, monitor) {
    const { onDrop, offset } = monitor.getDropResult() || {};
    return (
      (typeof onDrop === 'function' ? onDrop(
        monitor.getItem(), offset
      ) : undefined)
    );
  },
};

const CloneTaskDrag = {
  beginDrag({ plan, offHover }) {
    // start loading task plan details as soon as it starts to drag
    // hopefully the load will have completed by the time it's dropped
    offHover();
    if (!TaskPlanStore.isLoaded(plan.id) && !TaskPlanStore.isLoading(plan.id)) {
      TaskPlanActions.loaded(plan, plan.id);
    }
    return (
      toJS(plan)
    );
  },

  endDrag(props, monitor) {
    const { onDrop, offset } = monitor.getDropResult() || {};
    return (
      (typeof onDrop === 'function' ? onDrop(
        monitor.getItem(), offset
      ) : undefined)
    );
  },
};

const ItemTypes = {
  NewTask: 'NEW_TASK',
  CloneTask: 'CLONE_TASK',
};

const TaskDrop = {
  drop(props, monitor, comp) {
    return (
      { onDrop: comp.onDrop, offset: monitor.getClientOffset() }
    );
  },
};

const DragInjector = (connect, monitor) => ({ connectDragSource: connect.dragSource(), isDragging: monitor.isDragging() });

const DropInjector = (connect, monitor) => ({ connectDropTarget: connect.dropTarget(), isDragging: monitor.isOver() });


const AddAssignmentLink = DragSource(ItemTypes.NewTask, NewTaskDrag, DragInjector)(
  props => props.connectDragSource(
    <div
      data-assignment-type={props.link.type}
      className={cn('new-task', { 'is-dragging': props.isDragging })}>
      <GrabbyDots />
      <a
        href={props.link.pathname}
        onClick={props.goToBuilder}
        draggable="false">
        {props.link.text}
      </a>
    </div>
  )
);

AddAssignmentLink.displayName = 'AddAssignmentLink';


const CloneAssignmentLink = DragSource(ItemTypes.CloneTask, CloneTaskDrag, DragInjector)(
  props => props.connectDragSource(
    <div
      onMouseEnter={props.onHover}
      onMouseLeave={props.offHover}
      data-assignment-id={`${props.plan.id}`}
      data-assignment-type={props.plan.type}
      className={cn('task-plan', {
          'is-dragging': props.isDragging,
          'is-editing': props.isEditing,
      }
      )}>
      <GrabbyDots />
      <div>
        {props.plan.title}
      </div>
    </div>
  )
);

CloneAssignmentLink.displayName = 'CloneAssignmentLink';

export {
  NewTaskDrag,
  CloneTaskDrag,
  TaskDrop,
  DragInjector,
  DropInjector,
  ItemTypes,
  CloneAssignmentLink,
  AddAssignmentLink,
};
<commit_msg>return a plain object with just the fields we need<commit_after>import { React, cn, observable, observer, action } from '../../helpers/react';
import { toJS } from 'mobx';
import { partial } from 'lodash';
import { DragSource } from 'react-dnd';
import { TaskPlanStore, TaskPlanActions } from '../../flux/task-plan';

import GrabbyDots from '../../components/grabby-dots';

const NewTaskDrag = {
  beginDrag(props) {
    const { link, onDrag } = props;
    if (typeof onDrag === 'function') {
      onDrag();
    }

    return (

      link

    );
  },

  endDrag(props, monitor) {
    const { onDrop, offset } = monitor.getDropResult() || {};
    return (
      (typeof onDrop === 'function' ? onDrop(
        monitor.getItem(), offset
      ) : undefined)
    );
  },
};

const CloneTaskDrag = {
  beginDrag({ plan, offHover }) {
    // start loading task plan details as soon as it starts to drag
    // hopefully the load will have completed by the time it's dropped
    offHover();
    if (!TaskPlanStore.isLoaded(plan.id) && !TaskPlanStore.isLoading(plan.id)) {
      TaskPlanActions.loaded(plan, plan.id);
    }
    return { id: plan.id, type: plan.type };
  },

  endDrag(props, monitor) {
    const { onDrop, offset } = monitor.getDropResult() || {};
    return (
      (typeof onDrop === 'function' ? onDrop(
        monitor.getItem(), offset
      ) : undefined)
    );
  },
};

const ItemTypes = {
  NewTask: 'NEW_TASK',
  CloneTask: 'CLONE_TASK',
};

const TaskDrop = {
  drop(props, monitor, comp) {
    return (
      { onDrop: comp.onDrop, offset: monitor.getClientOffset() }
    );
  },
};

const DragInjector = (connect, monitor) => ({ connectDragSource: connect.dragSource(), isDragging: monitor.isDragging() });

const DropInjector = (connect, monitor) => ({ connectDropTarget: connect.dropTarget(), isDragging: monitor.isOver() });


const AddAssignmentLink = DragSource(ItemTypes.NewTask, NewTaskDrag, DragInjector)(
  props => props.connectDragSource(
    <div
      data-assignment-type={props.link.type}
      className={cn('new-task', { 'is-dragging': props.isDragging })}>
      <GrabbyDots />
      <a
        href={props.link.pathname}
        onClick={props.goToBuilder}
        draggable="false">
        {props.link.text}
      </a>
    </div>
  )
);

AddAssignmentLink.displayName = 'AddAssignmentLink';


const CloneAssignmentLink = DragSource(ItemTypes.CloneTask, CloneTaskDrag, DragInjector)(
  props => props.connectDragSource(
    <div
      onMouseEnter={props.onHover}
      onMouseLeave={props.offHover}
      data-assignment-id={`${props.plan.id}`}
      data-assignment-type={props.plan.type}
      className={cn('task-plan', {
          'is-dragging': props.isDragging,
          'is-editing': props.isEditing,
      }
      )}>
      <GrabbyDots />
      <div>
        {props.plan.title}
      </div>
    </div>
  )
);

CloneAssignmentLink.displayName = 'CloneAssignmentLink';

export {
  NewTaskDrag,
  CloneTaskDrag,
  TaskDrop,
  DragInjector,
  DropInjector,
  ItemTypes,
  CloneAssignmentLink,
  AddAssignmentLink,
};

{'fraction_non_alphanumeric': 0.14853110126374527, 'fraction_numerical': 0.0, 'mean_word_length': 2.9804049640757673, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 31, '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': '3514261', 'n_tokens_mistral': 1974, 'n_tokens_neox': 2001, 'n_words': 400}