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 / ContextMenu / FileOptions / ShareboxModeOptions.js
Size: Mime:
import { useSelector } from 'react-redux';
import { Preview, Download, Link } from '@scaleflex/icons';
import copyText from '@filerobot/utils/lib/copyText';
import getFileLink from '@filerobot/utils/lib/getFileLink';
import { fileWindowUpdated } from '../../../slices/panels.slice';
import { downloadOneFile } from '../../../slices/downloads.slice';
import { selectCurrentViewedShareboxFiles } from '../../../slices/sharebox.slice';
import { jsx as _jsx } from "react/jsx-runtime";
var hideIfNotOneItemOrIsFolder = function hideIfNotOneItemOrIsFolder(_ref) {
  var folders = _ref.folders,
    files = _ref.files;
  return folders.length > 0 || files.length > 1;
};
var SIZE = '16';
var ShareboxModeOptions = function ShareboxModeOptions() {
  var currentViewedFiles = useSelector(selectCurrentViewedShareboxFiles);
  return [{
    content: 'mutualizedPreviewLabel',
    onClick: function onClick(_ref2) {
      var filesUuids = _ref2.filesUuids,
        dispatch = _ref2.dispatch;
      return dispatch(fileWindowUpdated(filesUuids[0]));
    },
    prefix: function prefix(_ref3) {
      var iconPrimaryColor = _ref3.iconPrimaryColor;
      return /*#__PURE__*/_jsx(Preview, {
        color: iconPrimaryColor,
        size: SIZE
      });
    },
    key: 'PREVIEW_FILE'
  }, {
    content: 'mutualizedDownloadButton',
    onClick: function onClick(_ref4) {
      var filesUuids = _ref4.filesUuids,
        dispatch = _ref4.dispatch;
      return dispatch(downloadOneFile({
        file: currentViewedFiles[filesUuids],
        urlTypeToChoose: 'cdn'
      }));
    },
    hideOption: function hideOption(_ref5) {
      var noImgOperationsAndDownload = _ref5.noImgOperationsAndDownload;
      return noImgOperationsAndDownload;
    },
    prefix: function prefix(_ref6) {
      var iconPrimaryColor = _ref6.iconPrimaryColor;
      return /*#__PURE__*/_jsx(Download, {
        color: iconPrimaryColor,
        size: SIZE
      });
    },
    key: 'DOWNLOAD_FILE'
  }, {
    content: 'mutualizedGetLinkLabel',
    onClick: function onClick(_ref7) {
      var filesUuids = _ref7.filesUuids,
        i18n = _ref7.i18n,
        info = _ref7.info;
      return copyText(getFileLink(currentViewedFiles[filesUuids]), i18n, info);
    },
    keepItemSelected: true,
    prefix: function prefix(_ref8) {
      var iconPrimaryColor = _ref8.iconPrimaryColor;
      return /*#__PURE__*/_jsx(Link, {
        color: iconPrimaryColor,
        size: SIZE
      });
    },
    key: 'GET_FILE_LINK',
    hideOption: hideIfNotOneItemOrIsFolder
  }];
};
export default ShareboxModeOptions;