UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

42 lines 3.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DownloadOptions = exports.DOWNLOAD_FILES_MENU_TEXT = exports.DOWNLOAD_OPTIONS_CONTAINER_CLASS = void 0; var tslib_1 = require("tslib"); var DownloadLoginModal_1 = require("./DownloadLoginModal"); var React = (0, tslib_1.__importStar)(require("react")); var react_bootstrap_1 = require("react-bootstrap"); var ElementWithTooltip_1 = require("../../widgets/ElementWithTooltip"); var ProgrammaticOptions_1 = (0, tslib_1.__importDefault)(require("./ProgrammaticOptions")); var ModalDownload_1 = (0, tslib_1.__importDefault)(require("../../../containers/ModalDownload")); var SynapseContext_1 = require("../../../utils/SynapseContext"); exports.DOWNLOAD_OPTIONS_CONTAINER_CLASS = 'SRC-download-options-container'; exports.DOWNLOAD_FILES_MENU_TEXT = 'Add To Download List'; var tooltipDownloadId = 'download'; var DownloadOptions = function (props) { var accessToken = (0, SynapseContext_1.useSynapseContext)().accessToken; var _a = React.useState(false), showLoginModal = _a[0], setShowLoginModal = _a[1]; var _b = React.useState(false), showExportMetadata = _b[0], setShowExportMetadata = _b[1]; var _c = React.useState(false), showProgrammaticOptions = _c[0], setShowProgrammaticOptions = _c[1]; var onDownloadFiles = props.onDownloadFiles, queryResultBundle = props.queryResultBundle, queryBundleRequest = props.queryBundleRequest, _d = props.darkTheme, darkTheme = _d === void 0 ? true : _d; return (React.createElement(React.Fragment, null, React.createElement(react_bootstrap_1.Dropdown, { as: "span" }, React.createElement(ElementWithTooltip_1.ElementWithTooltip, { idForToolTip: tooltipDownloadId, tooltipText: 'Download Options', size: "lg", darkTheme: darkTheme, icon: 'download' }), React.createElement(react_bootstrap_1.Dropdown.Menu, { className: "SRC-primary-color-hover-dropdown", alignRight: true }, React.createElement(react_bootstrap_1.Dropdown.Item, { onClick: function () { setShowExportMetadata(true); } }, "Export Table"), props.isFileView && (React.createElement(react_bootstrap_1.Dropdown.Item, { onClick: function () { return accessToken ? onDownloadFiles() : setShowLoginModal(true); } }, exports.DOWNLOAD_FILES_MENU_TEXT)), React.createElement(react_bootstrap_1.Dropdown.Item // @ts-ignore , { // @ts-ignore onClick: function () { return setShowProgrammaticOptions(true); } }, "Programmatic Options"))), showLoginModal && (React.createElement(DownloadLoginModal_1.DownloadLoginModal, { showModal: showLoginModal, onHide: function () { return setShowLoginModal(false); } })), // modal can render anywhere, this is not a particular location showExportMetadata && (React.createElement(ModalDownload_1.default, { onClose: function () { return setShowExportMetadata(false); }, queryBundleRequest: queryBundleRequest })), showProgrammaticOptions && queryResultBundle && (React.createElement(ProgrammaticOptions_1.default, { onHide: function () { return setShowProgrammaticOptions(false); }, queryBundleRequest: queryBundleRequest, queryResultBundle: queryResultBundle })))); }; exports.DownloadOptions = DownloadOptions; //# sourceMappingURL=DownloadOptions.js.map