import React from 'react'; import { useHistory } from 'react-router'; import { Navbar, NavbarGroup, NavbarDivider, Button, Classes, Tooltip, Position, } from '@blueprintjs/core'; import { FormattedMessage as T } from 'components'; import DashboardTopbarUser from 'components/Dashboard/TopbarUser'; import DashboardBreadcrumbs from 'components/Dashboard/DashboardBreadcrumbs'; import DashboardBackLink from 'components/Dashboard/DashboardBackLink'; import { Icon, Hint, If } from 'components'; import withUniversalSearchActions from 'containers/UniversalSearch/withUniversalSearchActions'; import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withDashboard from 'containers/Dashboard/withDashboard'; import QuickNewDropdown from 'containers/QuickNewDropdown/QuickNewDropdown'; import { compose } from 'utils'; import withSubscriptions from '../../containers/Subscriptions/withSubscriptions'; import { useGetUniversalSearchTypeOptions } from '../../containers/UniversalSearch/utils'; function DashboardTopbarSubscriptionMessage() { return (
); } function DashboardHamburgerButton({ ...props }) { return ( ); } /** * Dashboard topbar. */ function DashboardTopbar({ // #withDashboard pageTitle, editViewId, pageHint, // #withDashboardActions toggleSidebarExpand, // #withDashboard sidebarExpended, // #withGlobalSearch openGlobalSearch, // #withSubscriptions isSubscriptionActive, isSubscriptionInactive, }) { const history = useHistory(); const handlerClickEditView = () => { history.push(`/custom_views/${editViewId}/edit`); }; const handleSidebarToggleBtn = () => { toggleSidebarExpand(); }; return ( ); } export default compose( withUniversalSearchActions, withDashboard(({ pageTitle, pageHint, editViewId, sidebarExpended }) => ({ pageTitle, editViewId, sidebarExpended, pageHint, })), withDashboardActions, withSubscriptions( ({ isSubscriptionActive, isSubscriptionInactive }) => ({ isSubscriptionActive, isSubscriptionInactive, }), 'main', ), )(DashboardTopbar); /** * Dashboard quick search button. */ function DashboardQuickSearchButton({ ...rest }) { const searchTypeOptions = useGetUniversalSearchTypeOptions(); // Can't continue if there is no any search type option. if (searchTypeOptions.length <= 0) { return null; } return ( } text={