mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: fix accounts issue.
This commit is contained in:
@@ -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 (
|
||||
<div className={classNames('dashboard', {
|
||||
'has-mini-sidebar': !sidebarExpended,
|
||||
})}>
|
||||
<div className={classNames('dashboard')}>
|
||||
<Switch>
|
||||
<Route path="/preferences">
|
||||
<Sidebar />
|
||||
@@ -35,9 +30,3 @@ function Dashboard({ sidebarExpended }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDashboard(({ sidebarExpended }) => ({
|
||||
sidebarExpended,
|
||||
})),
|
||||
)(Dashboard);
|
||||
|
||||
79
client/src/components/Dashboard/DashboardViewsTabs.js
Normal file
79
client/src/components/Dashboard/DashboardViewsTabs.js
Normal file
@@ -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 (
|
||||
<Tabs
|
||||
id="navbar"
|
||||
large={true}
|
||||
selectedTabId={currentView}
|
||||
className="tabs--dashboard-views"
|
||||
onChange={handleTabsChange}
|
||||
>
|
||||
{allTab && (
|
||||
<Tab id={0} title={<T id={'all'} />} onClick={handleViewLinkClick} />
|
||||
)}
|
||||
{mappedTabs.map((tab) => (
|
||||
<Tab id={tab.id} title={tab.name} onClick={handleTabClick} />
|
||||
))}
|
||||
|
||||
<If condition={newViewTab}>
|
||||
<Tooltip
|
||||
content={<T id={'create_a_new_view'} />}
|
||||
position={Position.RIGHT}
|
||||
>
|
||||
<Button
|
||||
className="button--new-view"
|
||||
icon={<Icon icon="plus" />}
|
||||
onClick={handleClickNewView}
|
||||
minimal={true}
|
||||
/>
|
||||
</Tooltip>
|
||||
</If>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
DashboardViewsTabs.propTypes = {
|
||||
tabs: PropTypes.array.isRequired,
|
||||
allTab: PropTypes.bool,
|
||||
newViewTab: PropTypes.bool,
|
||||
|
||||
onNewViewTabClick: PropTypes.func,
|
||||
onChange: PropTypes.func,
|
||||
onTabClick: PropTypes.func,
|
||||
};
|
||||
Reference in New Issue
Block a user