UNPKG

@finos/legend-application-marketplace

Version:
82 lines 8.55 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; /** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { observer } from 'mobx-react-lite'; import { LegendMarketplaceSearchBar } from '../../components/SearchBar/LegendMarketplaceSearchBar.js'; import { Badge, Button, ButtonGroup, Checkbox, FormControlLabel, FormGroup, Grid2 as Grid, Tooltip, Typography, } from '@mui/material'; import { useApplicationStore } from '@finos/legend-application'; import { LegendMarketplaceProviderCard } from '../../components/ProviderCard/LegendMarketplaceProviderCard.js'; import { useLegendMarketplaceBaseStore } from '../../application/LegendMarketplaceFrameworkProvider.js'; import { LegendMarketplacePage } from '../LegendMarketplacePage.js'; import { InfoCircleIcon } from '@finos/legend-art'; import { useEffect } from 'react'; export var VendorDataProviderType; (function (VendorDataProviderType) { VendorDataProviderType["ALL"] = "All"; VendorDataProviderType["DATAFEEDS"] = "Datafeeds"; VendorDataProviderType["TERMINAL_LICENSE"] = "Terminal License"; VendorDataProviderType["ADD_ONS"] = "Add-Ons"; })(VendorDataProviderType || (VendorDataProviderType = {})); export const RefinedVendorRadioSelector = observer((props) => { const { vendorDataState } = props; const radioOptions = [ VendorDataProviderType.ALL, VendorDataProviderType.DATAFEEDS, VendorDataProviderType.TERMINAL_LICENSE, VendorDataProviderType.ADD_ONS, ]; return (_jsx(ButtonGroup, { variant: "outlined", children: radioOptions.map((option) => (_jsx(Button, { onClick: () => vendorDataState.setProviderDisplayState(option), variant: vendorDataState.providerDisplayState === option ? 'contained' : 'outlined', sx: { fontSize: '12px', backgroundColor: vendorDataState.providerDisplayState === option ? 'primary' : 'white', }, children: option }, option))) })); }); const SearchResultsRenderer = observer((props) => { const { vendorDataState, providerResults, sectionTitle, seeAll, tooltip } = props; const applicationStore = useApplicationStore(); const onAddToCartClick = (providerResult) => { applicationStore.notificationService.notifySuccess(`'${providerResult.productName}' is added to your cart`); }; return (_jsxs("div", { children: [_jsxs("div", { className: "legend-marketplace-vendordata-main-search-results__category", children: [_jsx("div", { className: "legend-marketplace-vendordata-main-sidebar__title", children: sectionTitle }), tooltip && (_jsx(Tooltip, { title: tooltip, placement: 'right', arrow: true, children: _jsx(InfoCircleIcon, {}) })), seeAll && (_jsx("a", { href: "#", className: "see-all", onClick: () => { vendorDataState.setProviderDisplayState(sectionTitle); }, children: _jsx("strong", { children: "See All>" }) }))] }), _jsx(Grid, { container: true, spacing: { xs: 4 }, columns: { xs: 1, sm: 2, lg: 3, xxl: 4, xxxl: 5, xxxxl: 6 }, className: "legend-marketplace-vendordata-main-search-results__card-group", children: providerResults.map((provider) => (_jsx(Grid, { size: 1, children: _jsx(LegendMarketplaceProviderCard, { providerResult: provider, onAddToCartClick: () => onAddToCartClick(provider) }) }, provider.id))) })] })); }); export const VendorDataMainContent = observer((props) => { const { marketPlaceVendorDataState } = props; const addOnsInfoMessage = 'Addons cannot be ordered standalone. You must order terminal license with them.'; return (_jsxs("div", { className: "legend-marketplace-vendordata-main", children: [_jsxs("div", { className: "legend-marketplace-vendordata-main-sidebar col-sm-4", children: [_jsx("div", { className: "legend-marketplace-vendordata-main-sidebar__title", children: "Filters" }), _jsx("hr", {}), _jsx("div", { className: "legend-marketplace-vendordata-main-sidebar__subtitle", children: "Providers" }), _jsx("div", { className: "legend-marketplace-vendordata-main-content__sidebar__checkbox-filter-group", children: _jsx(FormGroup, { sx: { gap: '1rem' }, children: marketPlaceVendorDataState.dataFeedProviders.map((vendor) => (_jsx(FormControlLabel, { control: _jsx(Checkbox, { color: 'primary' }), label: _jsx(Typography, { sx: { fontSize: '14px' }, children: vendor.providerName }) }, vendor.id))) }) })] }), _jsxs("div", { className: "legend-marketplace-vendordata-main-search-results", children: [marketPlaceVendorDataState.providerDisplayState === VendorDataProviderType.ALL && (_jsxs(_Fragment, { children: [_jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.dataFeedProviders, sectionTitle: VendorDataProviderType.DATAFEEDS, seeAll: true }), _jsx("hr", {}), _jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.terminalProviders, sectionTitle: VendorDataProviderType.TERMINAL_LICENSE, seeAll: true }), _jsx("hr", {}), _jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.addOnProviders, sectionTitle: VendorDataProviderType.ADD_ONS, seeAll: true, tooltip: addOnsInfoMessage })] })), marketPlaceVendorDataState.providerDisplayState === VendorDataProviderType.DATAFEEDS && (_jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.dataFeedProviders, sectionTitle: VendorDataProviderType.DATAFEEDS, seeAll: false })), marketPlaceVendorDataState.providerDisplayState === VendorDataProviderType.TERMINAL_LICENSE && (_jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.terminalProviders, sectionTitle: VendorDataProviderType.TERMINAL_LICENSE, seeAll: false })), marketPlaceVendorDataState.providerDisplayState === VendorDataProviderType.ADD_ONS && (_jsx(SearchResultsRenderer, { vendorDataState: marketPlaceVendorDataState, providerResults: marketPlaceVendorDataState.addOnProviders, sectionTitle: VendorDataProviderType.ADD_ONS, seeAll: false, tooltip: addOnsInfoMessage }))] })] })); }); export const LegendMarketplaceVendorData = observer(() => { const baseStore = useLegendMarketplaceBaseStore(); const marketPlaceVendorDataState = baseStore.marketplaceVendorDataState; const onChange = (provider, query) => { // Handle search logic here }; useEffect(() => { marketPlaceVendorDataState.init(); }, [marketPlaceVendorDataState]); return (_jsxs(LegendMarketplacePage, { className: "legend-marketplace-vendor-data", children: [_jsxs("div", { className: "legend-marketplace-banner", children: [_jsx("div", { className: "legend-marketplace-banner__title", children: "Vendor Data" }), _jsx("div", { className: "legend-marketplace-banner__subtitle", children: _jsx("p", { children: "Discover high quality data" }) })] }), _jsxs("div", { className: "legend-marketplace-new-datasets", children: [_jsx("h3", { children: "Recently Onboarded" }), _jsx("div", { className: "legend-marketplace-new-datasets__buttons", children: marketPlaceVendorDataState.dataFeedProviders .slice(0, 10) .map((vendor) => (_jsx(Badge, { className: "legend-marketplace-new-datasets__providers", title: vendor.productName, children: vendor.productName }, vendor.id))) })] }), _jsxs("div", { className: "legend-marketplace-body__content", children: [_jsx(RefinedVendorRadioSelector, { vendorDataState: marketPlaceVendorDataState }), _jsx(LegendMarketplaceSearchBar, { onSearch: onChange }), _jsx(VendorDataMainContent, { marketPlaceVendorDataState: marketPlaceVendorDataState })] })] })); }); //# sourceMappingURL=LegendMarketplaceVendorData.js.map