<commit_before>import React from 'react';
import { ConditionallyRender } from '../../ConditionallyRender/ConditionallyRender';
import { IconButton, Tooltip } from '@mui/material';
import { Delete, Edit } from '@mui/icons-material';
import { useStyles } from '../ConstraintAccordion.styles';

interface ConstraintAccordionHeaderActionsProps {
    onDelete?: () => void;
    onEdit?: () => void;
    disableEdit?: boolean;
}

export const ConstraintAccordionHeaderActions = ({
    onEdit,
    onDelete,
    disableEdit = false,
}: ConstraintAccordionHeaderActionsProps) => {
    const { classes: styles } = useStyles();
    const onEditClick =
        onEdit &&
        ((event: React.SyntheticEvent) => {
            event.stopPropagation();
            onEdit();
        });

    const onDeleteClick =
        onDelete &&
        ((event: React.SyntheticEvent) => {
            event.stopPropagation();
            onDelete();
        });

    return (
        <div className={styles.headerActions}>
            <ConditionallyRender
                condition={Boolean(onEditClick) && !disableEdit}
                show={() => (
                    <Tooltip title="Edit constraint" arrow>
                        <IconButton
                            type="button"
                            onClick={onEditClick}
                            disabled={!onEdit}
                        >
                            <Edit />
                        </IconButton>
                    </Tooltip>
                )}
            />
            <ConditionallyRender
                condition={Boolean(onDeleteClick)}
                show={() => (
                    <Tooltip title="Delete constraint" arrow>
                        <IconButton
                            type="button"
                            onClick={onDeleteClick}
                            disabled={!onDelete}
                        >
                            <Delete />
                        </IconButton>
                    </Tooltip>
                )}
            />
        </div>
    );
};<commit_msg>bug fix<commit_after>import React from 'react';
import { IconButton, Tooltip } from '@mui/material';
import { Delete, Edit } from '@mui/icons-material';
import { useStyles } from '../ConstraintAccordion.styles';

interface ConstraintAccordionHeaderActionsProps {
    onDelete?: () => void;
    onEdit?: () => void;
}

export const ConstraintAccordionHeaderActions = ({
    onEdit,
    onDelete,
}: ConstraintAccordionHeaderActionsProps) => {
    const { classes: styles } = useStyles();
    const onEditClick =
        onEdit &&
        ((event: React.SyntheticEvent) => {
            event.stopPropagation();
            onEdit();
        });

    const onDeleteClick =
        onDelete &&
        ((event: React.SyntheticEvent) => {
            event.stopPropagation();
            onDelete();
        });

    return (
        <div className={styles.headerActions}>
            <Tooltip title="Edit constraint" arrow>
                <IconButton
                    type="button"
                    onClick={onEditClick}
                    disabled={!Boolean(onEditClick)}
                >
                    <Edit />
                </IconButton>
            </Tooltip>
            <Tooltip title="Delete constraint" arrow>
                <IconButton
                    type="button"
                    onClick={onDeleteClick}
                    disabled={!Boolean(onDeleteClick)}
                >
                    <Delete />
                </IconButton>
            </Tooltip>
        </div>
    );
};
{'fraction_non_alphanumeric': 0.11255891322428611, 'fraction_numerical': 0.0, 'mean_word_length': 1.398936170212766, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 41, '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': '3116100', 'n_tokens_mistral': 872, 'n_tokens_neox': 854, 'n_words': 164}