Skip to content
Snippets Groups Projects
Select Git revision
  • a49e892238e2754cc6534740879c2e653b069e8a
  • 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

CollectionInfo.js

Blame
  • CollectionInfo.js 1.91 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import Button from '@material-ui/core/Button';
    import Typography from '@material-ui/core/Typography';
    import ViewListIcon from '@material-ui/icons/ViewListSharp';
    import CollapsibleSection from '../containers/CollapsibleSection';
    
    /**
     * ManifestInfo
     */
    export class CollectionInfo extends Component {
      /** */
      constructor(props) {
        super(props);
    
        this.openCollectionDialog = this.openCollectionDialog.bind(this);
      }
    
      /** */
      openCollectionDialog() {
        const { collectionPath, showCollectionDialog, windowId } = this.props;
    
        const manifestId = collectionPath[collectionPath.length - 1];
    
        showCollectionDialog(manifestId, collectionPath.slice(0, -1), windowId);
      }
    
      /**
       * render
       * @return
       */
      render() {
        const {
          collectionLabel,
          collectionPath,
          id,
          t,
        } = this.props;
    
        if (collectionPath.length === 0) return null;
    
        return (
          <CollapsibleSection
            id={`${id}-collection`}
            label={t('collection')}
          >
            {collectionLabel && (
              <Typography
                aria-labelledby={`${id}-resource ${id}-resource-heading`}
                id={`${id}-resource-heading`}
                variant="h4"
              >
                {collectionLabel}
              </Typography>
            )}
    
            <Button
              color="primary"
              onClick={this.openCollectionDialog}
              startIcon={<ViewListIcon />}
            >
              {t('showCollection')}
            </Button>
          </CollapsibleSection>
        );
      }
    }
    
    CollectionInfo.propTypes = {
      collectionLabel: PropTypes.string,
      collectionPath: PropTypes.arrayOf(PropTypes.string),
      id: PropTypes.string.isRequired,
      showCollectionDialog: PropTypes.func.isRequired,
      t: PropTypes.func,
      windowId: PropTypes.string,
    };
    
    CollectionInfo.defaultProps = {
      collectionLabel: null,
      collectionPath: [],
      t: key => key,
      windowId: null,
    };