@finos/legend-application-marketplace
Version:
Legend Marketplace application core
64 lines • 3.29 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } 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 { useApplicationStore } from '@finos/legend-application';
import { BellIcon, ControlledDropdownMenu, HelpOutlineIcon, MenuContent, MenuContentDivider, MenuContentItem, ShoppingCartOutlineIcon, UserCircleIcon, } from '@finos/legend-art';
import { observer } from 'mobx-react-lite';
import { LEGEND_MARKETPLACE_ROUTE_PATTERN } from '../../__lib__/LegendMarketplaceNavigation.js';
import { Box } from '@mui/material';
export const LegendMarketplaceIconToolbar = observer(() => {
const applicationStore = useApplicationStore();
const username = applicationStore.identityService.currentUser === '(unknown)'
? 'user'
: applicationStore.identityService.currentUser;
const userIconRenderer = () => {
return (_jsx(ControlledDropdownMenu, { className: "legend-marketplace-header__menu-item", menuProps: {
anchorOrigin: { vertical: 'bottom', horizontal: 'center' },
transformOrigin: { vertical: 'top', horizontal: 'center' },
elevation: 7,
}, content: _jsxs(MenuContent, { children: [_jsxs(MenuContentItem, { disabled: true, children: ["Hello, ", username] }), _jsx(MenuContentDivider, {}), _jsx(MenuContentItem, { onClick: () => applicationStore.navigationService.navigator.goToLocation(LEGEND_MARKETPLACE_ROUTE_PATTERN.SUBSCRIPTIONS), children: "View Subscriptions" }), _jsx(MenuContentItem, { onClick: () => applicationStore.navigationService.navigator.goToLocation(LEGEND_MARKETPLACE_ROUTE_PATTERN.ORDERS), children: "View Orders" })] }), children: _jsx(UserCircleIcon, {}) }));
};
const toolbarIcons = [
{
icon: _jsx(UserCircleIcon, {}),
title: 'Profile',
renderer: userIconRenderer,
},
{
icon: _jsx(ShoppingCartOutlineIcon, {}),
title: 'Shopping Cart',
renderer: () => {
return _jsx(ShoppingCartOutlineIcon, {});
},
},
{
icon: _jsx(BellIcon, {}),
title: 'Notifications',
renderer: () => {
return _jsx(BellIcon, {});
},
},
{
icon: _jsx(HelpOutlineIcon, {}),
title: 'Help',
renderer: () => {
return _jsx(HelpOutlineIcon, {});
},
},
];
return (_jsx(Box, { className: "legend-marketplace-header__icons", children: toolbarIcons.map((item) => (_jsx("div", { className: "legend-marketplace-header__icon", children: item.renderer() }, item.title))) }));
});
//# sourceMappingURL=LegendMarketplaceIconToolbar.js.map