<commit_before>import React, { Component } from 'react';

import MathRenderer from './math-renderer';
import Menu from './menu';
import Selection from './selection';
import { findNode } from '../ast/node-utils';
import store from './../store';
import transforms from '../transforms';


class Step extends Component {
    static defaultProps = {
        selections: [],
    };

    handleTap = transform => {
        const { math, selections } = this.props;
        const newMath = math.clone();

        const newSelections = selections.map(selection => {
            const first = findNode(newMath, selection.first.id);
            const last = findNode(newMath, selection.last.id);
            return new Selection(first, last);
        });

        if (transform.needsUserInput) {
            store.dispatch({
                type: 'GET_USER_INPUT',
                transform: transform,
                selections: selections,
            });
        } else {
            if (transform.canTransform(newSelections)) {
                transform.doTransform(newSelections);
            }
<commit_msg>hide the menu when a user selects a transform that requires user input<commit_after>import React, { Component } from 'react';

import MathRenderer from './math-renderer';
import Menu from './menu';
import Selection from './selection';
import { findNode } from '../ast/node-utils';
import store from './../store';
import transforms from '../transforms';


class Step extends Component {
    static defaultProps = {
        selections: [],
    };

    handleTap = transform => {
        const { math, selections } = this.props;
        const newMath = math.clone();

        const newSelections = selections.map(selection => {
            const first = findNode(newMath, selection.first.id);
            const last = findNode(newMath, selection.last.id);
            return new Selection(first, last);
        });

        store.dispatch({
            type: 'HIDE_MENU'
        });

        if (transform.needsUserInput) {
            store.dispatch({
                type: 'GET_USER_INPUT',
                transform: transform,
                selections: selections,
            });
        } else {
            if (transform.canTransform(newSelections)) {
                transform.doTransform(newSelections);
            }

{'fraction_non_alphanumeric': 0.11645896003437903, 'fraction_numerical': 0.0, 'mean_word_length': 2.0834437086092716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5850611', 'n_tokens_mistral': 602, 'n_tokens_neox': 568, 'n_words': 161}