Skip to content
Snippets Groups Projects
Select Git revision
  • ed51af7660816416b9b5b2df73b2648fa0fbcb4f
  • mui5-tetras-main-stable default protected
  • mui5-tetras-main-old-stable
  • preprod protected
  • 75-dernieres-ameliorations-avant-workshop-du-7-02
  • wip-fix-xywh
  • wip-positionement-annot
  • wip-surface-transformer
  • uploads-file
  • 69-la-video-demare-quand-on-fait-glisser-le-slider-et-le-clic-creer-un-decalage-entre-le-player
  • 61-recettage-des-outils-d-annotation
  • gestion_multiple_ouverture_pannel_annotation
  • autorisation_un_pannel_annotation
  • autorisation_un_pannel_edition_annotation
  • récupération_temps_video
  • save-shapes-and-position
  • fix-error-create-annotation-pannel
  • time-saving-on-annotation
  • tetras-main protected
  • fix-poc-mirador
  • tetras-antho-test
21 results

annotationCreationCompanionWindow.js

Blame
  • Loïs Poujade's avatar
    Loïs Poujade authored
    - set tsart/tend to null if currentTime is null (which mean we're not on
      a video)
    - don't put default message if no time selector
    - don't use null values if no annotations found
    - avoid to create blank Fragment Selector
    ef26ae0c
    History
    annotationCreationCompanionWindow.js 1.71 KiB
    import * as actions from 'mirador/dist/es/src/state/actions';
    import { getCompanionWindow } from 'mirador/dist/es/src/state/selectors/companionWindows';
    import { getWindowCurrentTime, getWindowPausedStatus } from 'mirador/dist/es/src/state/selectors/window';
    import { getVisibleCanvases } from 'mirador/dist/es/src/state/selectors/canvases';
    import { getPresentAnnotationsOnSelectedCanvases } from 'mirador/dist/es/src/state/selectors/annotations';
    import AnnotationCreation from '../AnnotationCreation';
    
    /** */
    const mapDispatchToProps = (dispatch, { id, windowId }) => ({
      closeCompanionWindow: () => dispatch(
        actions.removeCompanionWindow(windowId, id),
      ),
      receiveAnnotation: (targetId, annoId, annotation) => dispatch(
        actions.receiveAnnotation(targetId, annoId, annotation),
      ),
      setCurrentTime: (...args) => dispatch(actions.setWindowCurrentTime(windowId, ...args)),
      setSeekTo: (...args) => dispatch(actions.setWindowSeekTo(windowId, ...args)),
    });
    
    /** */
    function mapStateToProps(state, { id: companionWindowId, windowId }) {
      const currentTime = getWindowCurrentTime(state, { windowId });
      const cw = getCompanionWindow(state, { companionWindowId, windowId });
      const { annotationid } = cw;
      const canvases = getVisibleCanvases(state, { windowId });
    
      const annotation = getPresentAnnotationsOnSelectedCanvases(state, { windowId })
        .flatMap((annoPage) => annoPage.json.items || [])
        .find((annot) => annot.id === annotationid);
    
      return {
        annotation,
        canvases,
        config: state.config,
        currentTime,
        paused: getWindowPausedStatus(state, { windowId }),
      };
    }
    
    export default {
      companionWindowKey: 'annotationCreation',
      component: AnnotationCreation,
      mapDispatchToProps,
      mapStateToProps,
    };