Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@filerobot/explorer / lib / components / ExplorerView.js
Size: Mime:
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { selectCoreLoading } from '@filerobot/core/lib/slices/common.slice';
import AddFilesPanel from './AddFilesPanel';
import ImageEditorPanel from './ImageEditorPanel';
import PdftronPanel from './PdftronPanel';
import PickerPanel from './PickerPanel';
import ExplorerWrapper from './ExplorerWrapper';
import FileWindowPanel from './FileWindowPanel';
import CropPanel from './CropPanel';
import FoldersAfterSharePanel from './FoldersAfterSharePanel';
import Modals from './Modals';
import UploadsPanel from './UploadsPanel';
import SharePanel from './SharePanel';
import BulkEditPanel from './BulkEditPanel';
import { useExplorer } from '../hooks';
import { explorerPluginLoadingSet, fetchAccessConstants, fetchPublicConstants, selectIsExplorerPluginLoading } from '../slices/common.slice';
import { fetchMetaAndSettings, metadataAdaptAndSet } from '../slices/metadata.slice';
import ContextMenu from './ContextMenu';
import CollectionPanels from './CollectionsView/Collection';
import StatusBars from './StatusBars';
import Informer from './Informer';
import ProgressPanel from './ProgressPanel';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var ExplorerView = function ExplorerView() {
  var dispatch = useDispatch();
  var _useExplorer = useExplorer(),
    opts = _useExplorer.opts;
  var isCoreLoading = useSelector(selectCoreLoading);
  var isExplorerLoading = useSelector(selectIsExplorerPluginLoading);
  var isLoading = isCoreLoading || isExplorerLoading;
  useEffect(function () {
    if (isCoreLoading) {
      return;
    }
    if (opts.noItemsBrowser) {
      dispatch(explorerPluginLoadingSet(false));
      return;
    }
    dispatch(explorerPluginLoadingSet(true));
    var promises = [];
    if (!opts.useShareboxMode) {
      var _opts$config, _opts$config$metadata, _opts$config$tagging;
      var hasMetaConfig = !!((_opts$config = opts.config) !== null && _opts$config !== void 0 && (_opts$config$metadata = _opts$config.metadata) !== null && _opts$config$metadata !== void 0 && _opts$config$metadata.model);
      var isTaggingEnabled = !!((_opts$config$tagging = opts.config.tagging) !== null && _opts$config$tagging !== void 0 && _opts$config$tagging.enabled);
      if (hasMetaConfig) {
        dispatch(metadataAdaptAndSet({
          metadata: opts.config.metadata,
          isTaggingEnabled: isTaggingEnabled
        }));
      }
      promises.push(dispatch(fetchPublicConstants()).throwRejection(), dispatch(fetchMetaAndSettings({
        updateMetaFromApi: !hasMetaConfig,
        isTaggingEnabled: isTaggingEnabled
      })).throwRejection());
      if (opts.enabledManageAccess) {
        promises.push(dispatch(fetchAccessConstants()).throwRejection());
      }
    }
    Promise.all(promises)["catch"](function () {})["finally"](function () {
      dispatch(explorerPluginLoadingSet(false));
    });
  }, [isCoreLoading]);
  return /*#__PURE__*/_jsxs(ExplorerWrapper, {
    children: [/*#__PURE__*/_jsx(ProgressPanel, {
      zIndex: 1111
    }), /*#__PURE__*/_jsx(UploadsPanel, {
      zIndex: 1112
    }), /*#__PURE__*/_jsx(AddFilesPanel, {
      zIndex: 1113
    }), /*#__PURE__*/_jsx(FileWindowPanel, {
      zIndex: 1114
    }), /*#__PURE__*/_jsx(PickerPanel, {
      zIndex: 1115
    }), /*#__PURE__*/_jsx(SharePanel, {
      zIndex: 1116
    }), /*#__PURE__*/_jsx(ImageEditorPanel, {
      zIndex: 1117
    }), /*#__PURE__*/_jsx(FoldersAfterSharePanel, {
      zIndex: 1118
    }), /*#__PURE__*/_jsx(CollectionPanels, {
      transitionZIndex: 1119
    }), /*#__PURE__*/_jsx(CropPanel, {
      zIndex: 1120
    }), /*#__PURE__*/_jsx(PdftronPanel, {
      zIndex: 1121
    }), /*#__PURE__*/_jsx(Modals, {}), /*#__PURE__*/_jsx(BulkEditPanel, {
      zIndex: 1122
    }), !isLoading && /*#__PURE__*/_jsx(ContextMenu, {}), /*#__PURE__*/_jsx(StatusBars, {}), /*#__PURE__*/_jsx(Informer, {})]
  });
};
export default ExplorerView;