diff --git a/client/src/components/Dashboard/Dashboard.js b/client/src/components/Dashboard/Dashboard.js index 38887f7ed..a65662853 100644 --- a/client/src/components/Dashboard/Dashboard.js +++ b/client/src/components/Dashboard/Dashboard.js @@ -8,15 +8,10 @@ import DialogsContainer from 'components/DialogsContainer'; import PreferencesContent from 'components/Preferences/PreferencesContent'; import PreferencesSidebar from 'components/Preferences/PreferencesSidebar'; import Search from 'containers/GeneralSearch/Search'; -import withDashboard from 'containers/Dashboard/withDashboard'; -import { compose } from 'utils'; - -function Dashboard({ sidebarExpended }) { +export default function Dashboard() { return ( -
+
@@ -35,9 +30,3 @@ function Dashboard({ sidebarExpended }) {
); } - -export default compose( - withDashboard(({ sidebarExpended }) => ({ - sidebarExpended, - })), -)(Dashboard); diff --git a/client/src/components/Dashboard/DashboardViewsTabs.js b/client/src/components/Dashboard/DashboardViewsTabs.js new file mode 100644 index 000000000..e82f2a7c3 --- /dev/null +++ b/client/src/components/Dashboard/DashboardViewsTabs.js @@ -0,0 +1,79 @@ +import React, { useState, useMemo } from 'react'; +import { FormattedMessage as T } from 'react-intl'; +import PropTypes from 'prop-types'; +import { Button, Tabs, Tab, Tooltip, Position } from '@blueprintjs/core'; +import { If, Icon } from 'components'; + +export default function DashboardViewsTabs({ + tabs, + allTab = true, + newViewTab = true, + onNewViewTabClick, + onChange, + onTabClick, +}) { + const [currentView, setCurrentView] = useState(0); + + const handleClickNewView = () => { + onNewViewTabClick && onNewViewTabClick(); + }; + + const handleTabClick = (viewId) => { + onTabClick && onTabClick(viewId); + }; + + const mappedTabs = useMemo( + () => tabs.map((tab) => ({ ...tab, onTabClick: handleTabClick })), + [tabs], + ); + + const handleViewLinkClick = () => { + onNewViewTabClick && onNewViewTabClick(); + }; + + const handleTabsChange = (viewId) => { + setCurrentView(viewId); + onChange && onChange(viewId); + }; + + return ( + + {allTab && ( + } onClick={handleViewLinkClick} /> + )} + {mappedTabs.map((tab) => ( + + ))} + + + } + position={Position.RIGHT} + > +