import React from 'react';
import { useSelector } from 'react-redux';
import { getConf } from '../../../configuration';
import { isConfigurationModeSwitchAvailable } from '../../../Reducers/ConfigurationMode/Selectors';

export const AmountPriceAdminareaWrapper = ({ AmountPriceComponent, ...props }) => {
    const configurationModeSwitchAvailable = useSelector(isConfigurationModeSwitchAvailable);

    const adminMode = getConf('adminMode');
    const extraProps = adminMode
        ? {
              hidePieces: true,
              hidePrices: true,
              showCallToAction: false,
          }
        : {};
    return (
        ((!adminMode || configurationModeSwitchAvailable) && (
            <AmountPriceComponent {...props} {...extraProps} />
        )) ||
        null
    );
};
