import FullScreenView from '../Components/FullScreenView';
import { containerConnect } from 'Framework/ComponentContainer';
import { Services } from 'App/ServiceLocator';
import { getDesignViewLength } from 'App/Reducers/DesignView/Selectors';
import { isAnyDesignAreaSelected } from 'App/Reducers/DesignArea/Selectors';
import { areAllDesignAreasEmpty } from '../../../Reducers/DesignArea/Selectors';

const mapStateToProps = state => {
    return {
        Component: FullScreenView,
        handleOpenPreview: () => {
            Services.designData.toggleIsInPreviewMode(true);
            Services.designData.clearDesignAreaSelection();
            Services.visualization.enableDesignAreaInteraction(false);
        },
        thumbnailDotMode:
            state.designView.designViews.filter(designView => !designView.thumbnails).length > 0,
        handleClosePreview: () => {
            Services.designData.toggleIsInPreviewMode(false);
            Services.visualization.initDesignAreaInteraction();
        },
        showDesignViewList: getDesignViewLength(state) > 1 && !isAnyDesignAreaSelected(state),
        hasItems: getDesignViewLength(state) > 0,
        hasMoreItems: getDesignViewLength(state) > 1,
        areAllDesignAreasEmpty: areAllDesignAreasEmpty(state.configurator),
    };
};
export default containerConnect(mapStateToProps);
