<commit_before>import classNames            from 'classnames';
import PropTypes             from 'prop-types';
import React                 from 'react';
import { CSSTransition }     from 'react-transition-group';
import ContractLink          from 'Modules/Contract/Containers/contract-link.jsx';
import { localize }          from '_common/localize';
import { IconPriceMove }     from 'Assets/Trading/icon-price-move.jsx';
import ContractTypeCell      from './contract-type-cell.jsx';
import ProgressSlider        from './ProgressSlider';
import ResultDetails         from './result-details.jsx';
import ResultOverlay         from './result-overlay.jsx';
import { getTimePercentage } from './helpers';
import Money                 from '../money.jsx';
import Button                from '../../Form/button.jsx';

const PositionsDrawerCard = ({
    active_position,
    className,
    contract_info,
    currency,
    current_tick,
    duration,
    duration_unit,
    exit_spot,
    indicative,
    id,
    is_loading,
    is_sell_requested,
    is_valid_to_sell,
    profit_loss,
    onClickSell,
    onClickRemove,
    openContract,
    result,
    sell_time,
    server_time,
    status,
    type,
}) => {
    const percentage = getTimePercentage(server_time, contract_info.purchase_time, contract_info.date_expiry);
    return (
        <div className={classNames(
            'positions-drawer-card__wrapper', {
                'positions-drawer-card__wrapper--active': (parseInt(active_position) === id),
            },
            className)}
        >
            <ResultOverlay
                contract_id={id}
                onClickRemove={onClickRemove}
                onClick={openContract}
                result={result}
            />
            <ContractLink
                className={classNames(
                    'positions-drawer-card', {
                        'positions-drawer-card--active': (parseInt(active_position) === id),
                        'positions-drawer-card--green' : (profit_loss > 0) && !result,
                        'positions-drawer-card--red'   : (profit_loss < 0) && !result,
                    }
                )}
                contract_id={id}
            >
                <React.Fragment>
                    <div className={classNames(
                        'positions-drawer-card__grid',
                        'positions-drawer-card__grid-underlying-trade'
                    )}
                    >
                        <div className='positions-drawer-card__underlying-name'>
                            <div
                                className={classNames(
                                    'icons-underlying',
                                    `icons-underlying__ic-${contract_info.underlying || 'unknown'}`
                                )}
                            />
                            <span className='positions-drawer-card__symbol'>{contract_info.display_name}</span>
                        </div>
                        <div className='positions-drawer-card__type'>
                            <ContractTypeCell type={type} />
                        </div>
                    </div>
                    <ProgressSlider
                        is_loading={is_loading}
                        remaining_time={contract_info.date_expiry}
                        percentage={percentage}
                        current_tick={current_tick}
                        ticks_count={contract_info.tick_count}
                        has_result={!!(result)}
                    />
                    <div className={classNames(
                        'positions-drawer-card__grid',
                        'positions-drawer-card__grid-profit-payout'
                    )}
                    >
                        <div className={classNames(
                            'positions-drawer-card__profit-loss',
                            'positions-drawer-card__profit-loss-label',
                        )}
                        >
                            {result ? localize('P/L:') : localize('Potential P/L:')}
                        </div>
                        <div className={classNames(
                            'positions-drawer-card__indicative',
                            'positions-drawer-card__indicative-label',
                        )}
                        >
                            {!result ? localize('Indicative Price:') : localize('Payout:')}
                        </div>
                        <div className={classNames(
                            'positions-drawer-card__profit-loss', {
                                'positions-drawer-card__profit-loss--negative': (status === 'complete' && profit_loss < 0),
                                'positions-drawer-card__profit-loss--positive': (status === 'complete' && profit_loss > 0),
                            })}
                        >
                            <Money amount={Math.abs(profit_loss)} currency={currency} />
                            <div className={classNames(
                                'positions-drawer-card__indicative--movement', {
                                    'positions-drawer-card__indicative--movement-complete': (status === 'complete'),
                                },
                            )}
                            >
                                <IconPriceMove
                                    type={(status !== 'complete') ? status : null}
                                />
                            </div>
                        </div>
                        <div className='positions-drawer-card__indicative'>
                            <Money amount={indicative} currency={currency} />
                            <div className={classNames(
                                'positions-drawer-card__indicative--movement', {
                                    'positions-drawer-card__indicative--movement-complete': (status === 'complete'),
                                },
                            )}
                            >
                                <IconPriceMove
                                    type={(status !== 'complete') ? status : null}
                                />
                            </div>
                        </div>
                    </div>
                    <div className='positions-drawer-card__purchase-price'>
                        <span className='positions-drawer-card__purchase-label'>
                            {localize('Purchase price')}
                        </span>
                        <Money amount={contract_info.buy_price} currency={currency} />
                    </div>
                </React.Fragment>
            </ContractLink>
            <CSSTransition
                in={!!(is_valid_to_sell)}
                timeout={250}
                classNames={{
                    enter    : 'positions-drawer-card__sell-button--enter',
                    enterDone: 'positions-drawer-card__sell-button--enter-done',
                    exit     : 'positions-drawer-card__sell-button--exit',
                }}
                unmountOnExit
            >
                <div className='positions-drawer-card__sell-button'>
                    <Button
                        className={classNames(
                            'btn--primary',
                            'btn--primary--orange',
                            'btn--sell', {
                                'btn--loading': is_sell_requested,
                            })}<commit_msg>button green position sell contract<commit_after>import classNames            from 'classnames';
import PropTypes             from 'prop-types';
import React                 from 'react';
import { CSSTransition }     from 'react-transition-group';
import ContractLink          from 'Modules/Contract/Containers/contract-link.jsx';
import { localize }          from '_common/localize';
import { IconPriceMove }     from 'Assets/Trading/icon-price-move.jsx';
import ContractTypeCell      from './contract-type-cell.jsx';
import ProgressSlider        from './ProgressSlider';
import ResultDetails         from './result-details.jsx';
import ResultOverlay         from './result-overlay.jsx';
import { getTimePercentage } from './helpers';
import Money                 from '../money.jsx';
import Button                from '../../Form/button.jsx';

const PositionsDrawerCard = ({
    active_position,
    className,
    contract_info,
    currency,
    current_tick,
    duration,
    duration_unit,
    exit_spot,
    indicative,
    id,
    is_loading,
    is_sell_requested,
    is_valid_to_sell,
    profit_loss,
    onClickSell,
    onClickRemove,
    openContract,
    result,
    sell_time,
    server_time,
    status,
    type,
}) => {
    const percentage = getTimePercentage(server_time, contract_info.purchase_time, contract_info.date_expiry);
    return (
        <div className={classNames(
            'positions-drawer-card__wrapper', {
                'positions-drawer-card__wrapper--active': (parseInt(active_position) === id),
            },
            className)}
        >
            <ResultOverlay
                contract_id={id}
                onClickRemove={onClickRemove}
                onClick={openContract}
                result={result}
            />
            <ContractLink
                className={classNames(
                    'positions-drawer-card', {
                        'positions-drawer-card--active': (parseInt(active_position) === id),
                        'positions-drawer-card--green' : (profit_loss > 0) && !result,
                        'positions-drawer-card--red'   : (profit_loss < 0) && !result,
                    }
                )}
                contract_id={id}
            >
                <React.Fragment>
                    <div className={classNames(
                        'positions-drawer-card__grid',
                        'positions-drawer-card__grid-underlying-trade'
                    )}
                    >
                        <div className='positions-drawer-card__underlying-name'>
                            <div
                                className={classNames(
                                    'icons-underlying',
                                    `icons-underlying__ic-${contract_info.underlying || 'unknown'}`
                                )}
                            />
                            <span className='positions-drawer-card__symbol'>{contract_info.display_name}</span>
                        </div>
                        <div className='positions-drawer-card__type'>
                            <ContractTypeCell type={type} />
                        </div>
                    </div>
                    <ProgressSlider
                        is_loading={is_loading}
                        remaining_time={contract_info.date_expiry}
                        percentage={percentage}
                        current_tick={current_tick}
                        ticks_count={contract_info.tick_count}
                        has_result={!!(result)}
                    />
                    <div className={classNames(
                        'positions-drawer-card__grid',
                        'positions-drawer-card__grid-profit-payout'
                    )}
                    >
                        <div className={classNames(
                            'positions-drawer-card__profit-loss',
                            'positions-drawer-card__profit-loss-label',
                        )}
                        >
                            {result ? localize('P/L:') : localize('Potential P/L:')}
                        </div>
                        <div className={classNames(
                            'positions-drawer-card__indicative',
                            'positions-drawer-card__indicative-label',
                        )}
                        >
                            {!result ? localize('Indicative Price:') : localize('Payout:')}
                        </div>
                        <div className={classNames(
                            'positions-drawer-card__profit-loss', {
                                'positions-drawer-card__profit-loss--negative': (status === 'complete' && profit_loss < 0),
                                'positions-drawer-card__profit-loss--positive': (status === 'complete' && profit_loss > 0),
                            })}
                        >
                            <Money amount={Math.abs(profit_loss)} currency={currency} />
                            <div className={classNames(
                                'positions-drawer-card__indicative--movement', {
                                    'positions-drawer-card__indicative--movement-complete': (status === 'complete'),
                                },
                            )}
                            >
                                <IconPriceMove
                                    type={(status !== 'complete') ? status : null}
                                />
                            </div>
                        </div>
                        <div className='positions-drawer-card__indicative'>
                            <Money amount={indicative} currency={currency} />
                            <div className={classNames(
                                'positions-drawer-card__indicative--movement', {
                                    'positions-drawer-card__indicative--movement-complete': (status === 'complete'),
                                },
                            )}
                            >
                                <IconPriceMove
                                    type={(status !== 'complete') ? status : null}
                                />
                            </div>
                        </div>
                    </div>
                    <div className='positions-drawer-card__purchase-price'>
                        <span className='positions-drawer-card__purchase-label'>
                            {localize('Purchase price')}
                        </span>
                        <Money amount={contract_info.buy_price} currency={currency} />
                    </div>
                </React.Fragment>
            </ContractLink>
            <CSSTransition
                in={!!(is_valid_to_sell)}
                timeout={250}
                classNames={{
                    enter    : 'positions-drawer-card__sell-button--enter',
                    enterDone: 'positions-drawer-card__sell-button--enter-done',
                    exit     : 'positions-drawer-card__sell-button--exit',
                }}
                unmountOnExit
            >
                <div className='positions-drawer-card__sell-button'>
                    <Button
                        className={classNames(
                            'btn--primary',
                            'btn--primary--green',
                            'btn--sell', {
                                'btn--loading': is_sell_requested,
                            })}
{'fraction_non_alphanumeric': 0.1008590727260804, 'fraction_numerical': 0.000918092989704243, 'mean_word_length': 1.0516615094847304, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 93, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6965215', 'n_tokens_mistral': 3662, 'n_tokens_neox': 3386, 'n_words': 492}