Skip to content
Snippets Groups Projects
Select Git revision
  • 8abce44303f9ab6ced17f3c17d521fe7a6ce96e7
  • master default protected
  • 133-fail2ban-page
  • reorganisation
  • 16-maintenace-service
  • 11-fail2ban
  • 6-monit-update
  • 7-dolibarr-fail2ban
  • 6-surveillance-interne-des-serveur
  • test-glpi
  • 2-migrate-to-phpfpm
  • jessie
  • github
13 results

installBase.sh

Blame
  • AnnotationSettings.js 1.32 KiB
    import { compose } from 'redux';
    import { connect } from 'react-redux';
    import { withTranslation } from 'react-i18next';
    import * as actions from '../state/actions';
    import { withPlugins } from '../extend/withPlugins';
    import {
      getAnnotationResourcesByMotivation,
      getWindow,
    } from '../state/selectors';
    import { AnnotationSettings } from '../components/AnnotationSettings';
    
    /**
     * Mapping redux state to component props using connect
     */
    const mapStateToProps = (state, { windowId }) => ({
      autoScroll: getWindow(state, { windowId }).autoScrollAnnotationList,
      autoScrollDisabled: getAnnotationResourcesByMotivation(state, { windowId }).length < 2,
      displayAll: getWindow(state, { windowId }).highlightAllAnnotations,
      displayAllDisabled: getAnnotationResourcesByMotivation(
        state,
        { windowId },
      ).length < 2,
    });
    
    /**
     * Mapping redux action dispatches to component props using connect
     */
    const mapDispatchToProps = (dispatch, { windowId }) => ({
      toggleAnnotationAutoScroll: () => {
        dispatch(actions.toggleAnnotationAutoScroll(windowId));
      },
      toggleAnnotationDisplay: () => {
        dispatch(actions.toggleAnnotationDisplay(windowId));
      },
    });
    
    const enhance = compose(
      withTranslation(),
      connect(mapStateToProps, mapDispatchToProps),
      withPlugins('AnnotationSettings'),
    );
    
    export default enhance(AnnotationSettings);