import { containerConnect } from 'Framework/ComponentContainer';
import { getConf } from 'App/configuration';
import { getConfigurator, getSelectedVariantIdentifier } from 'App/Reducers/Configurator/Selectors';
import { FallbackVisualization } from '../Components/FallbackVisualization/FallbackVisualization';
import Progress from 'App/Shared/Components/Progress/Progress';

const mapStateToProps = state => {
    const variantIdentifier = getSelectedVariantIdentifier(getConfigurator(state));
    const imageSrc = variantIdentifier
        ? `${getConf('network.host')}/images/item/image/${variantIdentifier}.jpg`
        : '';
    return {
        Component: FallbackVisualization,
        ProgressComponent: Progress,
        imageSrc,
    };
};

export default containerConnect(mapStateToProps);
