Skip to content
Snippets Groups Projects
Select Git revision
  • 6a182bae33f8b5399c899806d5f4c81c8645d469
  • mui5-annotation-on-video-stable default
  • get_setter_canvasSizeInformations
  • fix-error-div-into-p
  • annotation-on-video-v2
  • detached
  • annotation-on-video-r17
  • mui5
  • mui5-react-18
  • jacob-test
  • annotation-on-video protected
  • master
  • test-antoinev1
  • 20-fetch-thumbnail-on-annotation
  • add-research-field
  • Save
  • add-plugin
  • 14-wip-no-seek-to
  • 14-bug-on-video-time-control
  • 9_wip_videotests
  • _upgrade_material_ui
  • latest-tetras-16
  • v3.3.0
  • v3.2.0
  • v3.1.1
  • v3.1.0
  • v3.0.0
  • v3.0.0-rc.7
  • v3.0.0-rc.6
  • v3.0.0-rc.5
  • v3.0.0-rc.4
  • v3.0.0-rc.3
  • v3.0.0-rc.2
  • v3.0.0-rc.1
  • v3.0.0-beta.10
  • v3.0.0-beta.9
  • v3.0.0-beta.8
  • v3.0.0-beta.7
  • v3.0.0-beta.6
  • v3.0.0-beta.5
  • v3.0.0-beta.3
41 results

collectionTreeManifestsPanel.js

Blame
  • 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,
    };