<commit_before>import * as React from 'react';
import { observer } from 'mobx-react';
import { connect } from 'utils/connect'

import { ContextMenu } from '@blueprintjs/core';

import ClipContextMenu from 'features/ClipContextMenu';
import ClipView from 'components/Clip';

import { ClipSelect } from 'core/interactions/clip/select';
import { Clip as ClipModel } from 'core/models/clip';

import * as clipDragHandlers from 'core/interactions/clip/drag/handlers';

const styles = require('./styles.less');

interface Props {
  clip: ClipModel;
  clipSelect: ClipSelect;
}

interface State {
  isContextMenuOpen: boolean;
}

@observer
export class Clip extends React.Component<Props, State> {
  state = { isContextMenuOpen: false };

  handleMouseDown = (event: React.MouseEvent<HTMLElement>) => {
    const { clip, clipSelect } = this.props;

    event.preventDefault();
    event.stopPropagation();

    console.log(event.ctrlKey, event);

    // If left-click, do nothing (delegate to context menus)
    if (event.ctrlKey) {
      return this.showContextMenu(event);
    } else if (clip.isSelected) {
      // no op, still set up handlers below
    } else if (event.shiftKey) {
      clipSelect.selectClip(clip);
    } else {
      clipSelect.selectOnlyClip(clip);
    }

    clipDragHandlers.register(clip, event);
    return false;
  }

  renderContextMenu = () => {
    const { clip } = this.props;
    return <ClipContextMenu clipId={clip.id} />;
  };

  showContextMenu = (event: React.MouseEvent<HTMLElement>) => {
    const props = { left: event.clientX, top: event.clientY };
    const callback = () => this.setState({ isContextMenuOpen: false });
    ContextMenu.show(this.renderContextMenu(), props, callback);
    this.setState({ isContextMenuOpen: true });
  };

  render() {
    const { clip } = this.props;

    const clipWrapperStyle = {
      left: clip.offsetX - 1,
    };

    return (
      <div
        className={styles.clipContainer}
        style={clipWrapperStyle}
        onMouseDown={this.handleMouseDown}
      >
        <ClipView clip={clip} />
      </div>
    );
  }
}

export default connect(Clip, 'clipSelect');
<commit_msg>Remove log<commit_after>import * as React from 'react';
import { observer } from 'mobx-react';
import { connect } from 'utils/connect'

import { ContextMenu } from '@blueprintjs/core';

import ClipContextMenu from 'features/ClipContextMenu';
import ClipView from 'components/Clip';

import { ClipSelect } from 'core/interactions/clip/select';
import { Clip as ClipModel } from 'core/models/clip';

import * as clipDragHandlers from 'core/interactions/clip/drag/handlers';

const styles = require('./styles.less');

interface Props {
  clip: ClipModel;
  clipSelect: ClipSelect;
}

interface State {
  isContextMenuOpen: boolean;
}

@observer
export class Clip extends React.Component<Props, State> {
  state = { isContextMenuOpen: false };

  handleMouseDown = (event: React.MouseEvent<HTMLElement>) => {
    event.preventDefault();
    event.stopPropagation();

    const { clip, clipSelect } = this.props;

    // If left-click, do delegate to context menus
    if (event.ctrlKey) {
      return this.showContextMenu(event);
    } else if (clip.isSelected) {
      // no op, still set up handlers below
    } else if (event.shiftKey) {
      clipSelect.selectClip(clip);
    } else {
      clipSelect.selectOnlyClip(clip);
    }

    clipDragHandlers.register(clip, event);
    return false;
  }

  renderContextMenu = () => {
    const { clip } = this.props;
    return <ClipContextMenu clipId={clip.id} />;
  };

  showContextMenu = (event: React.MouseEvent<HTMLElement>) => {
    const props = { left: event.clientX, top: event.clientY };
    const callback = () => this.setState({ isContextMenuOpen: false });
    ContextMenu.show(this.renderContextMenu(), props, callback);
    this.setState({ isContextMenuOpen: true });
  };

  render() {
    const { clip } = this.props;

    const clipWrapperStyle = {
      left: clip.offsetX - 1,
    };

    return (
      <div
        className={styles.clipContainer}
        style={clipWrapperStyle}
        onMouseDown={this.handleMouseDown}
      >
        <ClipView clip={clip} />
      </div>
    );
  }
}

export default connect(Clip, 'clipSelect');

{'fraction_non_alphanumeric': 0.12954705468199953, 'fraction_numerical': 0.0004693733865289838, 'mean_word_length': 3.340122199592668, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '4009637', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1297, 'n_words': 306}